From 34e01642ca799da4ca9671c079e456bdbeac5281 Mon Sep 17 00:00:00 2001 From: antonymayi Date: Mon, 9 Nov 2015 14:26:16 +0100 Subject: [PATCH 1/2] Update training.py avoid dict comprehension for python 2.6 compatibility --- python-package/xgboost/training.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/xgboost/training.py b/python-package/xgboost/training.py index 0ad7e4e14..5c9b5122a 100644 --- a/python-package/xgboost/training.py +++ b/python-package/xgboost/training.py @@ -89,7 +89,7 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, else: evals_name = [d[1] for d in evals] evals_result.clear() - evals_result.update({key: {} for key in evals_name}) + evals_result.update(dict([(key, {}) for key in evals_name])) if not early_stopping_rounds: for i in range(num_boost_round): From 7114d6681a743c7763e41750dab6db36170b08c1 Mon Sep 17 00:00:00 2001 From: antonymayi Date: Mon, 9 Nov 2015 15:09:14 +0100 Subject: [PATCH 2/2] Update training.py pylint compliancy --- python-package/xgboost/training.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python-package/xgboost/training.py b/python-package/xgboost/training.py index 5c9b5122a..5110295ad 100644 --- a/python-package/xgboost/training.py +++ b/python-package/xgboost/training.py @@ -50,9 +50,10 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, If `verbose_eval` then the evaluation metric on the validation set, if given, is printed at each boosting stage. learning_rates: list or function - List of learning rate for each boosting round - or a customized function that calculates eta in terms of - current number of round and the total number of boosting round (e.g. yields learning rate decay) + List of learning rate for each boosting round + or a customized function that calculates eta in terms of + current number of round and the total number of boosting round (e.g. yields + learning rate decay) - list l: eta = l[boosting round] - function f: eta = f(boosting round, num_boost_round) xgb_model : file name of stored xgb model or 'Booster' instance