mobgap.initial_contacts.evaluation.icd_final_agg#

mobgap.initial_contacts.evaluation.icd_final_agg(
agg_results: dict[str, float],
single_results: dict[str, list],
pipeline: IcdEmulationPipeline,
dataset: BaseGaitDatasetWithReference,
) tuple[dict[str, any], dict[str, list[any]]][source]#

Aggregate the performance metrics of an ICD 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_matched_icd_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 ICDs 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 IC is weighted equally.

Parameters:
agg_results

The aggregated results from all datapoints (see Scorer).

single_results

The per-datapoint results (see Scorer).

pipeline

The pipeline 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.