scikit-learn-contrib/DESlib

'RandomForestClassifier' object has no attribute 'estimators_'

jayahm opened this issue · 3 comments

Hi,

I followed your example on RF and DS
https://deslib.readthedocs.io/en/latest/auto_examples/plot_random_forest.html

However, I got this error on stacked classfier.

~\anaconda3\lib\site-packages\deslib\static\stacked.py in fit(self, X, y)
     69         X, y = check_X_y(X, y)
     70 
---> 71         super(StackedClassifier, self).fit(X, y)
     72         base_preds = self._predict_proba_base(X)
     73         X_meta = self._connect_input(X, base_preds)

~\anaconda3\lib\site-packages\deslib\static\base.py in fit(self, X, y)
     80             self.pool_classifiers_ = self.pool_classifiers
     81 
---> 82         self.n_classifiers_ = len(self.pool_classifiers_)
     83 
     84         # dealing with label encoder

~\anaconda3\lib\site-packages\sklearn\ensemble\_base.py in __len__(self)
    159     def __len__(self):
    160         """Return the number of estimators in the ensemble."""
--> 161         return len(self.estimators_)
    162 
    163     def __getitem__(self, index):

AttributeError: 'RandomForestClassifier' object has no attribute 'estimators_'

Hello,

Can you give me the versions of each library you are using (Scikit-learn and DESlib)? I have no problems in running this example in my environment, so it could be some problems with different versions.

What I meant was I followed the code and run on my dataset, including stacked classifier as well.

The deslib version is 0.4.dev.
The scikit-learn version is 0.22.1.

Hello,

I just run this same example with scikit-learn=0.22.1 and deslib=0.4dev and had no problems with it. Moreover, our CI also test the examples and found no problems with it.

I'm guessing the problem is on the code part you changed. So without having access to your code I cannot do anything.