Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use boruta_py with BaggingClassifier? #75

Closed
BlackArbsCEO opened this issue Mar 31, 2020 · 5 comments
Closed

How to use boruta_py with BaggingClassifier? #75

BlackArbsCEO opened this issue Mar 31, 2020 · 5 comments

Comments

@BlackArbsCEO
Copy link

Does it work with ensembles besides randomforest?

@a-berg
Copy link

a-berg commented May 4, 2020

This I'd like to know too. From the README:

A supervised learning estimator, with a 'fit' method that returns the feature_importances_ attribute. Important features must correspond to high absolute values in the feature_importances_.

However, I tried using RReliefF and it gives an error, saying that the method needs a "max_depth" variable (therefore can only work with random forests).

    371     def _get_tree_num(self, n_feat):
--> 372         depth = self.estimator.get_params()['max_depth']
    373         if depth == None:
    374             depth = 10

I'd urge the author to fix the README as to not mislead people into believing this works with any other algorithm that is not tree-based.

@UTUnex
Copy link

UTUnex commented May 27, 2020

Hi, I also met the problem that a-berg mentioned. It seems that the model must explicitly have the parameter 'max_depth' to make it usable in BorutaPy. I'm working with the model 'AdaBoostClassifier' and 'RUSBoostClassifier', both of which do not explicitly have the 'max_depth' in their parameter lists and when either of them is put in BorutaPy, there just appears the KeyError: 'max_depth'. I wonder whether this problem can be solved.

@danielhomola
Copy link
Collaborator

This is the only place we rely on the max_depth param of the estimator
https://github.com/scikit-learn-contrib/boruta_py/blob/master/boruta/boruta_py.py#L398

It'd be trivial to add a try/except statement here, and make sure to inform the user if the estimator does not have a max_depth property and as a consequence we cannot automatically estimate the number of trees to use.. Any one of you'd like to submit a PR for this?

Thanks

@UTUnex
Copy link

UTUnex commented May 28, 2020

@danielhomola ,hi, thank you for your reply. So will you consider making some modification to the code to support those estimators like Adaboost which itself doesn't explicitly have the max_depth parameter but its base_estimator like DecisionTree does have this parameter. So I wonder whether it's possible for you to make the BorutaPy able to extract such implict max_depth in the future.

Besides, I also tried to put the XGBoostClassifier and LightGBMClassifier in BorutaPy and again the error occurred, it's about the RandomState problem : 'TypeError: Unknown type of parameter:random_state, got:RandomState'. I dont know how to solve this, could you please help?
Do you have the plan to improve the compatibility of BorutaPy with other popular tree-based models besides RandomForest?

@danielhomola
Copy link
Collaborator

?? no.. that's why I asked you to submit a PR.. if you do so, I'll review it and merge it happily but I don't have time to actively do dev on this repo any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants