mobgap.gait_sequences.evaluation.calculate_unmatched_gsd_performance_metrics#

mobgap.gait_sequences.evaluation.calculate_unmatched_gsd_performance_metrics(
*,
gsd_list_detected: DataFrame,
gsd_list_reference: DataFrame,
sampling_rate_hz: float,
zero_division_hint: Literal['warn', 'raise'] | float = 'warn',
) dict[str, float | int][source]#

Calculate general performance metrics that don’t rely on matching the detected and reference gait sequences.

Metrics calculated by this function are just based on the overall amount of gait detected. The following metrics are calculated:

  • reference_gs_duration_s: Total duration of the reference gait sequences in seconds.

  • detected_gs_duration_s: Total duration of the detected gait sequences in seconds.

  • gs_duration_error_s: Difference between the detected and reference gait sequence duration in seconds.

  • gs_relative_duration_error: gs_duration_error_s divided by reference_gs_duration_s.

  • gs_absolute_duration_error_s: Absolute value of gs_duration_error_s.

  • gs_absolute_relative_duration_error: gs_absolute_duration_error_s divided by reference_gs_duration_s.

  • gs_absolute_relative_duration_error_log: np.log(1 + gs_duration_error_abs_rel)

  • detected_num_gs: Total number of detected gait sequences.

  • reference_num_gs: Total number of reference gait sequences.

  • num_gs_error: Difference between the detected and reference number of gait sequences.

  • num_gs_relative_error: num_gs_error divided by reference_num_gs.

  • num_gs_absolute_error: Absolute value of num_gs_error.

  • num_gs_absolute_relative_error: num_gs_absolute_error divided by reference_num_gs.

  • num_gs_absolute_relative_error_log: np.log(1 + num_gs_absolute_relative_error)

Parameters:
gsd_list_detected

Each row contains a detected gait sequence interval as output from the GSD algorithms. The respective start index is stored in a column named start and the stop index in a column named end.

gsd_list_reference

Gold standard to validate the detected gait sequences against. Should have the same format as gsd_list_detected.

sampling_rate_hz

Sampling frequency of the recording in Hz.

zero_division_hint“warn”, “raise” or np.nan, default=”warn”

Controls the behavior when there is a zero division. If set to “warn”, affected metrics are set to NaN and a warning is raised. If set to “raise”, a ZeroDivisionError is raised. If set to np.nan, the warning is suppressed and the affected metrics are set to NaN. Zero division can occur if there are no gait sequences in the reference data, i.e., reference_gs_duration_s = 0

Returns:
gsd_metrics: dict

See also

calculate_matched_gsd_performance_metrics

For calculating performance metrics based on the matched overlap with the reference.

categorize_intervals_per_sample

For categorizing the detected and reference gait sequences on a sample-wise level.