Created
November 21, 2017 06:37
-
-
Save gvyshnya/bc69fe987fa49f34de98af67d99ee684 to your computer and use it in GitHub Desktop.
xgboost running with tree_method = 'hist'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xgboost as xgb | |
import numpy as np | |
from sklearn.datasets import load_digits | |
from sklearn.cross_validation import train_test_split | |
rng = np.random.RandomState(1994) | |
digits = load_digits(2) | |
X = digits['data'] | |
y = digits['target'] | |
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0) | |
dtrain = xgb.DMatrix(X_train, y_train) | |
dtest = xgb.DMatrix(X_test, y_test) | |
param = {'objective': 'binary:logistic', | |
'tree_method': 'hist', | |
'grow_policy': 'depthwise', | |
'max_depth': 3, | |
'eval_metric': 'auc'} | |
res = {} | |
bst = xgb.train(param, dtrain, 10, [(dtrain, 'train'), (dtest, 'test')], | |
evals_result = res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment