fuzzyclust.relational.make_warped_series#
- fuzzyclust.relational.make_warped_series(n_series_per_class=20, length=60, warp=0.25, noise=0.1, shift=0.1, random_state=None)[source]#
Time series of three shape classes with random time warps.
The classes are a bell (one Gaussian bump), a step (a sigmoid rise from 0 to 1) and a double bump (two narrower Gaussian bumps). Each series is the class shape evaluated on a randomly warped time axis – a monotone distortion \(\tau(t)=t+w\,\sin(\pi t+\phi)\) whose strength \(w\) is drawn up to
warp(monotone as long as \(w<1/\pi\)) – shifted in time by up toshiftand corrupted by Gaussian noise. Because the warps move the peaks and edges to different time indices, the Euclidean distance between two series of the same class can exceed the distance between classes, whereas dynamic time warping re-aligns them.- Parameters:
- n_series_per_class
int, default=20 - length
int, default=60 - warp
float, default=0.25 Maximal warp amplitude (fraction of the unit time axis), below \(1/\pi\) so that every warp is monotone.
- noise
float, default=0.1 Standard deviation of the additive noise.
- shift
float, default=0.1 Maximal time shift (fraction of the unit time axis).
- random_state
int,RandomStateinstanceorNone
- n_series_per_class
- Returns:
Examples
>>> from fuzzyclust.relational import make_warped_series >>> X, y = make_warped_series(n_series_per_class=5, length=40, random_state=0) >>> X.shape, sorted(set(y.tolist())) ((15, 40), [0, 1, 2])
Examples using fuzzyclust.relational.make_warped_series#
Fuzzy c-medoids on dynamic-time-warping dissimilarities of time series