pyts.multivariate.image
.JointRecurrencePlot¶
-
class
pyts.multivariate.image.
JointRecurrencePlot
(dimension=1, time_delay=1, threshold=None, percentage=10)[source]¶ Joint Recurrence Plot.
A recurrence plot is an image representing the distances between trajectories extracted from the original time series.
A joint recurrence plot is an extension of recurrence plots for multivariate time series: it is the Hadamard of the recurrence plots obtained for each feature of the multivariate time series.
Parameters: - dimension : int or float (default = 1)
Dimension of the trajectory. If float, it represents a percentage of the size of each time series and must be between 0 and 1.
- time_delay : int or float (default = 1)
Time gap between two back-to-back points of the trajectory. If float, it represents a percentage of the size of each time series and must be between 0 and 1.
- threshold : float, ‘point’, ‘distance’ or None or list thereof (default = None)
Threshold for the minimum distance. If None, the recurrence plots are not binarized. If
threshold='point'
, the threshold is computed such aspercentage
percents of the points are smaller than the threshold. Ifthreshold='distance'
, the threshold is computed as thepercentage
of the maximum distance.- percentage : int, float or list thereof (default = 10)
Percentage of black points if
threshold='point'
or percentage of maximum distance for threshold ifthreshold='distance'
. Ignored ifthreshold
is a float or None. Note that the percentage is calculated for each recurrence plot independently, which implies that there will probably be less than percentage percents of black points in the joint recurrence plot.
References
[1] M. Romano, M. Thiel, J. Kurths and W. con Bloh, “Multivariate Recurrence Plots”. Physics Letters A (2004) Examples
>>> from pyts.datasets import load_basic_motions >>> from pyts.multivariate.image import JointRecurrencePlot >>> X, _, _, _ = load_basic_motions(return_X_y=True) >>> transformer = JointRecurrencePlot() >>> X_new = transformer.transform(X) >>> X_new.shape (40, 100, 100)
Methods
__init__
([dimension, time_delay, threshold, …])Initialize self. fit
([X, y])Pass. fit_transform
(X[, y])Fit to data, then transform it. get_params
([deep])Get parameters for this estimator. set_params
(**params)Set the parameters of this estimator. transform
(X)Transform each time series into a joint recurrence plot. -
__init__
(dimension=1, time_delay=1, threshold=None, percentage=10)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
fit_transform
(X, y=None, **fit_params)¶ Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters: - X : array-like, shape = (n_samples, n_features, n_timestamps)
Multivariate time series.
- y : None or array-like, shape = (n_samples,) (default = None)
Target values (None for unsupervised transformations).
- **fit_params : dict
Additional fit parameters.
Returns: - X_new : array
Transformed array.
-
get_params
(deep=True)¶ Get parameters for this estimator.
Parameters: - deep : bool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns: - params : dict
Parameter names mapped to their values.
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.Parameters: - **params : dict
Estimator parameters.
Returns: - self : estimator instance
Estimator instance.
-
transform
(X)[source]¶ Transform each time series into a joint recurrence plot.
Parameters: - X : array-like, shape = (n_samples, n_features, n_timestamps)
Multivariate time series.
Returns: - X_new : array, shape = (n_samples, image_size, image_size)
Joint Recurrence plots.
image_size
is the number of trajectories and is equal ton_timestamps - (dimension - 1) * time_delay
.