ErrorTransformFuncs#

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

Typical row by row error functions.

All functions expect a dataframe df as input that contains a column called reference and a column called detected (per default). The name of the columns can be changed using the reference_col_name and detected_col_name parameters.

The functions return a series with the same index as the input dataframe.

Attributes:
error

Calculate the error between the detected and reference values.

rel_error

Calculate the relative error between the detected and reference values.

abs_error

Calculate the absolute error between the detected and reference values.

abs_rel_error

Calculate the absolute relative error between the detected and reference values.

Methods

abs_error([reference_col_name, ...])

Calculate the absolute error between the detected and reference values.

abs_rel_error([reference_col_name, ...])

Calculate the absolute relative error between the detected and reference values.

error([reference_col_name, detected_col_name])

Calculate the error between the detected and reference values.

rel_error([reference_col_name, ...])

Calculate the relative error between the detected and reference values.

__init__(*args, **kwargs)#
abs_error(
reference_col_name: str = 'reference',
detected_col_name: str = 'detected',
) Series[source]#

Calculate the absolute error between 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.

Returns:
abs_error

The absolute error between the detected and reference values in the form abs(detected - reference).

abs_rel_error(
reference_col_name: str = 'reference',
detected_col_name: str = 'detected',
zero_division_hint: Literal['warn', 'raise'] | float = 'warn',
) Series[source]#

Calculate the absolute relative error between 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.

zero_division_hint

How to handle zero division errors. Can be one of “warn” (warning is given, respective values are set to NaN), “raise” (error is raised), or “np.nan” (respective values are silently set to NaN).

Returns:
abs_rel_error

The absolute relative error between the detected and reference values in the form abs((detected - reference) / reference).

error(
reference_col_name: str = 'reference',
detected_col_name: str = 'detected',
) Series[source]#

Calculate the error between 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.

Returns:
error

The error between the detected and reference values in the form detected - reference

rel_error(
reference_col_name: str = 'reference',
detected_col_name: str = 'detected',
zero_division_hint: Literal['warn', 'raise'] | float = 'warn',
) Series[source]#

Calculate the relative error between 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.

zero_division_hint

How to handle zero division errors. Can be one of “warn” (warning is given, respective values are set to NaN), “raise” (error is raised), or “np.nan” (respective values are silently set to NaN).

Returns:
rel_error

The relative error between the detected and reference values in the form (detected - reference) / reference.

Examples using mobgap.pipeline.evaluation.ErrorTransformFuncs#

Cadence Evaluation

Cadence Evaluation

Stride Length Evaluation

Stride Length Evaluation