graphid.demo.dummy_algos module

class graphid.demo.dummy_algos.DummyRanker(verif)[source]

Bases: object

Generates dummy rankings

predict_single_ranking(u, K=10)[source]

simulates the ranking algorithm. Order is defined using the dummy vsone scores, but tests are only applied to randomly selected gt and gf pairs. So, you usually will get a gt result, but you might not if all the scores are bad.

predict_rankings(nodes, K=10)[source]

Yields a list ranked edges connected to each node.

predict_candidate_edges(nodes, K=10)[source]

CommandLine

python -m graphid.demo.dummy_algos DummyRanker.predict_candidate_edges

Example

>>> from graphid import demo
>>> kwargs = dict(num_pccs=40, size=2)
>>> infr = demo.demodata_infr(**kwargs)
>>> edges = list(infr.ranker.predict_candidate_edges(infr.aids, K=100))
>>> scores = np.array(infr.verifier.predict_edges(edges))
>>> assert len(edges) > 0
class graphid.demo.dummy_algos.DummyVerif(infr)[source]

Bases: object

Generates dummy scores between pairs of annotations. (not necesarilly existing edges in the graph)

CommandLine

python -m graphid.demo DummyVerif:1

Example

>>> from graphid.demo import *  # NOQA
>>> from graphid import demo
>>> kwargs = dict(num_pccs=6, p_incon=.5, size_std=2)
>>> infr = demo.demodata_infr(**kwargs)
>>> infr.dummy_verif.predict_edges([(1, 2)])
>>> infr.dummy_verif.predict_edges([(1, 21)])
>>> assert len(infr.dummy_verif.infr.task_probs['match_state']) == 2
predict_proba_df(edges)[source]

CommandLine

python -m graphid.demo DummyVerif.predict_edges

Example

>>> from graphid import demo
>>> kwargs = dict(num_pccs=40, size=2)
>>> infr = demo.demodata_infr(**kwargs)
>>> verif = infr.dummy_verif
>>> edges = list(infr.graph.edges())
>>> probs = verif.predict_proba_df(edges)
predict_edges(edges)[source]
show_score_probs()[source]

CommandLine

python -m graphid.demo.dummy_algos DummyVerif.show_score_probs --show

Example

>>> from graphid import core
>>> from graphid import demo
>>> infr = core.AnnotInference()
>>> verif = demo.DummyVerif(infr)
>>> verif.show_score_probs()
>>> util.show_if_requested()
_get_truth(edge)[source]