-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
LinearRegression has decision_function #1404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm the one who added this. The motivation was to be able to use regressors (e.g. |
I think that this is a good motivation. Using squared loss (regression |
Yes and the squared loss is a proper loss function so it is suitable for class probability estimation (but I'm not very familiar with this subject...). |
@mblondel Sorry, I didn't know that was on purpose. |
@amueller I'm fine with removing |
That sounds like a good solution to me, if @GaelVaroquaux is ok with using the class structure to find out if something is a regressor. |
I wanted to avoid it. I don't believe at all in inheritance and class |
We could add attributes |
I like this better than relying on class inheritance. |
@amueller @agramfort Why is it better? I would prefer to implement a helper function similar to |
@mblondel it is "better" in the sense that a user can make an estimator a Regressor without having to inherit from an sklearn class. The argument (which is @GaelVaroquaux's, not mine) is that people should be able to take full advantage of all sklearn features without having a dependency on sklearn. |
@amueller I see. The user still needs to be aware of the _regressor |
I do believe that if someone wants to use a regression model as a classifier, they should do some coding themselves. It's extremely simple:
Currently, linear models are mixing up classification and regression in some places, which is understandable mathematically but quite confusing. I'd rather not support undocumented features in this way. |
Agreed. |
See #2444 for a fix. |
Just make sure that regressors work with OneVsRest and friends. I think I added unit tests for that. |
This method only existed to support an undocumented feature in sklearn.multiclass. Fixes scikit-learn#1404.
Saw it. Do you suggest adapting the test with the class I wrote above? |
You mean that the OneVsRest and friends should rely on the predict function, if there is no |
@larsmans No, I want to call @arjoly Calling predict without checking if the base estimator is a regressor could work but I wonder about undefined behavior with clustering algorithms (most have a predict method). |
I don't want users to have to wrap a regressor in a class. I would expect that multiclass estimators can take regressors directly. This was my original motivation for adding decision_function as an alias to predict. |
BTW the multiclass doc does mention regressors: The docstring for |
I understand the use case, but it's adding a hack to a whole set of estimators to add a feature to a few others. I'd rather have a constructor attribute (say, |
I'd be fine with such a constructor parameter if it is set to "auto" by default and automatically chooses "predict" for regressors (but we don't have a way to know that right know, and @GaelVaroquaux apparently doesn't want to add a We could also call |
Closing in light of #2588. |
As mentioned by @tjanez in #1393.
This doesn't make sense.
We should check if other linear models for regression also have it.
The text was updated successfully, but these errors were encountered: