make_cylinder_bell_funnel#

pyts.datasets.make_cylinder_bell_funnel(n_samples: int = 30, weights: list[float] | ArrayLike | None = None, shuffle: bool = True, random_state: int | RandomState | None = None, return_params: bool = False) → tuple[NDArray[float64], NDArray[int64]] | tuple[NDArray[float64], NDArray[int64], dict[str, NDArray[float64]]][source]#

Make a Cylinder-Bell-Funnel dataset.

The classes are coded with the following meaning:

  • 0: Cylinder

  • 1: Bell

  • 2: Funnel

Parameters:
n_samplesint (default = 30)

The number of time series.

weightslist of floats or None (default=None)

The proportions of samples assigned to each class. If None, then classes are balanced. Note that if len(weights) == 2, then the last class weight is automatically inferred. More than n_samples samples may be returned if the sum of weights exceeds 1.

shufflebool (default = True)

If True, shuffle the samples.

return_paramsbool (default = False)

If True, a dictionary containing the parameters used to make the time series is returned.

random_stateint, RandomState instance or None (default = None)

Determines random number generation for dataset creation. Pass an int for reproducible output across multiple function calls.

Returns:
Xarray, shape = (n_samples, 128)

Generated time series.

yarray, shape = (n_samples,)

Generated class labels. Labels have the following meaning:

  • 0: Cylinder

  • 1: Bell

  • 2: Funnel

paramsdict

The parameters used to generate the data. The keys are ‘a’, ‘b’, ‘eta’ and ‘epsilon’ and the values are the corresponding values. Only returned if return_params=True.

Notes

The time series are generated from the following distributions:

\[ \begin{align}\begin{aligned}c(t) = (6 + \eta) \cdot 1_{[a, b]}(t) + \epsilon(t)\\b(t) = (6 + \eta) \cdot 1_{[a, b]}(t) \cdot (t - a) / (b - a) + \epsilon(t)\\f(t) = (6 + \eta) \cdot 1_{[a, b]}(t) \cdot (b - t) / (b - a) + \epsilon(t)\end{aligned}\end{align} \]

where \(t=1,\ldots,128\), \(a\) is an integer-valued uniform random variable on the inverval \([16, 32]\), \(b-a\) is an integer-valued uniform distribution on the inveral \([32, 96]\), \(\eta\) and \(\epsilon(t)\) are standard normal variables, \({1}_{[a, b]}\) is the characteristic function on the interval \([a, b]\). \(c\), \(b\), and \(f\) stand for “cylinder”, “bell”, and “funnel” respectively.

References

[1]

N. Saito, “Local feature extraction and its application using a library of bases”. Ph.D. thesis, Department of Mathematics, Yale University, 1994.

Examples

>>> import numpy as np
>>> from pyts.datasets import make_cylinder_bell_funnel
>>> X, y = make_cylinder_bell_funnel()
>>> X.shape
(30, 128)
>>> print(np.bincount(y))
[10 10 10]

Examples using pyts.datasets.make_cylinder_bell_funnel#

Time Series Clustering with DTW and BOSS

Time Series Clustering with DTW and BOSS

Making a Cylinder-Bell-Funnel dataset

Making a Cylinder-Bell-Funnel dataset

Trend-Seasonal decomposition with Singular Spectrum Analysis

Trend-Seasonal decomposition with Singular Spectrum Analysis