def optimize(self, trials, max_evals=250):
self.space = {
"objective": "multi:softprob",
"eval_metric": "mlogloss",
#Control complexity of model
"eta" : hp.quniform("eta", 0.1, 0.3, 0.025),
"max_depth" : hp.quniform("max_depth", 5, 10, 1),
"min_child_weight" : hp.quniform('min_child_weight', 5, 10, 1),
'gamma' : hp.quniform('gamma', 0, 1, 0.05),
'learning_rate': hp.quniform('learning_rate', 0., 0.1, 0.01),
'n_estimators': hp.quniform('n_estimators', 500, 800, 10),
#Improve noise robustness
"subsample" : hp.quniform('subsample', 1.0, 2, 0.01),
"colsample_bytree" : hp.quniform('colsample_bytree', 0.3, 0.6, 0.025),
'num_class' : 2,
'silent' : 1}
best = fmin(self.score, self.space, algo=tpe.suggest, trials=trials, max_evals=max_evals)
print "best parameters", best
return best
tuning.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录