Delen via


SsaChangePointEstimator Class

Definition

Detect change points in time series using Singular Spectrum Analysis.

public sealed class SsaChangePointEstimator : Microsoft.ML.IEstimator<Microsoft.ML.Transforms.TimeSeries.SsaChangePointDetector>
type SsaChangePointEstimator = class
    interface IEstimator<SsaChangePointDetector>
Public NotInheritable Class SsaChangePointEstimator
Implements IEstimator(Of SsaChangePointDetector)
Inheritance
SsaChangePointEstimator
Implements

Remarks

To create this estimator, use DetectChangePointBySsa

Input and Output Columns

There is only one input column. The input column must be Single where a Single value indicates a value at a timestamp in the time series.

It produces a column that is a vector with 4 elements. The output vector sequentially contains alert level (non-zero value means a change point), score, p-value, and martingale value.

Estimator Characteristics

Does this estimator need to look at the data to train its parameters? Yes
Input column data type Single
Output column data type 4-element vector ofDouble
Exportable to ONNX No

Estimator Characteristics

Machine learning task Anomaly detection
Is normalization required? No
Is caching required? No
Required NuGet in addition to Microsoft.ML Microsoft.ML.TimeSeries

Training Algorithm Details

This class implements the general anomaly detection transform based on Singular Spectrum Analysis (SSA). SSA is a powerful framework for decomposing the time-series into trend, seasonality and noise components as well as forecasting the future values of the time-series. In principle, SSA performs spectral analysis on the input time-series where each component in the spectrum corresponds to a trend, seasonal or noise component in the time-series. For details of the Singular Spectrum Analysis (SSA), refer to this document.

Anomaly Scorer

Once the raw score at a timestamp is computed, it is fed to the anomaly scorer component to calculate the final anomaly score at that timestamp. There are two statistics involved in this scorer, p-value and martingale score.

P-value score

The p-value score indicates the p-value of the current computed raw score according to a distribution of raw scores. Here, the distribution is estimated based on the most recent raw score values up to certain depth back in the history. More specifically, this distribution is estimated using kernel density estimation with the Gaussian kernels of adaptive bandwidth. The p-value score is always in $[0, 1]$, and the lower its value, the more likely the current point is an outlier (also known as a spike).

Change point detection based on martingale score

The martingale score is an extra level of scoring that is built upon the p-value scores. The idea is based on the Exchangeability Martingales that detect a change of distribution over a stream of i.i.d. values. In short, the value of the martingale score starts increasing significantly when a sequence of small p-values detected in a row; this indicates the change of the distribution of the underlying data generation process. Thus, the martingale score is used for change point detection. Given a sequence of most recently observed p-values, $p1, \dots, p_n$, the martingale score is computed as:? $s(p1, \dots, p_n) = \prod_{i=1}^n \beta(p_i)$. There are two choices of $\beta$: $\beta(p) = e p^{\epsilon - 1}$ for $0 < \epsilon < 1$ or $\beta(p) = \int_{0}^1 \epsilon p^{\epsilon - 1} d\epsilon$.

If the martingle score exceeds $s(q_1, \dots, q_n)$ where $q_i=1 - \frac{\text{confidence}}{100}$, the associated timestamp may get a non-zero alert value for change point detection. Note that $\text{confidence}$ is defined in the signatures of DetectChangePointBySsa or DetectIidChangePoint.

Check the See Also section for links to usage examples.

Methods

Fit(IDataView)

Train and return a transformer.

GetOutputSchema(SchemaShape)

Schema propagation for transformers. Returns the output schema of the data, if the input schema is like the one provided.

Extension Methods

AppendCacheCheckpoint<TTrans>(IEstimator<TTrans>, IHostEnvironment)

Append a 'caching checkpoint' to the estimator chain. This will ensure that the downstream estimators will be trained against cached data. It is helpful to have a caching checkpoint before trainers that take multiple data passes.

WithOnFitDelegate<TTransformer>(IEstimator<TTransformer>, Action<TTransformer>)

Given an estimator, return a wrapping object that will call a delegate once Fit(IDataView) is called. It is often important for an estimator to return information about what was fit, which is why the Fit(IDataView) method returns a specifically typed object, rather than just a general ITransformer. However, at the same time, IEstimator<TTransformer> are often formed into pipelines with many objects, so we may need to build a chain of estimators via EstimatorChain<TLastTransformer> where the estimator for which we want to get the transformer is buried somewhere in this chain. For that scenario, we can through this method attach a delegate that will be called once fit is called.

Applies to

See also