graphid.core.mixin_helpers module¶
- class graphid.core.mixin_helpers.AttrAccess[source]¶
Bases:
object
Contains non-core helper functions
- gen_edge_attrs(key, edges=None, default=NoParam, on_missing=None)[source]¶
maybe change to gen edge items
- class graphid.core.mixin_helpers.Convenience[source]¶
Bases:
object
- property pos_graph¶
- property neg_graph¶
- property incomp_graph¶
- property unreviewed_graph¶
- property unknown_graph¶
- pair_connection_info(aid1, aid2)[source]¶
Helps debugging when ibs.nids has info that annotmatch/staging do not Note: the relevant ibs parts were removed. Perhaps this is not useful now or should be moved to the ibeis plugin?
Example
>>> from graphid import demo >>> infr = demo.demodata_infr(num_pccs=3, size=4) >>> aid1, aid2 = 1, 2 >>> print(infr.pair_connection_info(aid1, aid2))
- match_state_df(index)[source]¶
Returns the current matching state of a list of edges.
PERHAPS WE SHOULD DEPRICATE THIS FUNCTION?
Note
This does NOT use the IBEIS database state, where as the original version of this function did.
CommandLine
python -m graphid.core.mixin_helpers Convenience.match_state_df
Example
>>> from graphid import demo >>> infr = demo.demodata_infr(num_pccs=2, p_incomp=.8, size=4) >>> index = list(infr.edges()) >>> print(infr.match_state_df(index)) NEGTV POSTV INCMP aid1 aid2 1 3 False False True 4 False False True 2 False True False 2 3 False False True 4 False False True 3 4 False True False 5 False False True 5 8 False False True 7 False False True 6 False False True 6 8 False False True 7 False False True 7 8 False False True
- class graphid.core.mixin_helpers.DummyEdges[source]¶
Bases:
object
- ensure_mst(label='name_label', meta_decision='same')[source]¶
Ensures that all names are names are connected.
- Parameters:
label (str) – node attribute to use as the group id to form the mst.
meta_decision (str) – if specified adds clique edges as feedback items with this decision. Otherwise the edges are only explicitly added to the graph. This makes feedback items with user_id=algo:mst and with a confidence of guessing.
Example
>>> from graphid import demo >>> infr = demo.demodata_infr(num_pccs=3, size=4) >>> assert infr.status()['nCCs'] == 3 >>> infr.clear_edges() >>> assert infr.status()['nCCs'] == 12 >>> infr.ensure_mst() >>> assert infr.status()['nCCs'] == 3
- ensure_cliques(label='name_label', meta_decision=None)[source]¶
Force each name label to be a clique.
- Parameters:
label (str) – node attribute to use as the group id to form the cliques.
meta_decision (str) – if specified adds clique edges as feedback items with this decision. Otherwise the edges are only explicitly added to the graph.
- Parameters:
label (str) – defaults to ‘name_label’
meta_decision (str) – if specified, the feedback edges added are added this meta decision and with the user_id=algo:clique.
CommandLine
python -m graphid.core.mixin_helpers ensure_cliques
Example
>>> from graphid import demo >>> label = 'name_label' >>> infr = demo.demodata_infr(num_pccs=3, size=5) >>> print(ub.urepr(infr.status())) >>> assert infr.status()['nEdges'] < 33 >>> infr.ensure_cliques() >>> print(ub.urepr(infr.status())) >>> assert infr.status()['nEdges'] == 31 >>> assert infr.status()['nUnrevEdges'] == 12 >>> assert len(list(infr.find_clique_edges(label))) > 0 >>> infr.ensure_cliques(meta_decision=SAME) >>> assert infr.status()['nUnrevEdges'] == 0 >>> assert len(list(infr.find_clique_edges(label))) == 0
- find_clique_edges(label='name_label')[source]¶
Augmenting edges that would complete each the specified cliques. (based on the group inferred from label)
- Parameters:
label (str) – node attribute to use as the group id to form the cliques.
- find_mst_edges(label='name_label')[source]¶
Returns edges to augment existing PCCs (by label) in order to ensure they are connected with positive edges.
Example
>>> # DISABLE_DOCTEST >>> from graphid.core.mixin_helpers import * # NOQA >>> import ibeis >>> ibs = ibeis.opendb(defaultdb='PZ_MTEST') >>> infr = ibeis.AnnotInference(ibs, 'all', autoinit=True) >>> label = 'orig_name_label' >>> label = 'name_label' >>> infr.find_mst_edges() >>> infr.ensure_mst()