Minor edits to coding style (#2835)

* Some minor changes to the code style

Some minor changes to the code style in file basic_walkthrough.py

* coding style changes

* coding style changes arrcording PEP8

* Update basic_walkthrough.py
This commit is contained in:
LevineHuang
2017-10-27 11:12:54 +08:00
committed by Yuan (Terry) Tang
parent d9d5293cdb
commit 91af8f7106
10 changed files with 51 additions and 52 deletions

View File

@@ -15,11 +15,11 @@ dtest = xgb.DMatrix(data[4741:6773, 0:34], data[4741:6773, 34])
param = {'silent':1, 'objective':'reg:gamma', 'booster':'gbtree', 'base_score':3}
# the rest of settings are the same
watchlist = [(dtest,'eval'), (dtrain,'train')]
watchlist = [(dtest, 'eval'), (dtrain, 'train')]
num_round = 30
# training and evaluation
bst = xgb.train(param, dtrain, num_round, watchlist)
preds = bst.predict(dtest)
labels = dtest.get_label()
print ('test deviance=%f' % (2 * np.sum((labels - preds) / preds - np.log(labels) + np.log(preds))))
print('test deviance=%f' % (2 * np.sum((labels - preds) / preds - np.log(labels) + np.log(preds))))