graphid.core.mixin_callbacks module¶
- class graphid.core.mixin_callbacks.InfrCallbacks[source]¶
Bases:
object
Methods relating to callbacks that must be registered with the inference object for it to work properly.
- set_ranker(ranker)[source]¶
ranker should be a function that accepts a list of annotation ids and return a list of the top K ranked annotations.
- class graphid.core.mixin_callbacks.InfrCandidates[source]¶
Bases:
object
Methods that should be used by callbacks to add new edges to be considered as candidates in the priority queue.
- ensure_task_probs(edges)[source]¶
Ensures that probabilities are assigned to the edges. This gaurentees that infr.task_probs contains data for edges. (Currently only the primary task is actually ensured)
CommandLine
python -m graphid.core.mixin_callbacks InfrCandidates.ensure_task_probs
Doctest
>>> from graphid import demo >>> infr = demo.demodata_infr(num_pccs=6, p_incon=.5, size_std=2) >>> edges = list(infr.edges()) >>> infr.ensure_task_probs(edges) >>> assert all([np.isclose(sum(p.values()), 1) >>> for p in infr.task_probs['match_state'].values()])
- ensure_priority_scores(priority_edges)[source]¶
Ensures that priority attributes are assigned to the edges. This does not change the state of the queue.
Doctest
>>> from graphid import demo >>> infr = demo.demodata_infr(num_pccs=6, p_incon=.5, size_std=2) >>> edges = list(infr.edges()) >>> infr.ensure_priority_scores(edges)