Skip to content

Commit

Permalink
Fix feature_importance error message
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhuijzer committed Dec 4, 2023
1 parent a16f168 commit b38fd0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SIRUS"
uuid = "cdeec39e-fb35-4959-aadb-a1dd5dede958"
authors = ["Rik Huijzer <github@huijzer.xyz>"]
version = "2.0.0"
version = "2.0.1"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
2 changes: 1 addition & 1 deletion src/importance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function feature_importance(
end
end
if !found_feature
throw(ArgumentError("Feature `$feature_name` not found in the model."))
throw(ArgumentError("Feature `$feat_name` not found in the model."))
end
return importance
end
Expand Down
5 changes: 4 additions & 1 deletion test/importance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ end
# and 2 classes: [0, 1].
# Note: showing only the probability for class 1 since class 0 has probability 1 - p.

@test_throws ArgumentError feature_importance(model, "x1")
let
msg = "Feature `x1` not found in the model."
@test_throws ArgumentError(msg) feature_importance(model, "x1")
end

importance = feature_importance(model, "1")
# Based on the numbers above.
Expand Down

0 comments on commit b38fd0c

Please sign in to comment.