From d867579a696e4d0d351d9c95250370ac9786f5ae Mon Sep 17 00:00:00 2001 From: Vadim Khotilovich Date: Fri, 18 Dec 2015 14:18:28 -0600 Subject: [PATCH 1/8] make it possible to run create_wrap.sh not only from its directory --- java/create_wrap.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java/create_wrap.sh b/java/create_wrap.sh index d66e4dbd4..f7f3e05d5 100755 --- a/java/create_wrap.sh +++ b/java/create_wrap.sh @@ -1,4 +1,10 @@ +#!/bin/env sh + echo "build java wrapper" + +# cd to script's directory +pushd `dirname $0` > /dev/null + cd .. make java cd java @@ -12,4 +18,5 @@ fi rm -f xgboost4j/src/main/resources/lib/libxgboostjavawrapper.so mv libxgboostjavawrapper.so xgboost4j/src/main/resources/lib/ +popd > /dev/null echo "complete" From f97c4ccb60f44ebab5f30ebeff6626ab2479db6c Mon Sep 17 00:00:00 2001 From: Vadim Khotilovich Date: Fri, 18 Dec 2015 14:34:16 -0600 Subject: [PATCH 2/8] make gcc5 check silent when there's no gcc5 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 986c5d774..e478cb649 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -export CC = $(if $(shell which gcc-5),gcc-5,gcc) -export CXX = $(if $(shell which g++-5),g++-5,g++) +export CC = $(if $(shell which gcc-5 2>/dev/null),gcc-5,gcc) +export CXX = $(if $(shell which g++-5 2>/dev/null),g++-5,g++) export MPICXX = mpicxx export LDFLAGS= -pthread -lm From 0c38a916fe15962afd4f7475e0d4b6e30ea3f350 Mon Sep 17 00:00:00 2001 From: Vadim Khotilovich Date: Fri, 18 Dec 2015 15:03:39 -0600 Subject: [PATCH 3/8] make some gcc versions happy by using the fwrite return value --- src/io/dmlc_simple.cpp | 2 +- src/utils/io.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/dmlc_simple.cpp b/src/io/dmlc_simple.cpp index 3fbf34734..0448bd578 100644 --- a/src/io/dmlc_simple.cpp +++ b/src/io/dmlc_simple.cpp @@ -153,7 +153,7 @@ class StdFile : public dmlc::Stream { return std::fread(ptr, 1, size, fp); } virtual void Write(const void *ptr, size_t size) { - std::fwrite(ptr, size, 1, fp); + Check(std::fwrite(ptr, size, 1, fp) == 1, "StdFile::Write: fwrite error!"); } virtual void Seek(size_t pos) { std::fseek(fp, static_cast(pos), SEEK_SET); // NOLINT(*) diff --git a/src/utils/io.h b/src/utils/io.h index 5b366e51c..1fd09310e 100644 --- a/src/utils/io.h +++ b/src/utils/io.h @@ -33,7 +33,7 @@ class FileStream : public ISeekStream { return std::fread(ptr, size, 1, fp); } virtual void Write(const void *ptr, size_t size) { - std::fwrite(ptr, size, 1, fp); + Check(std::fwrite(ptr, size, 1, fp) == 1, "FileStream::Write: fwrite error!"); } virtual void Seek(size_t pos) { std::fseek(fp, static_cast(pos), SEEK_SET); // NOLINT(*) From f18852376f8f6ad1922a670ead6c8d5f265973e1 Mon Sep 17 00:00:00 2001 From: Vadim Khotilovich Date: Fri, 18 Dec 2015 15:49:15 -0600 Subject: [PATCH 4/8] hopefully, this would make travis happy --- java/create_wrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/create_wrap.sh b/java/create_wrap.sh index f7f3e05d5..ffa0109d9 100755 --- a/java/create_wrap.sh +++ b/java/create_wrap.sh @@ -1,4 +1,4 @@ -#!/bin/env sh +#!/usr/bin/env sh echo "build java wrapper" From b3f3e7d0cbde1877359d9e9015e9e63db4880e69 Mon Sep 17 00:00:00 2001 From: Faron Date: Sat, 19 Dec 2015 10:35:16 +0100 Subject: [PATCH 5/8] fixed wrong iter when using training continuation --- python-package/xgboost/training.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python-package/xgboost/training.py b/python-package/xgboost/training.py index e47db0bc6..d0fc1363c 100644 --- a/python-package/xgboost/training.py +++ b/python-package/xgboost/training.py @@ -117,7 +117,7 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, evals_result.update(dict([(key, {}) for key in evals_name])) if not early_stopping_rounds: - for i in range(num_boost_round): + for i in range(nboost, nboost + num_boost_round): bst.update(dtrain, i, obj) nboost += 1 if len(evals) != 0: @@ -189,7 +189,7 @@ def train(params, dtrain, num_boost_round=10, evals=(), obj=None, feval=None, if isinstance(learning_rates, list) and len(learning_rates) != num_boost_round: raise ValueError("Length of list 'learning_rates' has to equal 'num_boost_round'.") - for i in range(num_boost_round): + for i in range(nboost, nboost + num_boost_round): if learning_rates is not None: if isinstance(learning_rates, list): bst.set_param({'eta': learning_rates[i]}) From dba782e9858c3a1d2a4dfc257a3efbe92bde97d8 Mon Sep 17 00:00:00 2001 From: "junnan.wang@ef.com" Date: Wed, 23 Dec 2015 14:33:00 +0800 Subject: [PATCH 6/8] fix windows compile problem --- subtree/rabit/windows/rabit/rabit.vcxproj | 2 +- windows/xgboost/xgboost.vcxproj | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/subtree/rabit/windows/rabit/rabit.vcxproj b/subtree/rabit/windows/rabit/rabit.vcxproj index c9594b182..c670484d2 100644 --- a/subtree/rabit/windows/rabit/rabit.vcxproj +++ b/subtree/rabit/windows/rabit/rabit.vcxproj @@ -24,7 +24,7 @@ - Application + StaticLibrary true MultiByte diff --git a/windows/xgboost/xgboost.vcxproj b/windows/xgboost/xgboost.vcxproj index 00846f36a..8a15eaf61 100644 --- a/windows/xgboost/xgboost.vcxproj +++ b/windows/xgboost/xgboost.vcxproj @@ -25,6 +25,11 @@ + + + {d7b77d06-4f5f-4bd7-b81e-7cc8ebbe684f} + + {19766C3F-7508-49D0-BAAC-0988FCC9970C} xgboost From 38b773d80b125f791f12dc4829ccdf0be2020322 Mon Sep 17 00:00:00 2001 From: FrozenFingerz Date: Sun, 27 Dec 2015 13:54:52 +0100 Subject: [PATCH 7/8] cv: fixed devision by zero exception - show_progress=False or show_progress=0 led to devision by zero exception --- 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 d0fc1363c..fd7565e52 100644 --- a/python-package/xgboost/training.py +++ b/python-package/xgboost/training.py @@ -337,7 +337,8 @@ def aggcv(rlist, show_stdv=True, show_progress=None, as_pandas=True, trial=0): if show_progress is None: show_progress = True - if (isinstance(show_progress, int) and trial % show_progress == 0) or (isinstance(show_progress, bool) and show_progress): + if (isinstance(show_progress, int) and show_progress > 0 and trial % show_progress == 0) or \ + (isinstance(show_progress, bool) and show_progress): sys.stderr.write(msg + '\n') sys.stderr.flush() @@ -432,10 +433,10 @@ def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(), best_score = score best_score_i = i elif i - best_score_i >= early_stopping_rounds: - sys.stderr.write("Stopping. Best iteration: {}\n".format(best_score_i)) results = results[:best_score_i+1] + sys.stderr.write("Stopping. Best iteration: {} (mean: {}, std: {})\n". + format(best_score_i, results[-1][0], results[-1][1])) break - if as_pandas: try: import pandas as pd From d0ecb0cbc76acde90ced1067d572730b26597a0d Mon Sep 17 00:00:00 2001 From: Yoav Zimmerman Date: Mon, 28 Dec 2015 15:42:43 -0800 Subject: [PATCH 8/8] minor latex typo fix in Introduction to Boosted Tree's documentation --- doc/model.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/model.md b/doc/model.md index 7874a4cfc..dd92cf6dc 100644 --- a/doc/model.md +++ b/doc/model.md @@ -188,7 +188,7 @@ By defining it formally, we can get a better idea of what we are learning, and y Here is the magical part of the derivation. After reformalizing the tree model, we can write the objective value with the ``$ t$``-th tree as: ```math -Obj^{(t)} &\approx \sum_{i=1}^n [g_i w_q(x_i) + \frac{1}{2} h_i w_{q(x_i)}^2] + \gamma T + \frac{1}{2}\lambda \sum_{j=1}^T w_j^2\\ +Obj^{(t)} &\approx \sum_{i=1}^n [g_i w_{q(x_i)} + \frac{1}{2} h_i w_{q(x_i)}^2] + \gamma T + \frac{1}{2}\lambda \sum_{j=1}^T w_j^2\\ &= \sum^T_{j=1} [(\sum_{i\in I_j} g_i) w_j + \frac{1}{2} (\sum_{i\in I_j} h_i + \lambda) w_j^2 ] + \gamma T ```