TST: Added test for early stopping

This commit is contained in:
terrytangyuan
2015-10-04 23:15:25 -05:00
parent 412310ed04
commit 956e50686e
2 changed files with 11 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
import xgboost as xgb
X = digits['data']
y = digits['target']
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
clf = xgb.XGBClassifier()
clf.fit(X_train, y_train, early_stopping_rounds=10, eval_metric="auc",
eval_set=[(X_test, y_test)])