Skip to content

Commit

Permalink
pass verbosity instead of (deprecated?) silent to XGBoost.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
ablaom committed Jul 1, 2024
1 parent 0acc2d4 commit c037be9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/MLJXGBoostInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ function kwargs(model, verbosity, obj)
excluded = [:importance_type]
fn = filter((excluded), fieldnames(typeof(model)))
out = NamedTuple(n=>getfield(model, n) for n fn if !isnothing(getfield(model, n)))
out = merge(out, (silent=(verbosity 0),))
# watchlist is for log output, so override if it's default and verbosity ≤ 0
wl = (verbosity 0 && isnothing(model.watchlist)) ? (;) : model.watchlist
if !isnothing(wl)
out = merge(out, (watchlist=wl,))

# watchlist needs to be consistent with verbosity:
watchlist = (verbosity 0 && isnothing(model.watchlist)) ? (;) : model.watchlist
if !isnothing(watchlist)
out = merge(out, (; watchlist))
end
out = merge(out, (objective=_fix_objective(obj),))

# need `0 ≤ verbosity ≤ 3`:
verbosity = min(max(verbosity, 0), 3)

objective=_fix_objective(obj)
out = merge(out, (; verbosity, objective))

return out
end

Expand Down

0 comments on commit c037be9

Please sign in to comment.