JuliaAI / MLJXGBoostInterface.jl

MIT License
11 stars 5 forks source link

eval_metric missing #40

Closed Roh-codeur closed 1 year ago

Roh-codeur commented 1 year ago

hi

thanks for the work on this library.

It appears that the eval_metric is missing in the XGBoostClassifier.

this works: model = XGBoostClassifier(;num_round=130, tree_method="hist", eta=0.1, objective="binary:logistic")

this doesn't model = XGBoostClassifier(;num_round=130, tree_method="hist", eta=0.1, objective="binary:logistic", eval_metric=["auc", "aucpr"])

Is this something you can help with please?

thanks

ExpandingMan commented 1 year ago

Could you be more specific about "doesn't work"? If it is throwing an error, can you show the full stack trace? The eval_metric argument is explicitly tested in unit tests (though it doesn't check the exact output values).

Roh-codeur commented 1 year ago

Sure, please see the below code. Maybe I am using it wrong?

model = XGBoostClassifier(;num_round=130, tree_method="hist", eta=0.1, objective="binary:logistic", eval_metric=["auc", "aucpr"])

gives the error:

ERROR: MethodError: no method matching XGBoostClassifier(; num_round=130, tree_method="hist", eta=0.1, objective="binary:logistic", eval_metric=["auc", "aucpr"])
Closest candidates are:
  XGBoostClassifier(; test, num_round, booster, disable_default_eval_metric, eta, num_parallel_tree, gamma, max_depth, min_child_weight, max_delta_step, subsample, colsample_bytree, colsample_bylevel, colsample_bynode, lambda, alpha, tree_method, sketch_eps, scale_pos_weight, updater, refresh_leaf, process_type, grow_policy, max_leaves, max_bin, predictor, sample_type, normalize_type, rate_drop, one_drop, skip_drop, feature_selector, top_k, tweedie_variance_power, objective, base_score, watchlist, nthread, importance_type, seed, validate_parameters) at none:0 got unsupported keyword argument "eval_metric"
Stacktrace:
 [1] kwerr(kw::NamedTuple{(:num_round, :tree_method, :eta, :objective, :eval_metric), Tuple{Int64, String, Float64, String, Vector{String}}}, args::Type)
   @ Base ./error.jl:165
ExpandingMan commented 1 year ago

Oh sorry, I actually got confused about which package this was, I thought it was XGBoost.jl. Looks like eval_metric was omitted here... I think that's because the original intention was that this would not use the logging from XGBoost.jl, possibly from a time before that package used the proper Julia logger. It think the best thing to do would probably be just to add it back in, however in the meantime, you'll have to use XGBoost.jl directly to access it I'm afraid.

Roh-codeur commented 1 year ago

yeah sure, I understand. I am using ConformalPrediction.jl and it only works with MLJ models. so, I have to use this package.

I sincerely appreciate your help with both of these packages

ta!

Roh-codeur commented 1 year ago

@ExpandingMan: hey mate, sorry to bother you again with this. Can you help with this when you have a minute, please? I tried forking and taking a stab at it, but I am a novice developer and lost my way pretty quickly. I have to use this because I use ConformalPrediction.jl which uses MLJ.

thanks a lot, mate!

P.S: Look forward to your talk in JuliaCon. you guys are an inspiration to people like me

ExpandingMan commented 1 year ago

I don't know when I'll get to it (probably sometime this coming week) but I had cleared it from my github notifications which I use to track what I'd like to do and forgotten it, and now it's back, so I ought to remember it this time.

ExpandingMan commented 1 year ago

Done in #41

https://github.com/JuliaRegistries/General/pull/84090

Roh-codeur commented 1 year ago

@ExpandingMan: you, mate, are a Star! thanks a lot!