pysad.core.BaseMetric

class pysad.core.BaseMetric[source]

Abstract base class for metrics.

Methods

__init__()

get()

Gets the current value of the score.

update(y_true, y_pred)

Updates the metric with given true and predicted value for a timestep.

abstract get()[source]

Gets the current value of the score. Note that some methods such as AUPR and AUROC gives exception when used with only one class exist in the list of previous y_trues.

Returns:

The current score.

Return type:

float

abstract update(y_true, y_pred)[source]

Updates the metric with given true and predicted value for a timestep.

Parameters:
  • y_true (int) – Ground truth class. Either 1 or 0.

  • y_pred (float) – Predicted class or anomaly score. Higher values correspond to more anomalousness and lower values correspond to more normalness.