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

[BUG] ShapeletTransformPyts().fit(x) throws "ValueError: ShapeletTransformPyts requires y in fit." #6379

Open
navaldroid opened this issue May 2, 2024 · 3 comments
Labels
bug Something isn't working documentation Documentation & tutorials module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing

Comments

@navaldroid
Copy link

Describe the bug

For some reason, ShapeletTransformPyts (and also ShapeletTransform) requires the y parameter in their fit() method, despite the documentations for fit(X, y=None) reports it as optional

import numpy as np
from sktime.transformations.panel.shapelet_transform import ShapeletTransformPyts

x = np.random.random(10000)
model = ShapeletTransformPyts()
fitted = model.fit(x)

>>> ValueError: ShapeletTransformPyts requires `y` in `fit`.

Versions
Python 3.10.10
numpy==1.26.4
pyts==0.13.0
sktime==0.29.0
scikit-base==0.7.7

@navaldroid navaldroid added the bug Something isn't working label May 2, 2024
@fkiraly fkiraly added documentation Documentation & tutorials module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing labels May 3, 2024
@fkiraly
Copy link
Collaborator

fkiraly commented May 3, 2024

This is not a bug, but possibly a documentation improvement point.

ShapeletTransformPyts indeed requires y in fit. This is as in the interfaced transformer, from pyts, see https://pyts.readthedocs.io/en/stable/generated/pyts.transformation.ShapeletTransform.html

The documentation could be clearer - some transformations do require y in fit, some do not. The current docstring says "some transformers require this, see class docstring for details".

Do you have a suggestion how this could be improved? Perhaps pointing to the requires_y tag?

@navaldroid
Copy link
Author

navaldroid commented May 3, 2024 via email

@fkiraly
Copy link
Collaborator

fkiraly commented May 3, 2024

@navaldroid, thanks for your help - although I do not think it is as easy - or unproblematic - to remove the default.

The default needs to be there in fit, because some transformations do not require y.

The docstring also applies to all transformations at once, at the moment - so a change there would make it false for the remaining transformer.s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Documentation & tutorials module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing
Projects
None yet
Development

No branches or pull requests

2 participants