text_plain_output_1.png
import numpy as np

import numpy as np # linear algebra

import xgboost as xgb

dtrain = xgb.DMatrix(X_train, y_train)
dvalid = xgb.DMatrix(X_test, y_test)
watchlist = [(dtrain, 'train'), (dvalid, 'eval')]
params = {'objective': 'reg:linear', 'eval_metric': 'rmse', 'eta': 0.01, 'max_depth': 6, 'silent': 1, 'nthread': 1}
num_boost_round = 100
gbm = xgb.train(params, dtrain, num_boost_round, evals=watchlist, verbose_eval=True)
y_pred = gbm.predict(dvalid)

np.sqrt(np.mean((y_pred - y_test) ** 2))