gaitmap.evaluation_utils.precision_score#
- gaitmap.evaluation_utils.precision_score(matches_df: dict[Union[collections.abc.Hashable, str], pandas.core.frame.DataFrame], *, zero_division: typing_extensions.Literal[warn, 0, 1] = 'warn') dict[Union[collections.abc.Hashable, str], float][source]#
- gaitmap.evaluation_utils.precision_score(matches_df: DataFrame, *, zero_division: typing_extensions.Literal[warn, 0, 1] = 'warn') float
Compute the precision.
The precision is the ratio tp / (tp + fp) where tp is the number of true positives and fp the number of false positives. The precision is intuitively the ability of the classifier not to label as positive a sample that is negative.
The best value is 1 and the worst value is 0.
- Parameters:
- matches_df
A 3 column dataframe with the column names
s_id{stride_list_postfix},s_id{ground_truth_postfix}andmatch_typeor a dictionary of such dataframes. Each row is a match containing the index value of the left and the corresponding right one. Thematch_typecolumn indicates the type of match: “tp” (true positive), “fp” (false positives) or “fn” (false negative) if no segmented counterpart exists.- 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:
- precision_score
This is a float, if the input is just a single dataframe or a dictionary, if the input is a dictionary of dataframes.
See also
gaitmap.evaluation_utils.evaluate_segmented_stride_listGenerate matched_df from stride lists