# Boruta algorithm

**URL:** https://discourse.julialang.org/t/boruta-algorithm/76821
**Category:** Machine Learning
**Created:** [February 20, 2022, 9:01pm UTC](https://discourse.julialang.org/t/boruta-algorithm/76821 "2022-02-20T21:01:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jaidy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaidy/32/20310_2.png) [@Jaidy](https://discourse.julialang.org/u/Jaidy)
#### Post date: [February 20, 2022, 9:01pm UTC](https://discourse.julialang.org/t/boruta-algorithm/76821/1 "2022-02-20T21:01:46Z")

</div>

Hi everyone,  
I am looking to use Boruta algorithm to select features for my project. First I looked up for a Julia implementation of Baruta algorithm, but could not find any. Then I found Python implementation and tried using it via PyCall, but I can not figure it out. The following is the code from a website,

from sklearn.ensemble import RandomForestRegressor  
from boruta import BorutaPy

model = RandomForestRegressor(n\_estimators=100, max\_depth=5, random\_state=42)

feat\_selector = BorutaPy(  
verbose=2,  
estimator=model,  
n\_estimators=‘auto’,  
max\_iter=10, # numero di iterazioni da fare  
random\_state=42,  
)

feat\_selector.fit(np.array(X), np.array(y))  
…

I could import random forests, albeit from DecisionTree. Can someone please help me in converting the above code to Julia using PyCall, (or better if there is a Julia implementation of Boruta algorithm itself, that will be best).

---

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [February 20, 2022, 9:30pm UTC](https://discourse.julialang.org/t/boruta-algorithm/76821/2 "2022-02-20T21:30:23Z")

</div>

Just sharing an alternative algorithm that is super popular in ML nowadays in case you haven’t heard:

> **[GitHub - nredell/ShapML.jl: A Julia package for interpretable machine...](https://github.com/nredell/ShapML.jl)**
>
> A Julia package for interpretable machine learning with stochastic Shapley values - GitHub - nredell/ShapML.jl: A Julia package for interpretable machine learning with stochastic Shapley values

Shapley values work with any ML model. The above implementation is integrated with MLJ.jl so you don’t need to call Python.

I had the chance to try the package in an internal project and it worked really well.

---

<div class="post-metadata">

### Author: ![Jaidy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaidy/32/20310_2.png) [@Jaidy](https://discourse.julialang.org/u/Jaidy)
#### Post date: [February 21, 2022, 12:34am UTC](https://discourse.julialang.org/t/boruta-algorithm/76821/3 "2022-02-21T00:34:46Z")

</div>

Thank you so much for pointing me to this algorithm l. I hadn’t come across this before. It works well, though it takes a while to run while other Boruta (in Python, not Julia calling it’s Python implementation which I haven’t figured out just yet) is much faster.

Did it give you similar run time or I made a mistake in incorporating it in my work?

---

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [February 21, 2022, 11:35am UTC](https://discourse.julialang.org/t/boruta-algorithm/76821/4 "2022-02-21T11:35:35Z")

</div>

Hi @Jaidy I don’t recall it taking a long time. Try to check their documentation to see if there is any option that you can use to compute just the first most important features, etc.

Also, ask yourself if speed is a concern in your use case. It is not always the case. Feature importance is typically done once before the actual analysis.

---

<div class="post-metadata">

### Author: ![Jaidy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jaidy/32/20310_2.png) [@Jaidy](https://discourse.julialang.org/u/Jaidy)
#### Post date: [February 21, 2022, 11:46am UTC](https://discourse.julialang.org/t/boruta-algorithm/76821/5 "2022-02-21T11:46:00Z")

</div>

Very good point, thank you.
