def feval(d):
max_depth = d['max_depth']
n_estimators = d['n_estimators']
clf = RandomForestClassifier(n_jobs=-1, max_depth=max_depth, n_estimators=n_estimators)
scores = cross_val_score(clf, data_X, data_y, cv=5, scoring='accuracy')
return np.mean(scores) - np.std(scores)
评论列表
文章目录