fuzzyclust.timeseries.make_piecewise_timeseries#
- fuzzyclust.timeseries.make_piecewise_timeseries(n_samples=2000, n_features=6, n_latent=2, change_points=(500, 1000, 1500), change_kinds=('correlation', 'mean', 'both'), mean_shift=4.0, noise=0.2, latent_noise=0.5, random_state=None)[source]#
Multivariate series with planted regime changes (segmentation benchmark).
Mimics the synthetic data set of Abonyi et al. (2005):
n_latenthidden variables \(\mathbf{y}_k\) are drawn around a piecewise-constant mean, and the observed variables are linear mixtures \(\mathbf{x}_k=\mathbf{W}\mathbf{y}_k+\boldsymbol{\varepsilon}_k\). At every change point one of three things happens:"mean"– the mean of the latent variables jumps (the hyperplane of the observations is shifted but keeps its orientation);"correlation"– the mixing matrix \(\mathbf{W}\) is replaced (the correlation structure of the observations changes while the mean is kept);"both"– both change.
The true segment of every sample is returned, so that segmentation algorithms can be evaluated. A segmentation that uses only one variable cannot see a pure correlation change.
- Parameters:
- n_samples
int, default=2000 - n_features
int, default=6 Number of observed variables \(n\).
- n_latent
int, default=2 Number of latent variables (the rank of the local PCA models).
- change_pointssequence
ofint, default=(500, 1000, 1500) Sample indices where a new segment starts.
- change_kindssequence
of{“mean”, “correlation”, “both”} What changes at every change point (same length as
change_points).- mean_shift
float, default=4.0 Scale of the latent mean jumps.
- noise
float, default=0.2 Standard deviation of the observation noise.
- latent_noise
float, default=0.5 Standard deviation of the latent variables around their mean.
- random_state
int,RandomStateinstanceorNone
- n_samples
- Returns:
Examples
>>> from fuzzyclust.timeseries import make_piecewise_timeseries >>> X, seg = make_piecewise_timeseries(n_samples=400, change_points=(200,), ... change_kinds=("mean",), random_state=0) >>> X.shape, seg.max() ((400, 6), np.int64(1))
Examples using fuzzyclust.timeseries.make_piecewise_timeseries#
Bottom-up segmentation with PCA models versus fuzzy segmentation