mvtsa.segmentation.RecursivePCASegmenter#

class mvtsa.segmentation.RecursivePCASegmenter(threshold=0.8, n_components=2, forgetting=0.98, variable_forgetting=True, lags=0, warmup=50, patience=5, scale=True, refine=True)[source]#

Bases: BaseSegmenter

On-line segmentation with recursive (dynamic) PCA.

A recursive PCA model with a variable forgetting factor is updated at every sample (RecursivePCA). The model of the current segment is frozen after warmup samples; when the Krzanowski similarity between the running model and the segment model stays below threshold for patience consecutive samples, a change point is declared at the first of them and a new segment starts (Dobos and Abonyi, 2012). The detector works sample by sample, so it can be run on a stream with partial_fit().

Parameters:
thresholdfloat

Similarity limit in [0, 1].

n_componentsint

Components compared.

forgettingfloat

Nominal forgetting factor of the recursive model.

variable_forgettingbool

Use the Fortescue-type variable forgetting factor.

lagsint

Dynamic PCA lags.

warmupint

Samples used to build the model of a new segment.

patienceint

Consecutive low-similarity samples required for a change.

scalebool or (mean, std)

Standardization; True uses the statistics of the series passed to fit(), a tuple fixes them for streaming use.

refinebool

After a detection, localize the change retrospectively: the split of the samples of the current segment that minimizes the two-segment PCA \(Q\) + \(T^2\) (Gaussian) cost; the detection delay of the recursive model is removed from the reported change point.

Attributes:
similarity_array (T,)

Similarity profile (NaN during warm-up).

forgetting_array (T,)

Forgetting factor used at every sample.

partial_fit(x)[source]#

Process one sample; returns True if a change point was declared.

Examples using mvtsa.segmentation.RecursivePCASegmenter#

On-line segmentation with recursive PCA

On-line segmentation with recursive PCA