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] transformers that are univariate-to-multivariate break when calling inverse_transform #6337

Open
fkiraly opened this issue Apr 26, 2024 · 0 comments
Labels
bug Something isn't working module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing
Projects

Comments

@fkiraly
Copy link
Collaborator

fkiraly commented Apr 26, 2024

Reported by @guimalo on discord, reproducing code:

from sktime.transformations.series.detrend import STLTransformer
from sktime.datasets import load_airline

X = load_airline()
t = STLTransformer(return_components=True)
Xt = t.fit_transform(X)
t.inverse_transform(Xt)

This should simply give back a series similar to X.

The breakage occurs as X has the univariate-only tag set, which will trigger inverse_transform to always vectorize over columns.
The solution should be that t vectorizes only over rows in this case.

That would solve the case above, but not a similar case where t had broadcast to a multivariate X in fit_transform.

@fkiraly fkiraly added bug Something isn't working module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing labels Apr 26, 2024
@fkiraly fkiraly added this to Needs triage & validation in Bugfixing via automation Apr 26, 2024
fkiraly added a commit that referenced this issue Apr 26, 2024
This PR fixes `STLTransformer.inverse_transform` for the univariate
case.
An attribute was accessed that did not exist.

Related to #6337 but not
identical, unreported.

It needs to be investigated why suite tests did not catch this, for now
I have added a manual test.

Makes minor improvements to files touched:

* fixes minor typo
* moves fixture generation inside test functions to avoid data
generation on module load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing
Projects
Bugfixing
Needs triage & validation
Development

No branches or pull requests

1 participant