Skip to content

Commit c105173

Browse files
committed
Merge branch 'master' into dev
2 parents 466ea27 + 8f548ad commit c105173

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/models/rfe.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ It recursively removes features, training a base model on the remaining features
4848
evaluating their importance until the desired number of features is selected.
4949
5050
# Training data
51+
5152
In MLJ or MLJBase, bind an instance `rfe_model` to data with
5253
5354
mach = machine(rfe_model, X, y)
@@ -95,13 +96,17 @@ Train the machine using `fit!(mach, rows=...)`.
9596
table.
9697
9798
# Fitted parameters
99+
98100
The fields of `fitted_params(mach)` are:
101+
99102
- `features_left`: names of features remaining after recursive feature elimination.
100103
101104
- `model_fitresult`: fitted parameters of the base model.
102105
103106
# Report
107+
104108
The fields of `report(mach)` are:
109+
105110
- `scores`: dictionary of scores for each feature in the training dataset.
106111
The model deems highly scored variables more significant.
107112
@@ -215,22 +220,30 @@ abs_last(x::Pair{<:Any, <:Real}) = abs(last(x))
215220
"""
216221
score_features!(scores_dict, features, importances, n_features_to_score)
217222
218-
Internal method that updates the `scores_dict` by increasing the score for each feature based on their
223+
**Private method.**
224+
225+
Update the `scores_dict` by increasing the score for each feature based on their
219226
importance and store the features in the `features` array.
220227
221228
# Arguments
229+
222230
- `scores_dict::Dict{Symbol, Int}`: A dictionary where the keys are features and
223231
the values are their corresponding scores.
232+
224233
- `features::Vector{Symbol}`: An array to store the top features based on importance.
234+
225235
- `importances::Vector{Pair(Symbol, <:Real)}}`: An array of tuples where each tuple
226236
contains a feature and its importance score.
237+
227238
- `n_features_to_score::Int`: The number of top features to score and store.
228239
229240
# Notes
241+
230242
Ensure that `n_features_to_score` is less than or equal to the minimum of the
231243
lengths of `features` and `importances`.
232244
233245
# Example
246+
234247
```julia
235248
scores_dict = Dict(:feature1 => 0, :feature2 => 0, :feature3 => 0)
236249
features = [:x1, :x1, :x1]

0 commit comments

Comments
 (0)