Source code for mlinsights.mlmodel.sklearn_transform_inv

"""
Implements a base class which defines a pair of transforms
applied around a predictor to modify the target as well.


:githublink:`%|py|6`
"""
from sklearn.base import TransformerMixin, BaseEstimator


[docs]class BaseReciprocalTransformer(BaseEstimator, TransformerMixin): """ Base for transform which transforms the features and the targets at the same time. It must also return another transform which transforms the target back to what it was. :githublink:`%|py|15` """
[docs] def __init__(self): BaseEstimator.__init__(self) TransformerMixin.__init__(self)
[docs] def get_fct_inv(self): """ Returns a trained transform which reverse the target after a predictor. :githublink:`%|py|25` """ raise NotImplementedError( "This must be overwritten.") # pragma: no cover
[docs] def transform(self, X, y): """ Transforms *X* and *y*. Returns transformed *X* and *y*. :githublink:`%|py|33` """ raise NotImplementedError( "This must be overwritten.") # pragma: no cover