From a7a0b34a54169686eb7226974bc3358629d30113 Mon Sep 17 00:00:00 2001 From: tqchen Date: Sat, 6 Sep 2014 22:20:11 -0700 Subject: [PATCH 1/5] add auto build script --- Makefile | 2 +- README.md | 2 +- build.sh | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 build.sh diff --git a/Makefile b/Makefile index 3230661d4..7f3317cbc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ export CC = gcc -export CXX = g++ +export CXX = clang++ export LDFLAGS= -pthread -lm export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -pedantic diff --git a/README.md b/README.md index a2dc4fee1..d69189824 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Features Build ===== -* Simply type make +* Run ```bash build.sh``` (you can also type make) * If your compiler does not come with OpenMP support, it will fire an warning telling you that the code will compile into single thread mode, and you will get single thread xgboost * You may get a error: -lgomp is not found - You can type ```make no_omp=1```, this will get you single thread xgboost diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..42109f5b3 --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if make; then + echo "Successfully build multi-thread xgboost" +else + echo "-----------------------------" + echo "Building multi-thread xgboost failed" + echo "Start to build single-thread xgboost" + make clean + make no_omp=1 + echo "Successfully build single-thread xgboost" +fi \ No newline at end of file From 17ebdde707814ef248001ed940936fe82559a61b Mon Sep 17 00:00:00 2001 From: tqchen Date: Sat, 6 Sep 2014 22:21:50 -0700 Subject: [PATCH 2/5] chg back to g++ --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7f3317cbc..3230661d4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ export CC = gcc -export CXX = clang++ +export CXX = g++ export LDFLAGS= -pthread -lm export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -pedantic From 2d2cee879dc897ee3dbda1cd3b4facdcf40e9f85 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Sat, 6 Sep 2014 22:26:35 -0700 Subject: [PATCH 3/5] Update build.sh --- build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 42109f5b3..7281cb6cb 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,6 @@ #!/bin/bash +# this is a simple scrip to make xgboost in MAC nad Linux +# basically, it first try to make with OpenMP, if fails, disable OpenMP and make again if make; then echo "Successfully build multi-thread xgboost" else @@ -8,4 +10,4 @@ else make clean make no_omp=1 echo "Successfully build single-thread xgboost" -fi \ No newline at end of file +fi From 32a2925be858fb8a614a5d716f53291affb09f58 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Sat, 6 Sep 2014 22:27:25 -0700 Subject: [PATCH 4/5] Update build.sh --- build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 7281cb6cb..35a566ccc 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,8 @@ #!/bin/bash -# this is a simple scrip to make xgboost in MAC nad Linux +# this is a simple script to make xgboost in MAC nad Linux # basically, it first try to make with OpenMP, if fails, disable OpenMP and make again +# This will automatically make xgboost for MAC users who do not have openmp support +# In most cases, type make will give what you want if make; then echo "Successfully build multi-thread xgboost" else From 89b9965cbf97e099aa4be1afcd94f74517f2f679 Mon Sep 17 00:00:00 2001 From: tqchen Date: Sat, 6 Sep 2014 22:40:51 -0700 Subject: [PATCH 5/5] change max depth --- R-package/demo/boost_from_prediction.R | 2 +- R-package/demo/cross_validation.R | 4 ++-- R-package/demo/custom_objective.R | 2 +- R-package/demo/predict_first_ntree.R | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R-package/demo/boost_from_prediction.R b/R-package/demo/boost_from_prediction.R index 7372717f8..bbf45f4a0 100644 --- a/R-package/demo/boost_from_prediction.R +++ b/R-package/demo/boost_from_prediction.R @@ -11,7 +11,7 @@ watchlist <- list(eval = dtest, train = dtrain) # print('start running example to start from a initial prediction') # train xgboost for 1 round -param <- list(max_depth=2,eta=1,silent=1,objective='binary:logistic') +param <- list(max.depth=2,eta=1,silent=1,objective='binary:logistic') bst <- xgb.train( param, dtrain, 1, watchlist ) # Note: we need the margin value instead of transformed prediction in set_base_margin # do predict with output_margin=TRUE, will always give you margin values before logistic transformation diff --git a/R-package/demo/cross_validation.R b/R-package/demo/cross_validation.R index 7fa1f16b2..c7e7ba537 100644 --- a/R-package/demo/cross_validation.R +++ b/R-package/demo/cross_validation.R @@ -6,7 +6,7 @@ dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label) dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label) nround <- 2 -param <- list(max_depth=2,eta=1,silent=1,objective='binary:logistic') +param <- list(max.depth=2,eta=1,silent=1,objective='binary:logistic') cat('running cross validation\n') # do cross validation, this will print result out as @@ -40,7 +40,7 @@ evalerror <- function(preds, dtrain) { return(list(metric = "error", value = err)) } -param <- list(max_depth=2,eta=1,silent=1) +param <- list(max.depth=2,eta=1,silent=1) # train with customized objective xgb.cv(param, dtrain, nround, nfold = 5, obj = logregobj, feval=evalerror) diff --git a/R-package/demo/custom_objective.R b/R-package/demo/custom_objective.R index 017961876..9b0d45465 100644 --- a/R-package/demo/custom_objective.R +++ b/R-package/demo/custom_objective.R @@ -8,7 +8,7 @@ dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label) # 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 <- list(max_depth=2,eta=1,silent=1) +param <- list(max.depth=2,eta=1,silent=1) watchlist <- list(eval = dtest, train = dtrain) num_round <- 2 diff --git a/R-package/demo/predict_first_ntree.R b/R-package/demo/predict_first_ntree.R index f8e45f2d8..964203e9f 100644 --- a/R-package/demo/predict_first_ntree.R +++ b/R-package/demo/predict_first_ntree.R @@ -5,7 +5,7 @@ data(agaricus.test, package='xgboost') dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label) dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label) -param <- list(max_depth=2,eta=1,silent=1,objective='binary:logistic') +param <- list(max.depth=2,eta=1,silent=1,objective='binary:logistic') watchlist <- list(eval = dtest, train = dtrain) nround = 2