precision_recall_f1_score#
- mobgap.utils.evaluation.precision_recall_f1_score( ) dict[str, float][source]#
Compute precision, recall and F1-score.
The precision is the ratio tp / (tp + fp), where tp is the number of true positives and fp the number of false positives. Intuitively speaking, the precision is the ability of the classifier not to label a negative sample as positive.
The recall is the ratio tp / (tp + fn), where tp is the number of true positives and fn the number of false negatives. Intuitively speaking, the recall is the ability of the classifier to find all the positive samples.
The F1 score can be interpreted as the harmonic mean of precision and recall, where an F1 score reaches its best value at 1 and worst score at 0.
- Parameters:
- matches_df
A 3 column dataframe. Currently supported are dataframes resulting either from the evaluation of gait sequence detection algorithms (results from
categorize_intervals_per_sample), or from the evaluation of initial contact detection algorithms (results fromcategorize_ic_list). To be handled like a gait sequence detection evaluation dataframe, thematches_dfmust have columns “start”, “end”, and “match_type”. To be handled like an initial contact detection evaluation dataframe, thematches_dfmust have columns “ic_id_detected”, “ic_id_reference”, “match_type”. Thematch_typecolumn indicates the type of match: “tp” (true positive), “fp” (false positives), or “fn” (false negative) or “tn” (true negative). Any “tn” matches are ignored in the initial contact match dataframe, since they are not meaningful and normally not reported in this application.- zero_division“warn”, 0 or 1, default=”warn”
Sets the value to return when there is a zero division. If set to “warn”, this acts as 0, but warnings are also raised.
- Returns:
- score_metrics{“precision”: precision, “recall”: recall, “f1_score”: f1_score}