-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Suggestion to Have multiclass.py allow prediction over one sample only ! #5135
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
linearSVC should really complain here :-/ I guess the decision function is called... hum... Not sure we can actually fix it without #4511. |
This is somewhat fixed in #5152. But the current behavior is still non-sensical. I think we should put a stop-gap in master for the next release. |
What stopgap do you have in mind? On the current master we now have:
This looks fine to me, right? |
BTW I fixed the deprecation message in 250507f. |
It seems this got fixed somewhere between 0.16.1 and now. I don't know where, though, it is a bit odd. But let's close it. I'm surprised by the number of deprecation warnings. I would have expected two, not six. |
Greetings Guys,
I came through the contributed implementation to multiclass.py in Scikit-learn. I just have a suggestion for you to consider the case when only one testing sample is passed to decision_function "Decision function for the OneVsOneClassifier". As for the current implementation, an undesirable output comes since n_samples = X.shape[0] will take a number larger than one when X is only a single list vector with some values. I may suggest you check the shape of X before parsing it in a particular way, or update the documentation to advise the user on a suggested way to get the prediction for one testing sample.
In a sense, it is true to say that usually, there is a testing set of many samples but in a specific case of mine, it was preferable to predict sample by sample. I overcome this by using X[0:1,:] instead of X[0,:] where X is a testing set of several samples.
The sklearn version I have installed is 0.16.1
I did not get an error when inputing 1d X and what I receive back are predictions as many as the length of this 1d list.
For example:
And by replacing X[1,:] to be X[1:2,:] which in terms of values are the same:
Regards,
Othman
The text was updated successfully, but these errors were encountered: