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_tsint (default: 100)
Number of time series.
- szint (default: 256)
Length of time series (number of time instants).
- dint (default: 1)
Dimensionality of time series.
- mufloat (default: 0.)
Mean of the normal distribution from which random walk steps are drawn.
- stdfloat (default: 1.)
Standard deviation of the normal distribution from which random walk steps are drawn.
- random_stateinteger 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)
Examples using tslearn.generators.random_walks
¶
Longest Commom Subsequence with a custom distance metric
DTW computation with a custom distance metric