orion.primitives.tadgan.score_anomalies

orion.primitives.tadgan.score_anomalies(y, y_hat, critic, index, score_window=10, critic_smooth_window=None, error_smooth_window=None, smooth=True, rec_error_type='point', comb='mult', lambda_rec=0.5)[source]

Compute an array of anomaly scores.

Anomaly scores are calculated using a combination of reconstruction error and critic score.

Parameters
  • y (ndarray) – Ground truth.

  • y_hat (ndarray) – Predicted values. Each timestamp has multiple predictions.

  • index (ndarray) – time index for each y (start position of the window)

  • critic (ndarray) – Critic score. Each timestamp has multiple critic scores.

  • score_window (int) – Optional. Size of the window over which the scores are calculated. If not given, 10 is used.

  • critic_smooth_window (int) – Optional. Size of window over which smoothing is applied to critic. If not given, 200 is used.

  • error_smooth_window (int) – Optional. Size of window over which smoothing is applied to error. If not given, 200 is used.

  • smooth (bool) – Optional. Indicates whether errors should be smoothed. If not given, True is used.

  • rec_error_type (str) – Optional. The method to compute reconstruction error. Can be one of [“point”, “area”, “dtw”]. If not given, ‘point’ is used.

  • comb (str) – Optional. How to combine critic and reconstruction error. Can be one of [“mult”, “sum”, “rec”]. If not given, ‘mult’ is used.

  • lambda_rec (float) – Optional. Used if comb=”sum” as a lambda weighted sum to combine scores. If not given, 0.5 is used.

Returns

Array of anomaly scores.

Return type

ndarray