ROCKET#

class pyts.transformation.ROCKET(n_kernels: int = 10000, kernel_sizes: ArrayLike = (7, 9, 11), random_state: int | RandomState | None = None)[source]#

RandOm Convolutional KErnel Transformation.

This algorithm randomly generates a great variety of convolutional kernels and extracts two features for each convolution: the maximum and the proportion of positive values.

Parameters:
n_kernelsint (default = 10000)

Number of kernels.

kernel_sizesarray-like (default = (7, 9, 11))

The possible sizes of the kernels.

random_stateNone, int or RandomState instance (default = None)

The seed of the pseudo random number generator to use when shuffling the data. If int, random_state is the seed used by the random number generator. If RandomState instance, random_state is the random number generator. If None, the random number generator is the RandomState instance used by np.random.

Attributes:
weights_array, shape = (n_kernels, max(kernel_sizes))

Weights of the kernels. Zero padding values are added.

length_array, shape = (n_kernels,)

Length of each kernel.

bias_array, shape = (n_kernels,)

Bias of each kernel.

dilation_array, shape = (n_kernels,)

Dilation of each kernel.

padding_array, shape = (n_kernels,)

Padding of each kernel.

References

[1]

A. Dempster, F. Petitjean and G. I. Webb, “ROCKET: Exceptionally fast and accurate time series classification using random convolutional kernels”. https://arxiv.org/abs/1910.13051.

Examples

>>> from pyts.transformation import ROCKET
>>> X = np.arange(100).reshape(5, 20)
>>> rocket = ROCKET(n_kernels=10)
>>> rocket.fit_transform(X).shape
(5, 20)

Methods

__init__([n_kernels, kernel_sizes, random_state])

fit(X[, y])

Fit the model according to the given training data.

fit_transform(X[, y])

Fit to data, then transform it.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Transform the provided data.

__init__(n_kernels: int = 10000, kernel_sizes: ArrayLike = (7, 9, 11), random_state: int | RandomState | None = None) → None[source]#
fit(X: ArrayLike, y: ArrayLike | None = None) → Self[source]#

Fit the model according to the given training data.

Parameters:
Xarray-like, shape = (n_samples, n_timestamps)

Training vector.

yNone or array-like, shape = (n_samples,)

Class labels for each data sample. Ignored.

Returns:
selfobject
transform(X: ArrayLike) → NDArray[float64][source]#

Transform the provided data.

Parameters:
Xarray-like, shape = (n_samples, n_timestamps)

Test samples.

Returns:
X_newarray, shape = (n_samples, 2 * n_kernels)

Extracted features from the kernels.

Examples using pyts.transformation.ROCKET#

RandOm Convolutional KErnel Transform (ROCKET)

RandOm Convolutional KErnel Transform (ROCKET)