Support inverse_transform in ColumnTransformer
See original GitHub issueSince ColumnTransformer is primarily used to apply basic preprocessing, it would be extremely helpful if it (and FeatureUnion
while we’re at it) supported inverse_transform
(where each of its constituent estimators does too). This also would replace some functionality we might otherwise support with categorical_features
or ignored_features
etc parameters (H/T @qinhanmin2014).
In order for it to support inverse_transform
, it would need to have an index of which columns in the output came from which transformers, which is what I intended to solve in #1952. This is not hard as long as fit_transform
, rather than fit
, is called, or as long as all the constituent transformers support get_feature_names
. Maybe we could force a run of transform
when fit is called in order to check the output size.
(Alternatively, it might be nice to have a consistent API for a transformer to declare its output size, which n_components_
does for a handful of estimators.)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:26
- Comments:18 (9 by maintainers)
I need to apply a different scaling factor to every column of my dataset. In particular I need to rescale columns dt.dayofyear, dt.month, dt.quarter and dt.hour to sine and cosine for ML. All my transform functions are reversible so I tried (without reading in depth the manual) to apply ColumnTransform + Pipeline but then I realised that the first was not passing the invert_transform functions described into the FunctionTransformers in my Pipelines.
So I coded this bare encoder where I pass a list of encoders matching the columns order in my dataset and it seems working
like this
Is it solved? Reaally need this feature!