python里XGBClassifier怎么设置early stop?XGBClassifier里没有找到相关参数
1个回答
early_stopping_rounds是在fit里设置,不是在XGBClassifier的初始化里
param_dist = {'objective':'binary:logistic', 'n_estimators':2}
clf = xgb.XGBClassifier(**param_dist)
clf.fit(X_train, y_train,
eval_set=[(X_train, y_train), (X_test, y_test)],
eval_metric='logloss',
early_stopping_rounds=5,
verbose=True)
evals_result = clf.evals_result()