-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
moved class_prior in NB to __init__ #1499
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
Conversation
Thanks for working on this. You also need to adjust the doctest (look at the failed travis tests). I'd like to get feedback from the other devs on whether the parameter should be called |
@amueller Thanks for your comments! The deprecation warnings should be there for sure. I'm not sure if this is the correct way of doing it. Please comment! Thanks. |
if class_prior is not None: | ||
warnings.warn('class_prior is deprecated in fit function. Use it' | ||
' in __init__ instead.') | ||
self.class_prior = class_prior |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not overwrite parameters to __init__
(which would mean that one call to fit
would influence the next call).
So instead of self.class_prior = class_prior
do
else:
class_prior = self.class_prior
and then use the local variable class_prior
in the following - unless it is used also in other placed than fit. Please check that. If it is also used in predict
, then you need to store it in self.class_prior_
.
Please also add the version in which it will be removed to the deprecation warning, which should be 0.15 I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will do!
Ok, I updated what I could. I am not sure what you meant by the |
Never mind, I think in principal it should be ok now. There is a failing test, though, so I guess there is some minor bug somewhere. |
The test seem to work. I believe it's ready to be merged. |
Why did you need to change the test? It should still work with the deprecated |
You are right, I forgot to use the local variable. The test should now pass. |
So @larsmans said it would be a good thing to directly rename the new parameter to |
Sure thing! Do you think it's OK this way? |
Looks good. Are the |
There is one test in That test also throws the warning. |
yes, it should be covered. I'll do the merging in a bit. Olivier Grisel notifications@github.com schrieb:
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet. |
Merged, thanks :) |
@ogrisel The |
Ok then. Thanks for checking. |
err, it should become a dict is what I meant. will try to do that asap (before release). |
Changes Unknown when pulling 1844820 on mrshu:class_prior into * on scikit-learn:master*. |
This pull request is trying to fix issue #1486.
Please let me know if this is the way you expected it to be.