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

[ENH] increase stateless scope of FunctionTransformer and TabularToSeriesAdaptor #3087

Merged
merged 3 commits into from
Aug 4, 2022

Conversation

fkiraly
Copy link
Collaborator

@fkiraly fkiraly commented Jul 24, 2022

This PR makes a number of improvements around FunctionTransformer and TabularToSeriesAdaptor, resulting in increased scope of the case where fit is being skipped ("stateless" in sklearn terminology):

  • FunctionTransformer has checks from fit moved into transform, in order to ensure an empty fit and allow vectorization with different number of instances in fit and transform for panel data
  • TabularToSeriesAdaptor now checks if the transformer passed has sklearn tags, and if stateless, skips fit and sets the tag accordingly
  • makes TabularToSeriesAdaptor more robust to transform returns that are not 2D np.ndarray by coercion

@fkiraly fkiraly added module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing enhancement Adding new functionality labels Jul 24, 2022
@fkiraly fkiraly requested a review from aiwalter as a code owner July 24, 2022 23:14
@fkiraly fkiraly merged commit 5bbd996 into main Aug 4, 2022
@fkiraly fkiraly deleted the functrafo-updates branch August 4, 2022 15:22
fkiraly added a commit that referenced this pull request Aug 23, 2022
Addresses #2179

This PR deprecates the row transformers, i.e., `SeriesToSeriesRowTransformers` and `SeriesToPanelRowTransformers`.

The original reason to have these was to allow application of series transformers to panel data. This is functionality which is now integrated into the base class, i.e., `fit` and `transform` automatically vectorize (see #2219).

For the deprecation period, `make_row_transformer` will return the transformer passed to it (since it already has the functionality it was meant to attach), and the row transformers will simply patch through all transformer methods.

Relies on #3087 to ensure panel compatibility of `sklearn` `FunctionTransformer`, by closing the gap between "stateless" scopes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality module:transformations transformations module: time series transformation, feature extraction, pre-/post-processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant