feature_engine icon indicating copy to clipboard operation
feature_engine copied to clipboard

add inverse_transform to transformer classes in creation module

Open solegalli opened this issue 5 years ago • 5 comments

The transformers in this module add new variables to the dataset with the different math operations. Inverse_transform should remove these newly created variables and return the original data representation

solegalli avatar Jul 01 '21 18:07 solegalli

@solegalli mathematical_combination.py and combine_with_reference_feature.py create new features in the dataset based in a combination of others. This meaas that "inverse" should remove those new features to obtein the original dataset. Dont think this will create to much value to this class. Any thoughts?

NicoGalli avatar Jul 09 '21 20:07 NicoGalli

@solegalli same with cyclical.py. which is also creating new features in the dataset.

NicoGalli avatar Jul 09 '21 20:07 NicoGalli

All transformers in this module add new variables by combining existing ones. So inverse_transform should just remove/drop these new variables to obtain the original dataframe representation.

I am also not sure how much value this adds to the classes.

On one hand, sklearn has inverse_transform in its classes (wherever possible), so to make Feature-engine more compatible, I thought we could add it to these classes as well. Code-wise, it should be fairly straightforward to implement.

One scenario could be a user wanting to understand which variables came from the raw data, and which ones were included in the engineering pipeline. But not sure how frequent this occurs.

If you want, we can leave this issue open to see if other users have some views one way or the other.

solegalli avatar Jul 10 '21 08:07 solegalli

@TremaMiguel in your view, would inverse_transform add any value in these classes?

solegalli avatar Jul 18 '21 08:07 solegalli

closing as we decided this method adds no value to the class with @NicoGalli

solegalli avatar Nov 16 '21 16:11 solegalli