Skip to content

Commit 4cc82c7

Browse files
OkonSamuelablaom
andauthored
Apply suggestions from code review
Co-authored-by: Anthony Blaom, PhD <[email protected]>
1 parent c5161cf commit 4cc82c7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Pkg.add("FeatureSelection")
1717
```
1818

1919
# Example Usage
20-
Lets build a supervised recursive feature eliminator with `RandomForestRegressor` from `MLJDecisionTreeInterface` as our base model.
20+
Lets build a supervised recursive feature eliminator with `RandomForestRegressor`
21+
from DecisionTree.jl as our base model.
2122
But first we need a dataset to train on. We shall create a synthetic dataset popularly known in the R community as the friedman dataset#1. Notice how the target vector for this dataset depends on only the first
2223
five columns of feature table. So we expect that our recursive feature elimination should return the first
2324
columns as important features.
@@ -46,13 +47,15 @@ We can view the important features by inspecting the `fitted_params` object.
4647
p = fitted_params(mach)
4748
p.features_left == [:x1, :x2, :x3, :x4, :x5]
4849
```
49-
We can even call `predict` and `transform` om the fitted machine. See example
50+
We can also call `predict` on the fitted machine, to predict using a
51+
random forest regressor trained just on those features, or call `transform`, to
52+
select just those features some new table including all the original features.
5053
in `?RecursiveFeatureElimination`.
5154

5255
Okay, let's say that we didn't know that our synthetic dataset depends on only five
5356
columns from our feature table. We could apply cross fold validation `CV(nfolds=5)` with our
5457
recursive feature elimination model to select the optimal value of
55-
`n_features_to_select` for our model. In this case we will use a simple Grid search with
58+
`n_features` for our model. In this case we will use a simple Grid search with
5659
root mean square as the measure.
5760
```julia
5861
rfe = RecursiveFeatureElimination(model = forest)
@@ -70,7 +73,7 @@ fit!(self_tuning_rfe_mach)
7073
```
7174
As before we can inspect the important features by inspesting the `fitted_params` object.
7275
```julia
73-
fitted_parms(self_tuning_rfe_mach).features_left == [:x1, :x2, :x3, :x4, :x5]
76+
fitted_parms(self_tuning_rfe_mach).best_model.features_left == [:x1, :x2, :x3, :x4, :x5]
7477
```
7578
and call `predict` on the tuned model machine as shown below
7679
```julia

0 commit comments

Comments
 (0)