pybaselines.utils.relative_difference
- pybaselines.utils.relative_difference(old, new, norm_order=None)[source]
Calculates the relative difference,
(norm(new-old) / norm(old)), of two values.Used as an exit criteria in many baseline algorithms.
- Parameters:
- old
numpy.ndarrayorfloat The array or single value from the previous iteration.
- new
numpy.ndarrayorfloat The array or single value from the current iteration.
- norm_order
int, optional The type of norm to calculate. Default is None, which is l2 norm for arrays, abs for scalars.
- old
- Returns:
floatThe relative difference between the old and new values.