I looked into some examples I found online but I’m a bit confused.

Supposed I want to implement my own transformer, something similar to the 
standard scaler. Would this be sufficient to be used in a pipeline, or should 
it be done differently?


class ModelTransformer(TransformerMixin):

    def __init__(self, model):
        self.my_param = None

    def fit(self, *args, **kwargs):
        # do some stuff
        self.my_param = something
        return self

    def transform(self, X, **transform_params):
        # do something with self.myparam and X.copy()
        return X.copy()

    def set_params(**params):
        return self

    def get_params(deep=True):
        return None

Thank you,

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to