Open mloning opened 3 years ago
@mloning ad the result of DummyRegressor output - the default strategy of DummyRegressor is mean (but mean of whole training dataset)
Parts from the DummyRegressor docstrings
Parameters
----------
strategy : str
Strategy to use to generate predictions.
* "mean": always predicts the mean of the training set
Examples
--------
>>> import numpy as np
>>> from sklearn.dummy import DummyRegressor
>>> X = np.array([1.0, 2.0, 3.0, 4.0])
>>> y = np.array([2.0, 3.0, 5.0, 10.0])
>>> dummy_regr = DummyRegressor(strategy="mean")
>>> dummy_regr.fit(X, y)
DummyRegressor()
>>> dummy_regr.predict(X)
array([5., 5., 5., 5.])
@therhaag any thoughts on the class versus object mentioned by Markus?
Hi @mloning - sorry for the delayed response. The reason for passing the class rather than using composition is to avoid the need for a custom get_params/set_params implementation which distinguishes between parameters of the wrapper and parameters of the class being wrapped. The sklearn implementation of these functions in base.py relies on discovering all possible parameters of the estimator from the signature of the constructor, so we need to expose those through the constructor of the wrapper. There may be a simpler way to do this, though, more close to how composite models behave - in fact, I remember looking into this option but I can't remember what was the difficulty with that, so I'd be happy to consider alternatives.
@therhaag but sklearn supports composition with nested parameters using their double underscore convention, I think that would be the cleaner solution in the end.
Hi @mloning - I think you're right. We added the sklearn wrapper after the other wrappers which are designed for models which don't follow the sklearn convention themselves, applying the same mechanism. For the sklearn models, one could indeed use composition.
Hi, following our conversion yesterday, I have two questions about the
get_sklearn_wrapper
:1. API: Why do you dynamically create the init and pass the class rather than simply using composition and passing the object?
2. Algorithm: Why not use standard recursive strategy?
Hope this helps!