-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
DEP PassiveAggressiveClassifier and PassiveAggressiveRegressor #29097
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
base: main
Are you sure you want to change the base?
DEP PassiveAggressiveClassifier and PassiveAggressiveRegressor #29097
Conversation
I'm +1 on this:
|
I think that we should do a bit more and specify how you get a similar behaviour by setting the right parameters. |
In fa3d842, I added |
Nice. We need to add more information on the docstring about C though. It's very short and not clear what it does when I read it. Otherwise LGTM. |
@lorentzenchr getting close to the release, would you mind resolving issues here? |
I can resolve merge conflicts, but I won't do
|
SGDRegressor( | ||
penalty=None, | ||
alpha=1.0, | ||
C=1.0 |
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.
I must be missing something, our SGDRegressor
doesn't have a C
param.
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.
BaseSGDClassifier
has an attibute C
. This PR exposes this attribute to SGDClassifier
(same for regressors).
I don't really like that. Proposition: I revert the exposition of C
and write in the deprecation note, using somewhat private API:
clf = SGDClassifier(
penalty=None,
alpha=1.0,
eta0=1.0,
learning_rate="pa1",
loss="hinge",
)
clf.C = 1.0 # THIS IS USING PRIVATE API
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.
See c24c95f. I can revert if you dislike it.
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.
If we're deprecating these estimators and telling users to use SGDRegressor
and SGDClassifier
instead, it makes sense to actually have a public way of doing that. So I'm in favor of exposing C
in both SGD
estimators, document them, and then here simply create and equivalent estimator using them.
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.
How about leaving them private for the time being?
I would like to have a dedicated discussion whether to
- expose
C
in SGD; xor - remove
C
and all passive aggressive things altogether
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.
I think this PR is the right place to have that discussion. I'd like others to weigh in about this point.
maybe @ogrisel @amueller @GaelVaroquaux @adam2392 would have an opinion?
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.
I'm not super familiar with passive aggressive vs SGD but a loose read suggests passive aggressive allows more online updating. Though i thought SGD easily allows online training too, so why would someone use one over the other?
Is it true that the only parameter that makes these different is "C" step size parameter?
Pragmatically: if no one uses "C", then i kinda agree might be simplest to just remove it? If there's something I'm missing tho, lmk.
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.
PassiveAggressiveClassifier
was first implemented in #1259 in 2012. I have never seen it used anywhere and I think our SGD...
offer enough for online learning (partial_fit
). So I would be fine with removing it completely, i.e. also removing C
in SGD. Unless someone steps in for keeping it.
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.
Having read through the code and partially papers, I could also live with making learning_rate="pa1"
and "pa2"
as well as C
public in SGD...
. In that case I would rename C
to something like pa_C
.
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.
I am partially in favor of just simplification and deprecating those parameters / the PAClf altogether, unless someone has an actual use case for them.
The decorator params = signature(Estimator).parameters I need help how to avoid that (I won't fix |
7b21cfb
to
c367698
Compare
Reference Issues/PRs
#29088 (comment)
What does this implement/fix? Explain your changes.
This PR deprecates the 2 classes
PassiveAggressiveClassifier
andPassiveAggressiveRegressor
. A user can easily useSGDClassifier
andSGDRegressor
instead and I cannot figure out the added value of these 2 classes.@scikit-learn/core-devs ping for decision (in particular in case you are against the deprecation)