Hi Javier! Yo can have a look at: https://github.com/mcasl/PipeGraph/blob/master/pipegraph/adapters.py
There are a few adapters there and I had tool deal with that situation. I solved it by using __getattr__ and __setattr__. Best Manolo El vie., 13 abr. 2018 17:53, Javier López <jlo...@ende.cc> escribió: > I have a class `FancyEstimator(BaseEstimator, MetaEstimatorMixin): ...` > that wraps > around an arbitrary sklearn estimator to add some functionality I am > interested about. > This class contains an attribute `self.estimator` that contains the > wrapped estimator. > Delegation of the main methods, such as `fit`, `transform` works just > fine, but I am > having some issues with `get_params` and `set_params`. > > The main idea is, I would like to use my wrapped class as a drop-in > replacement for > the original estimator, but this raises some issues with some functions > that try using the `get_params` and `set_params` straight in my class, as > the original > parameters now have prefixed names (for instance `estimator__verbose` > instead of `verbose`) > I would like to delegate calls of set_params and get_params in a smart way > so that if a > parameter is unknown for my wrapper class, then it automatically goes > looking for it in > the wrapped estimator. > > I am not concerned about my class parameter names as there are only a > couple of very > specific names on it, so it is safe to assume that any unknown parameter > name should > refer to the base estimator. Is there an easy way of doing that? > > Cheers, > J > _______________________________________________ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn >
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn