bonsai
bonsai copied to clipboard
add support for case weights with lightgbm engine
How we add weight to labels within bonsai? Does add_case_weights() work with bonsai?
Could you clarify which engine/model supported by bonsai this question is in reference to?
I'not sure. I mean LGBM supports weights through weight_column parameter, and a workflow using parsnip supports add_case_weights(). I thought I could use add_case_weights function with bonsai. It seems I was wrong.
What's the correct way to add weights to cases/classes with bonsai?
Ah, gotcha! We ought to add support for that lightgbm parameter but have not yet. This will be included in a future release!
Note to self: reading through docs, this might be a bit tricky:
Note: works only in case of loading data directly from text file
@simonpcouch LightGBM supports passing weights directly as an in-memory vector. weight_column is a parameter that's intended only for when reading from a file, and really only when using the LightGBM CLI.
Here's an example of weighted training LightGBM using an in-memory vector of weights (no need to care about weight_column parameter): https://github.com/microsoft/LightGBM/blob/638014d5c56fb92396bd55f344a47e3f651a3cd4/R-package/demo/weight_param.R.
Awesome, thanks! :)
I've taken a crack at adding support for case_weight() 72
Closed by #72.