scikit-learn-contrib / boruta_py

Python implementations of the Boruta all-relevant feature selection method.
BSD 3-Clause "New" or "Revised" License
1.46k stars 252 forks source link

Kaggle n_estimators issue with DecisionTreeClassifier #116

Open MarcinKamil84 opened 12 months ago

MarcinKamil84 commented 12 months ago

Here's my code snippet from Kaggle notebook:

rf_cl = RandomForestClassifier()
dt_cl = DecisionTreeClassifier()

estimator = dt_cl

feat_selector = BorutaPy(
    verbose=2,
    estimator=estimator,
    n_estimators='auto',
    max_iter=20
)

feat_selector.fit(np.array(train_set_final), np.array(train_set_labels))

Here's the error:

ValueError: Invalid parameter 'n_estimators' for estimator DecisionTreeClassifier(). Valid parameters are: ['ccp_alpha', 'class_weight', 'criterion', 'max_depth', 'max_features', 'max_leaf_nodes', 'min_impurity_decrease', 'min_samples_leaf', 'min_samples_split', 'min_weight_fraction_leaf', 'random_state', 'splitter'].

With RandomForestClassifier all works fine. What can be the issue?

Nimmerfall commented 11 months ago

The DecisionTreeClassifier doesn't seem to have a parameter for n_estimators. At least i dont see it within the docx -> https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html

MarcinKamil84 commented 11 months ago

Sorry. I have no idea how I missed that. I was sure I checked. Thanks!