CustomErrorAggregations#

class mobgap.pipeline.evaluation.CustomErrorAggregations[source]#

Custom aggregation functions that might be useful in addition to the once provided by pandas (e.g. mean/std).

The functions are designed to work in combination with the apply_aggregations.

Attributes:
icc

Calculate the intraclass correlation coefficient (ICC) for the detected and reference values.

quantiles

Calculate the quantiles of a measure.

loa

Calculate the limits of agreement of a measure.

conf_intervals

Calculate the confidence intervals of a measure.

n_datapoints

Calculate the number of datapoints in a dataframe.

Methods

conf_intervals([z_score])

Calculate the confidence intervals of a measure.

icc([reference_col_name, detected_col_name, ...])

Calculate the intraclass correlation coefficient (ICC) for the detected and reference values.

loa([agreement])

Calculate the limits of agreement of a measure.

quantiles([lower, upper])

Calculate the quantiles of a measure.

n_datapoints

__init__(*args, **kwargs)#
conf_intervals(z_score: float = 1.96) tuple[float, float][source]#

Calculate the confidence intervals of a measure.

Parameters:
series

The Series containing the data column of interest.

z_score

The agreement level for the limits of agreement.

Returns:
conf_intervals

The lower and upper confidence intervals as a tuple.

icc(
reference_col_name: str = 'reference',
detected_col_name: str = 'detected',
*,
icc_type: str = 'icc2',
nan_policy: Literal['raise', 'omit'] = 'raise',
) tuple[float, tuple[float, float]][source]#

Calculate the intraclass correlation coefficient (ICC) for the detected and reference values.

Parameters:
df

The DataFrame containing the reference and detected values.

reference_col_name

The identifier of the column containing the reference values.

detected_col_name

The identifier of the column containing the detected values.

icc_type

The type of the ICC. Can be one of “icc1”, “icc2”, “icc3”, “icc1k”, “icc2k”, “icc3k”. See the documentation of the pingouin.intraclass_corr function for more information. Default is “icc2”, often also referred to as ICC(2,1).

nan_policy

How to handle NaN values. Can be one of “raise” (error is raised), or “omit” (NaN values are ignored). Default is “raise”.

Returns:
icc, ci95

A tuple containing the intraclass correlation coefficient (ICC) as first item and the lower and upper bound of its 95% confidence interval (CI95%) as second item.

Notes

Note, that in case of ICC2, the confidence interval is reported as [np.nan, np.nan] if the ICC is 1 or 0 (aka perfect agreement or disagreement) as the confidence interval is not defined in this case. Other implementations might return [1, 1] in this case.

loa(agreement: float = 1.96) tuple[float, float][source]#

Calculate the limits of agreement of a measure.

Parameters:
series

The Series containing the data column of interest.

agreement

The agreement level for the limits of agreement.

Returns:
loa

The lower and upper limits of agreement as a tuple.

quantiles(
lower: float = 0.05,
upper: float = 0.95,
) tuple[float, float][source]#

Calculate the quantiles of a measure.

Parameters:
series

The Series containing the data column of interest.

lower

The lower quantile to calculate.

upper

The upper quantile to calculate.

Returns:
quantiles

The lower and upper quantiles as a tuple.

Examples using mobgap.pipeline.evaluation.CustomErrorAggregations#

Cadence Evaluation

Cadence Evaluation

Stride Length Evaluation

Stride Length Evaluation