Closed philipmassie closed 3 months ago
I have tried making copies of the cv object but deepcopy doesn't copy lightgbm entirely. cloudpickle similarly doesn't save the object in its entirety, and I'm not smart enough to figure out how to change that. I've also not found a way to 're-init' the cv object within the objective.
Reading this back, its sounding more like a question than a feature request. If you think I should remove it and post elsewhere please let me know.
Moving to discussion, aplogies
Description
During hyperparameter tuning with Optuna, LightGBMCV.setup becomes time consuming when training sets get large and folds get more numerous. I think it might be useful to be able to generate the data folds once, and then replace the internal boosters during optimization, updating them with relevant params.
Use case
Using cross validation during hyper parameter tuning is a good way to reduce overfitting but I cant figure out a way to use LightGBMCV with Optuna because the setup method takes longer with larger data sets, and I think most of the time is spent building the folds data which only needs to happen once.
If this already exists or is totally stupid, I apologise.
I came across the below approach somewhere which works well. I cant find the original link, but it's not mine. nesting the setup inside the objective requires that to process on each trial.