mobgap.gait_sequences.evaluation.gsd_final_agg#

mobgap.gait_sequences.evaluation.gsd_final_agg(
agg_results: dict[str, float],
single_results: dict[str, list],
pipeline: GsdEmulationPipeline,
dataset: BaseGaitDatasetWithReference,
) tuple[dict[str, any], dict[str, list[any]]][source]#

Aggregate the performance metrics of a GSD algorithm over multiple datapoints.

Warning

This function is not meant to be called directly, but as final_aggregator in a tpcp.validate.Scorer. If you are writing custom scoring functions, you can use this function as a template or wrap it in a new function.

This function aggregates the performance metrics as follows:

  • All raw outputs (detected, reference, sampling_rate_hz) are concatenated to a single dataframe, to make it easier to work with and are returned as part of the single results.

  • We recalculate all performance metrics from calculate_unmatched_gsd_performance_metrics and calculate_matched_gsd_performance_metrics on the combined data. The results are prefixed with combined__. Compared to the per-datapoint results (which are calculated, as errors per recording -> average over all recordings), these metrics are calculated as combining all GSDs from all recordings and then calculating the performance metrics. Effectively, this means, that in the per_datapoint version, each recording is weighted equally, while in the combined version, each GS is weighted equally.

Parameters:
agg_results

The aggregated results from all datapoints (see Scorer).

single_results

The per-datapoint results (see Scorer).

pipeline

The pipline that was passed to the scorer. This is ignored in this function, but might be useful in custom final aggregators.

dataset

The dataset that was passed to the scorer.

Returns:
final_agg_results

The final aggregated results.

final_single_results

The per-datapoint results, that are not aggregated.