贝叶斯调参
from bayes_opt import BayesianOptimization # 定义黑盒函数 def lgb_cv(n_estimators,learning_rate,max_depth,num_leaves,min_child_samples,subsample,colsample_bytree,reg_alpha,reg_lambda,min_child_weight): val = cross_val_score( LGBMClassifier(n_estimators=int(n_estimators), random_state=2019, learning_rate=learning_rate, max_depth=int(max_depth), num_leaves=int(num_leaves), min_child_samples=int(min_child_samples), subsample=min(subsample, 0.99999), colsample_bytree=min(colsample_bytree, 0.9999), reg_alpha=reg_alpha, reg_lambda=reg_lambda, min_child_weight=min_child_weight, class_weight='balanced', ),