Single Source Result#
A child class of SourceResult for returning information to the user about a single-source inference algorithm that has been run.
- class cosasi.source_inference.source_results.SingleSourceResult(*args, **kwargs)#
Response object for the result of single-source inference.
- Parameters
inference_method (str) – name of the source localization algorithm used
scores (dict) – per-node scores for ranking, retrieval, etc.
algorithm_details (bool) – if True, includes relevant information about the source inference algorithm used
reverse (bool (default True)') – if True, ranks items from highest score to lowest if False, ranks items from lowest score to highest
Methods
evaluate(true_source)Runs evaluation algorithms and returns a dictionary of results.
evaluate_distance(true_source)Finds the shortest path length between each node in the solution set and the true souce.
evaluate_solution_rank(true_source)Finds the rank of the true source, by the algorithm's scoring protocol.
get_rank(v[, soft_rank])Returns the rank of vertex (1 = "best")
rank()Rank nodes by score.
topn([n])Returns the top n item indices by rank.
- get_rank(v, soft_rank=False)#
Returns the rank of vertex (1 = “best”)
- Parameters
v (graph index - str, int, etc.) – vertex of interest
soft_rank (bool) – if True and v is not in the list of hypotheses, returns 1 more than the number of hypotheses
- Return type
int