xgboost/tests/python/test_early_stopping.py
2015-10-04 23:15:25 -05:00

10 lines
272 B
Python

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)])