You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal to decouple classifier output classes from the y vector with a classes= parameter in __init__ #1183
"I think we could have classes=None constructor parameter in
SGDClassifier an possibly many other classifiers. When provided we
would not use the traditional self.classes_ = np.unique(y) idiom
already implemented in some classifiers of the project (but not all).
+1 also for raising a ValueError exception when classes != None and
if the y provided at fit time has some values not in classes.
However we need to check with some benchmarks that this integrity
check is not too costly.
This constructor parameters could be overriden by a fit_param to
preserve backward compat, especially for classifier models with a partial_fit method.
The expected behavior for a classifier that is passed a non-None classes constructor param would be to never predict a class value.
In case of predict_proba method the missing fit-time class
probabilities should be 0.0.
This protocol (including expected exception types and error messages)
should be formalized as a series of common tests in
sklearn/tests/test_common.py and redundant book keeping code should be
factorized in the sklearn.base.py's ClassifierMixin class IMHO."
partial_fit for all classifiers now accepts classes, and proposals to add classes to all estimators have shown to introduce too much clutter. Leaving #8100 open for these discussions.
Activity
amueller commentedon Oct 7, 2016
I think this is still interesting but it seems to clutter the API a lot.
On the other hand, this keeps coming up in all kinds of places.
amueller commentedon May 22, 2018
see #9532
adrinjalali commentedon Apr 17, 2024
partial_fitfor all classifiers now acceptsclasses, and proposals to add classes to all estimators have shown to introduce too much clutter. Leaving #8100 open for these discussions.