src.variants.metrics.time_metrics module

This module includes time series validation metrics.

It includes several time series metrics. See details in their own documentations. The functions are mainly based on numpy arrays for fast vectorized operations.

Contact person: Stefan Riedmaier Creation date: 03.06.2020 Python version: 3.8

src.variants.metrics.time_metrics.dtw(y_true, y_pred)

This function calculates the dynamic time warping (DTW) distance.

https://pypi.org/project/dtw-python/ from dtw import dtw, warpArea

https://pypi.org/project/dtaidistance/ https://pypi.org/project/fastdtw/ https://github.com/pierre-rouanet/dtw

Parameters:
  • y_true (np.ndarray) – observed outputs

  • y_pred (np.ndarray) – predicted outputs

Returns:

dynamic time warping distance

Return type:

np.ndarray

src.variants.metrics.time_metrics.russell_error_factors(y_true, y_pred, axis=-1)

This function calculates the magnitude, phase and comprehensive error factor by Russell.

Literature: Russell, D. M.: Error measures for comparing transient data: Part I: Development of a comprehensive error measure, Part II: Error measures case study. Proceedings of the 68th Shock and Vibration Symposium, Hunt Valley, Maryland, 1997

Parameters:
  • y_true (np.ndarray) – observed outputs

  • y_pred (np.ndarray) – predicted outputs

  • axis (int) – (optional) along this axis the operation is performed

Returns:

comprehensive, magnitude, phase error factor by Russell

Return type:

tuple(np.ndarray, np.ndarray, np.ndarray)

src.variants.metrics.time_metrics.sprague_geers_error_factors(y_true, y_pred, axis=-1)

This function calculates the magnitude, phase and comprehensive error factor by Sprague and Geers.

Literature: Sprague, M.A., Geers, T.L.: A Spectral-element method for modelling cavitation in transient fluidstructure interaction. International Journal for Numerical Methods in Engineering 60 (2004), pp. 2467-2499

Parameters:
  • y_true (np.ndarray) – observed outputs

  • y_pred (np.ndarray) – predicted outputs

  • axis (int) – (optional) along this axis the operation is performed

Returns:

comprehensive, magnitude, phase error factor by Sprague and Geers

Return type:

tuple(np.ndarray, np.ndarray, np.ndarray)