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

Add feature importances support to iterated models #67

Merged
merged 1 commit into from
Sep 5, 2024
Merged

Conversation

OkonSamuel
Copy link
Member

closes #66

julia> using MLJIteration, MLJBase, StatisticalMeasures

julia> X, y = make_moons(100, rng=123);

julia> iterated_model = IteratedModel(
           model=XGBoostClassifier(seed=123),
           resampling=Holdout(rng=123),
           measures=log_loss,
           iteration_parameter = :num_round,
           controls=[Step(2), Patience(2), NumberLimit(5)],
           retrain=true
       );

julia> mach = machine(iterated_model, X, y) |> fit!;
[ Info: Training machine(ProbabilisticIteratedModel(model = XGBoostClassifier(test = 1, ), ), ).
[ Info: final loss: 0.24434335559754639
[ Info: Stop triggered by NumberLimit(5) stopping criterion.
[ Info: Retraining on all provided data. To suppress, specify `retrain=false`.
[ Info: Total of 10 iterations.

julia> mach |> feature_importances
2-element Vector{Pair{Symbol, Float32}}:
 :x2 => 9.344354
 :x1 => 1.4283949

@OkonSamuel OkonSamuel requested a review from ablaom September 4, 2024 21:50
Copy link
Member

@ablaom ablaom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to me. Thanks for including the test.

@ablaom ablaom merged commit a3aa159 into dev Sep 5, 2024
2 checks passed
@ablaom ablaom mentioned this pull request Sep 5, 2024
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

Successfully merging this pull request may close these issues.

feature_importances doesn't work in iterated model
2 participants