From 669a387c9941b1bc4823f03b7271488087f170a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=97=BB=E6=B3=A2?= <813577991@qq.com> Date: Fri, 19 Aug 2016 03:41:18 +0800 Subject: [PATCH] fix a typo and some code format (#1470) * fix a typo * fix a typo and some code format --- demo/guide-python/custom_objective.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/demo/guide-python/custom_objective.py b/demo/guide-python/custom_objective.py index d2bd4d9b2..86f69d233 100755 --- a/demo/guide-python/custom_objective.py +++ b/demo/guide-python/custom_objective.py @@ -2,9 +2,9 @@ import numpy as np import xgboost as xgb ### -# advanced: cutomsized loss function +# advanced: customized loss function # -print ('start running example to used cutomized objective function') +print ('start running example to used customized objective function') dtrain = xgb.DMatrix('../data/agaricus.txt.train') dtest = xgb.DMatrix('../data/agaricus.txt.test') @@ -12,12 +12,12 @@ dtest = xgb.DMatrix('../data/agaricus.txt.test') # note: for customized objective function, we leave objective as default # note: what we are getting is margin value in prediction # you must know what you are doing -param = {'max_depth':2, 'eta':1, 'silent':1 } -watchlist = [(dtest,'eval'), (dtrain,'train')] +param = {'max_depth': 2, 'eta': 1, 'silent': 1} +watchlist = [(dtest, 'eval'), (dtrain, 'train')] num_round = 2 # user define objective function, given prediction, return gradient and second order gradient -# this is loglikelihood loss +# this is log likelihood loss def logregobj(preds, dtrain): labels = dtrain.get_label() preds = 1.0 / (1.0 + np.exp(-preds))