metrics_table#
- er_evaluation.metrics_table(predictions, references, metrics={'B-Cubed F1': <function b_cubed_f>, 'B-Cubed Precision': <function b_cubed_precision>, 'B-Cubed Recall': <function b_cubed_recall>, 'Cluster F1': <function cluster_f>, 'Cluster Precision': <function cluster_precision>, 'Cluster Recall': <function cluster_recall>, 'Pairwise F1': <function pairwise_f>, 'Pairwise Precision': <function pairwise_precision>, 'Pairwise Recall': <function pairwise_recall>})[source]#
Apply a set of metrics to all combinations of prediction and reference membership vectors.
- Parameters:
predictions (Dict) – Dictionary of membership vectors.
references (Dict) – Dictionary of membership vectors.
metrics (Dict) – Dictionary of metrics to apply to the prediction and reference pairs.
- Returns:
Dataframe with columns “prediction”, “reference”, “metric”, and “value”, containing the value of the given metric applied to the corresponding prediction and reference membership vector.
- Return type:
DataFrame
Examples
>>> predictions = {"prediction_1": pd.Series(index=[1,2,3,4,5,6,7,8], data=[1,1,2,3,2,4,4,4])} >>> references = {"reference_1": pd.Series(index=[1,2,3,4,5,6,7,8], data=["c1", "c1", "c1", "c2", "c2", "c3", "c3", "c4"])} >>> metrics = {"precision": pairwise_precision, "recall": pairwise_recall} >>> metrics_table(predictions, references, metrics) prediction reference metric value 0 prediction_1 reference_1 precision 0.4 1 prediction_1 reference_1 recall 0.4