boruta_py icon indicating copy to clipboard operation
boruta_py copied to clipboard

HistGradientBoostingClassifier not working

Open ciberger opened this issue 4 years ago • 2 comments

Hi 👋

in the documentation says boruta implements all scikit-learn ensemble methods, but it doesn't work with HistGradientBoostingClassifier. Other methods described on the ensemble documentation (such as adaboost and gradient tree boosting) work as expected.

Thanks

Reprex

from boruta import BorutaPy

from sklearn.experimental import enable_hist_gradient_boosting
from sklearn.ensemble import HistGradientBoostingClassifier

clf = HistGradientBoostingClassifier()

boruta = BorutaPy(
   estimator=clf, 
   n_estimators='auto',
   max_iter=10)

boruta.fit(np.array(X_train), np.array(y_train))

Error message

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
 in 
---> 18 boruta.fit(np.array(X_train), np.array(y_train))

~/.pyenv/versions/python-3.7.4/lib/python3.7/site-packages/boruta/boruta_py.py in fit(self, X, y)
    199         """
    200 
--> 201         return self._fit(X, y)
    202 
    203     def transform(self, X, weak=False):

~/.pyenv/versions/python-3.7.4/lib/python3.7/site-packages/boruta/boruta_py.py in _fit(self, X, y)
    268         # set n_estimators
    269         if self.n_estimators != 'auto':
--> 270             self.estimator.set_params(n_estimators=self.n_estimators)
    271 
    272         # main feature selection loop

~/.pyenv/versions/python-3.7.4/lib/python3.7/site-packages/sklearn/base.py in set_params(self, **params)
    250                                  'Check the list of available parameters '
    251                                  'with `estimator.get_params().keys()`.' %
--> 252                                  (key, self))
    253 
    254             if delim:

ValueError: Invalid parameter n_estimators for estimator HistGradientBoostingClassifier(). Check the list of available parameters with `estimator.get_params().keys()`.

ciberger avatar Jul 21 '20 18:07 ciberger

Also 'HistGradientBoostingClassifier' object has no attribute 'tree_'

WhiteLedAnn avatar Jun 08 '23 08:06 WhiteLedAnn

Also they say : "we use max_iter instead n_estimators" but i dont get how can I receive my list of trees by int number of iterations

WhiteLedAnn avatar Jun 08 '23 09:06 WhiteLedAnn