Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JointRecurrencePlot return zero #134

Open
ramdhan1989 opened this issue Sep 4, 2022 · 1 comment
Open

JointRecurrencePlot return zero #134

ramdhan1989 opened this issue Sep 4, 2022 · 1 comment

Comments

@ramdhan1989
Copy link

Hi, I have 5 features and 100 timesteps. JoinRecurrentPlot return all values equal to zeroes. is there anything wrong in my data?

@johannfaouzi
Copy link
Owner

Hi,

A joint recurrence plot is the Hadamard (element-wise) product of all the individual recurrence plots (one for each feature). Thus, for each "pixel", a zero for at least one feature will result in a zero in the joint recurrence plot. To tackle this, you can decrease the number of zeros in any recurrence plot by increasing the threshold used to binarize the distance between the trajectories.

Here is an example on a toy dataset:

import matplotlib.pyplot as plt
from pyts.datasets import load_basic_motions
from pyts.multivariate.image import JointRecurrencePlot

X, _, _, _ = load_basic_motions(return_X_y=True)

With a small number of ones in each recurrence plot, there are almost only zeros in the joint recurrence plot:

jrp_1 = JointRecurrencePlot(threshold='point', percentage=5)
X_jrp_1 = jrp_1.transform(X)
plt.imshow(X_jrp_1[0], cmap='binary', origin='lower')

Capture d’écran 2022-09-04 à 14 36 51

You can increase the number of ones in each recurrence plot, which results in many more ones in the joint recurrence plot:

jrp_2 = JointRecurrencePlot(threshold='point', percentage=50)
X_jrp_2 = jrp_2.transform(X)
plt.imshow(X_jrp_2[0], cmap='binary', origin='lower')

Capture d’écran 2022-09-04 à 14 36 59

You can also specify different thresholds for different features:

jrp_3 = JointRecurrencePlot(threshold='point', percentage=[50, 10, 70, 60, 50, 40])
X_jrp_3 = jrp_3.transform(X)
plt.imshow(X_jrp_3[0], cmap='binary', origin='lower')

Capture d’écran 2022-09-04 à 14 37 07

Hope this helps you a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants