ErrorTransformFuncs#
- class mobgap.pipeline.evaluation.ErrorTransformFuncs[source]#
Typical row by row error functions.
All functions expect a dataframe
dfas input that contains a column calledreferenceand a column calleddetected(per default). The name of the columns can be changed using thereference_col_nameanddetected_col_nameparameters.The functions return a series with the same index as the input dataframe.
- Attributes:
errorCalculate the error between the detected and reference values.
rel_errorCalculate the relative error between the detected and reference values.
abs_errorCalculate the absolute error between the detected and reference values.
abs_rel_errorCalculate 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( ) 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',
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( ) 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',
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.