tslearn.generators.random_walks

tslearn.generators.random_walks(n_ts=100, sz=256, d=1, mu=0.0, std=1.0, random_state=None)[source]

Random walk time series generator.

Generate n_ts time series of size sz and dimensionality d. Generated time series follow the model:

\[ts[t] = ts[t - 1] + a\]

where \(a\) is drawn from a normal distribution of mean mu and standard deviation std.

Parameters:
n_ts : int (default: 100)

Number of time series.

sz : int (default: 256)

Length of time series (number of time instants).

d : int (default: 1)

Dimensionality of time series.

mu : float (default: 0.)

Mean of the normal distribution from which random walk steps are drawn.

std : float (default: 1.)

Standard deviation of the normal distribution from which random walk steps are drawn.

random_state : integer or numpy.RandomState or None (default: None)

Generator used to draw the time series. If an integer is given, it fixes the seed. Defaults to the global numpy random number generator.

Returns:
numpy.ndarray

A dataset of random walk time series

Examples

>>> random_walks(n_ts=100, sz=256, d=5, mu=0., std=1.).shape
(100, 256, 5)