DOC add missing attributes in GradientBoostingRegressor#17671
DOC add missing attributes in GradientBoostingRegressor#17671glemaitre merged 3 commits intoscikit-learn:masterfrom
Conversation
glemaitre
left a comment
There was a problem hiding this comment.
You need to merge master into your branch because of the conflict.
sklearn/ensemble/_gb.py
Outdated
| ``n_iter_no_change`` is specified). Otherwise it is set to | ||
| ``n_estimators``. | ||
|
|
||
| .. versionadded:: 0.20 |
There was a problem hiding this comment.
You can remove the version added
| estimators_ : ndarray of DecisionTreeRegressor of shape (n_estimators, 1) | ||
| The collection of fitted sub-estimators. | ||
|
|
||
| n_classes_ : int |
There was a problem hiding this comment.
Uhm it does not make any sense to have this attribute indeed.
I believed that we did deprecate this in the tree at some point.
There was a problem hiding this comment.
So yes we still have this apparently. So let's keep it because we need to deprecate it in another PR.
There was a problem hiding this comment.
I agree, it doesn't make sense. But it is used from the underlying BaseGradientBoosting and used as a flag regression/classification to make different choices of some parameters, for instance max_features. Wha would you suggest?
There was a problem hiding this comment.
I would suggest adding it as you did.
Then, we should open a new PR to solve it (I open an issue associated with it #17673). The idea will be to deprecate the attribute (and we have to add this in the docstring). We have several ways to detect that we are in regression:
- use private attribute
self._n_classesinstead of public one and exposeself.n_classes_only in the classifier. - use
is_regressorto check if we should create this variable; - or maybe something even better than we have to check.
|
Thanks @simonamaggio |
Fixes part of #14312 for GradientBoostingRegressor estimator.
Added
n_classes_andn_estimators_to docstring inGradientBoostingRegressor.GradientBoostingRegressorremoved from the list of estimators intest_docstring_parameters.py.