Interval scorers#

Interval scorers evaluate a scalar score on intervals of a time series. They are the building blocks of all detectors in Skchange and come in several flavours: costs, change scores, savings, and transient scores. All scorers share the common base class BaseIntervalScorer.

Base classes#

BaseIntervalScorer()

Base class for interval scorers.

BaseCost()

Base class for cost scorers.

BaseChangeScore()

Base class for change score scorers.

BaseSaving()

Base class for saving scorers.

BaseTransientScore()

Base class for transient score scorers.

Costs#

A cost measures how well a single interval is fit by a parametric model.

EDFCost([n_quantiles])

Empirical distribution function (EDF) cost.

GaussianCost()

Gaussian (negative log-likelihood) cost function.

L1Cost()

L1 (absolute error) cost function.

L2Cost()

L2 (squared error) cost function.

LaplaceCost()

Laplace distribution twice negative log-likelihood cost.

LinearRegressionCost([response_col])

Linear regression sum-of-squared-residuals cost.

LinearTrendCost([time_col])

Linear trend cost function.

MultivariateGaussianCost()

Multivariate Gaussian (negative log-likelihood) cost.

MultivariateTCost([fixed_dof, ...])

Multivariate T-distribution twice negative log-likelihood cost.

PoissonCost()

Poisson distribution twice negative log-likelihood cost.

RankCost()

Rank-based multivariate cost.

Change scores#

A change score measures the evidence for a change between two adjacent intervals. CostChangeScore adapts any cost into a change score.

ContinuousLinearTrendScore([time_col])

Continuous linear trend change score.

CostChangeScore(cost)

Change scorer constructed from a cost scorer.

CUSUM()

CUSUM change score for a change in mean.

ESACScore([penalty_scale_dense, ...])

ESAC score for detecting changes in the mean of high-dimensional data.

MultivariateGaussianScore([...])

Multivariate Gaussian change score for a change in mean and/or covariance.

RankScore()

Rank-based change score for multivariate data.

Savings#

A saving measures the evidence that an interval deviates from a baseline model. Savings are used by segment-anomaly detectors such as CAPA.

GaussianSaving([baseline_mean, baseline_var])

Gaussian saving for a fixed mean and variance baseline.

L1Saving([baseline_location])

L1 saving for a fixed median baseline.

L2Saving([baseline_mean])

L2 saving for a fixed baseline mean.

LaplaceSaving([baseline_location, ...])

Laplace saving for a fixed location and scale baseline.

LinearRegressionSaving([response_col, ...])

Linear regression saving for a fixed coefficient baseline.

LinearTrendSaving([baseline_slope, ...])

Linear trend saving for a fixed slope/intercept baseline.

MultivariateGaussianSaving([baseline_mean, ...])

Multivariate Gaussian saving for a fixed mean and covariance baseline.

MultivariateTSaving([baseline_mean, ...])

Multivariate T-distribution saving for a fixed mean and scale baseline.

PoissonSaving([baseline_rate])

Poisson saving for a fixed rate baseline.

Transient scores#

A transient score measures the evidence for a short-lived deviation inside an interval. Transient scores are used by detectors that target point anomalies embedded in a longer segment. CostTransientScore adapts any cost into a transient score.

CostTransientScore(cost)

Transient score constructed from a cost scorer.

L2TransientScore()

Native L2 transient score (epidemic changepoint model).

Predicates#

Type predicates for runtime checks on scorer instances.

is_cost(estimator)

Return True if the given estimator is (probably) a cost scorer.

is_change_score(estimator)

Return True if the given estimator is (probably) a change score scorer.

is_saving(estimator)

Return True if the given estimator is (probably) a saving scorer.

is_transient_score(estimator)

Return True if the given estimator is (probably) a transient score scorer.

is_aggregated_score(estimator)

Return True if the given estimator is an aggregated interval scorer.

is_penalised_score(estimator)

Return True if the given estimator is a penalised interval scorer.