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

Learning Shapelets #157

Open
Koenig128 opened this issue Nov 30, 2023 · 1 comment
Open

Learning Shapelets #157

Koenig128 opened this issue Nov 30, 2023 · 1 comment

Comments

@Koenig128
Copy link

Hi,

thank you very much for this great library! I have a general question and would appreciate your support:
I have a single univariate time series and I am trying to use the classification algorithm for learning shaplets.

import pandas as pd
import numpy as np
from pyts.classification import LearningShapelets

np.random.seed(42)
random_data = np.random.randn(100)
df = pd.DataFrame({'column': random_data})

X = [df[col].tolist() for col in df.columns]
clf = LearningShapelets(random_state=42)
y = [1]

clf.fit(X, y)

Now, using the following code I can get the shapelets:

clf.shapelets_

Is there also a way to find where those shapelets were identified in the original time series? Ideally, I would like to map the shapelets back onto the original time series.

Thank you very much in advance for your support!

@johannfaouzi
Copy link
Owner

Hi,

One cannot perform classification with a single sample. One needs at least one sample from each class, and at least two classes, to perform classification.

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

3 participants
@johannfaouzi @Koenig128 and others