'BayesSearchCV - Add variance penalty to average over cross-validation folds?

I am using BayesSearchCV to find hyperparameters for an XGBoost model on a noisy data set. Even with a perfect model I can only expect to get an out of sample explained variance of around 10%. I am using 10-fold cross validation, but I am pretty sure that I am over-fitting. The overfit parameters happen to give good scores on some of the folds but not on others. What happens is the the individual scores for the 10-folds are all over the place, some very low, some quite high. BayesSearchCV selects the hyper-parameters where the AVERAGE over the 10 folds is largest. But I would like to penalize the average by subtracting a term proportional to the variance across the folds, to keep down overfitting. Is there any way to do this? I know I can change the "scoring" function, but that seems to be for each fold individually, not for how the different scores for the folds get combined into a single score.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source