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 to shift and 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_classint, default=20
lengthint, default=60
warpfloat, default=0.25

Maximal warp amplitude (fraction of the unit time axis), below \(1/\pi\) so that every warp is monotone.

noisefloat, default=0.1

Standard deviation of the additive noise.

shiftfloat, default=0.1

Maximal time shift (fraction of the unit time axis).

random_stateint, RandomState instance or None
Returns:
Xndarray of shape (3 * n_series_per_class, length)
yndarray of shape (3 * n_series_per_class,)

Class of every series (0: bell, 1: step, 2: double bump).

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

Fuzzy c-medoids on dynamic-time-warping dissimilarities of time series