I am trying to fit decision tree and random forest classsifers in julia. Wanted to know what is the python equivalent of classifier.feature_importance_ in Julia.
Welcome to the forums! It might be worth checking out this post to improve your chance of getting a useful answer.
In this case, I think you’ll need to provide a lot more context for your question. What problem are you trying to solve? What package in Julia are you using? Do you have some code you can share?
You don’t mention what package the function you’re interested in comes from in python for example, nor what it does. There may not be (I would say probably isn’t) an exact replicate, but if you describe what you’re trying to do you may be pointed to analogues that accomplish the same thing or something similar.
I am using DecisionTree.jl classifier in Julia to fit decision trees. I have searched the related docs but could not find a mention of extracting features importance any where in the docs. I know I can print trees but looking for a simple way to get the feature importance. In python this is possible after the classifier is fit using classifier.feature_importance_ command. I hope this info is enough but willing to share the code.
Maybe not directly answering your question, but check out KoalaTrees.jl, part of the Koala.jl suite of packages. The example in the docs includes feature importance output.
Koala does not seem to be updated for Julia 1.0. I have trouble installing it.
Yep sorry should have added that - I dev’ed my own version and with a few changes was able to get it up and running on 0.7/1.0, although it does require some additional effort!
Make a PR?
Assume this was in response to me? I’m toying with the idea although my patches currently are very rough and read (e.g. I haven’t managed to get the
show methods to work properly and display the type information that they displayed in 0.6 according to the docs), hence not sure whether my PR wouldn’t create additional effort rather than making life easier for the package author!
I suspect, if it creates additional effort, that additional effort woul be trivial, while if it helps it will help a lot. It doesn’t take much to look at a PR and assess it, and worst case the author says “no thanks, I got this,” in which case neither of you lost much.