Compare commits

..

3738 Commits

Author SHA1 Message Date
Tong He
1995db85e8 fix additional files note (#4699)
* fix additional files note

* Trigger CI

* Trigger CI
2019-07-25 11:21:48 -07:00
Philip Hyunsu Cho
9c02016844 Upgrade dmlc-core submodule (#4688) 2019-07-20 11:31:04 -07:00
Philip Hyunsu Cho
00e58bd08b Upgrade dmlc-core submodule (#4674) 2019-07-18 11:58:54 -07:00
Tong He
b77a89ec28 [R] Fix CRAN error for Mac OS X (#4672)
* fix cran error for mac os x

* ignore float on windows check for now
2019-07-18 11:58:30 -07:00
Philip Cho
cafc8bff58 Fix version number in R package 2019-06-20 14:23:20 -07:00
Philip Hyunsu Cho
515f5f5c47 [RFC] Version 0.90 release candidate (#4475)
* Release 0.90

* Add script to automatically generate acknowledgment

* Update NEWS.md
2019-05-20 01:02:44 -07:00
Nan Zhu
adcd8ea7c6 Update xgboost4j_spark_tutorial.rst (#4476) 2019-05-17 04:17:57 +00:00
Philip Hyunsu Cho
cf2400036e [CI] Add Python and C++ tests for Windows GPU target (#4469)
* Add CMake option to use bundled gtest from dmlc-core, so that it is easy to build XGBoost with gtest on Windows

* Consistently apply OpenMP flag to all targets. Force enable OpenMP when USE_CUDA is turned on.

* Insert vcomp140.dll into Windows wheels

* Add C++ and Python tests for CPU and GPU targets (CUDA 9.0, 10.0, 10.1)

* Prevent spurious msbuild failure

* Add GPU tests

* Upgrade dmlc-core
2019-05-16 01:06:46 +00:00
ras44
3e930e4f2d added JSON vignette (#4439) 2019-05-15 01:35:44 +00:00
Rong Ou
a9ec2dd295 only copy the model once when predicting multiple batches (#4457) 2019-05-15 11:04:22 +12:00
Rong Ou
df2cdaca50 add cuda 10.1 support (#4468) 2019-05-14 18:30:58 +00:00
Philip Hyunsu Cho
c6f2a7e186 [CI] Add Windows GPU to Jenkins CI pipeline (#4463)
* Fix #4462: Use /MT flag consistently for MSVC target

* First attempt at Windows CI

* Distinguish stages in Linux and Windows pipelines

* Try running CMake in Windows pipeline

* Add build step
2019-05-14 04:45:06 +00:00
Philip Hyunsu Cho
e7d17ec4f4 [CI] Build XGBoost wheels with CUDA 9.0 (#4459)
* [CI] Build XGBoost wheels with CUDA 9.0

* Do not call archiveArtifacts for 8.0 wheel
2019-05-11 16:35:02 -07:00
Philip Hyunsu Cho
b5f7cbfadf [CI] Cache two R build Docker containers (#4458) 2019-05-11 10:54:00 -07:00
Rong Ou
be0f346ec9 mgpu predictor using explicit offsets (#4438)
* mgpu prediction using explicit sharding
2019-05-11 09:35:06 +12:00
Rory Mitchell
d16d9a9988 Correctly determine cuda version (#4453) 2019-05-10 19:46:57 +12:00
Philip Hyunsu Cho
6ff994126a [BLOCKING][CI] Upgrade to Spark 2.4.3 (#4414)
* [CI] Upgrade to Spark 2.4.2

* Pass Spark version to build script

* Allow multiple --build-arg in ci_build.sh

* Fix syntax

* Fix container name

* Update pom.xml

* Fix container name

* Update Jenkinsfile

* Update pom.xml

* Update Dockerfile.jvm_cross
2019-05-09 21:36:59 -07:00
Shaochen Shi
18e4fc3690 [jvm-packages] Automatically set maximize_evaluation_metrics if not explicitly given in XGBoost4J-Spark (#4446)
* Automatically set maximize_evaluation_metrics if not explicitly given.

* When custom_eval is set, require maximize_evaluation_metrics.

* Update documents on early stop in XGBoost4J-Spark.

* Fix code error.
2019-05-09 12:49:44 -07:00
Jiaming Yuan
8da4907e89 Enable building with shared NCCL. (#4447)
* Add `BUILD_WITH_SHARED_NCCL` to CMake.
2019-05-09 23:19:58 +08:00
Philip Hyunsu Cho
ade3f30237 Fix list formatting in missing value tutorial in XGBoost4J-Spark 2019-05-06 14:24:02 -07:00
Philip Hyunsu Cho
b511638ca1 Fix list formatting in missing value tutorial in XGBoost4J-Spark 2019-05-06 14:21:49 -07:00
Daniel Hen
eabcc0e210 [jvm-packages] Tutorial on handling missing values (#4425)
Add tutorial on missing values and how to handle those within XGBoost.
2019-05-06 13:57:18 -07:00
Jiaming Yuan
5de7e12704 Change obj name to reg:squarederror in learner. (#4427)
* Change memory dump size in R test.
2019-05-06 21:35:35 +08:00
Xin Yin
8d1098a983 In AUC and AUCPR metrics, detect whether weights are per-instance or per-group (#4216)
* In AUC and AUCPR metrics, detect whether weights are per-instance or per-group

* Fix C++ style check

* Add a test for weighted AUC
2019-05-04 00:53:04 -07:00
Philip Hyunsu Cho
9252b686ae Make AUCPR work with multiple query groups (#4436)
* Make AUCPR work with multiple query groups

* Check AUCPR <= 1.0 in distributed setting
2019-05-03 10:34:44 -07:00
ras44
2be85fc62a max_digits10 guarantees float decimal roundtrip (#4435)
2 additional digits are not needed to guarantee that casting the decimal representation will result in the same float, see https://github.com/dmlc/xgboost/issues/3980#issuecomment-458702440
2019-05-02 20:01:26 -07:00
Rong Ou
feb6ae3e18 Initial support for external memory in gpu_predictor (#4284) 2019-05-03 13:01:27 +12:00
ras44
54980b8959 Fix typo in xgboost_R.h (#4432) 2019-05-02 19:18:34 +08:00
Philip Hyunsu Cho
c1e4a0f2c6 Upgrade dmlc-core (#4430) 2019-05-02 18:38:22 +08:00
Philip Hyunsu Cho
bfddc2c42c Make CMakeLists.txt compatible with CMake 3.3 (#4420)
* Make CMakeLists.txt compatible with CMake 3.3; require CMake 3.11 for MSVC

* Use CMake 3.12 when sanitizer is enabled

* Disable funroll-loops for MSVC

* Use cmake version in container name

* Add missing arg

* Fix egrep use in ci_build.sh

* Display CMake version

* Do not set OpenMP_CXX_LIBRARIES for MSVC

* Use cmake_minimum_required()
2019-05-02 11:49:32 +08:00
Philip Hyunsu Cho
17df5fd296 Simplify bound checking in feature interaction constraints (#4428) 2019-05-01 16:59:53 -07:00
Xu Xiao
4c74336384 Use feature interaction constraints to narrow search space for split candidates (#4341)
* Use feature interaction constraints to narrow search space for split candidates.

* fix clang-tidy broken at updater_quantile_hist.cc:535:3

* make const

* fix

* try to fix exception thrown in java_test

* fix suspected mistake which cause EvaluateSplit error

* try fix

* Fix bug: feature ID and node ID swapped in argument

* Rename CheckValidation() to CheckFeatureConstraint() for clarity

* Do not create temporary vector validFeatures, to enable parallelism
2019-04-30 20:59:58 -07:00
Philip Hyunsu Cho
ba98e0cdf2 Add additional Python tests to test training under constraints (#4426) 2019-04-30 18:23:39 -07:00
Rong Ou
eaab364a63 More explict sharding methods for device memory (#4396)
* Rename the Reshard method to Shard

* Add a new Reshard method for sharding a vector that's already sharded
2019-05-01 11:47:22 +12:00
Xu Xiao
797ba8e72d [jvm-packages] fix compatibility problem of spark version (#4411)
* fix compatibility problem of spark version on MissingValueHandlingSuite.scala

* call setHandleInvalid by runtime reflection
2019-04-30 09:13:05 -07:00
Nan Zhu
253fdd8a42 [jvm-packages] fix the split of input (#4417) 2019-04-29 18:52:40 -07:00
tqchen
91c513a0c1 fix doc 2019-04-29 17:50:46 -07:00
Rory Mitchell
5e582b0fa7 Combine thread launches into single launch per tree for gpu_hist (#4343)
* Combine thread launches into single launch per tree for gpu_hist
algorithm.

* Address deprecation warning

* Add manual column sampler constructor

* Turn off omp dynamic to get a guaranteed number of threads

* Enable openmp in cuda code
2019-04-29 09:58:34 +12:00
Ravi Kalia
146e83f3b3 Fix typo in model.rst (#4393) 2019-04-27 14:22:07 -07:00
Bozhao
5dfb27fb2d Update demo readme's use case section with BentoML (#4400) 2019-04-27 14:21:17 -07:00
Jiaming Yuan
77c03538b0 Fix node reuse. (#4404)
* Reinitialize `_sindex` when reallocating a deleted node.
2019-04-27 13:03:23 +08:00
Nan Zhu
37dc82c3ff [jvm-packages] allow partial evaluation of dataframe before prediction (#4407)
* allow partial evaluation of dataframe before prediction

* resume spark test

* comments

* Run unit tests after building JVM packages
2019-04-26 21:02:40 -07:00
Philip Hyunsu Cho
ea850ecd20 [CI] Refactor Jenkins CI pipeline + migrate all Linux tests to Jenkins (#4401)
* All Linux tests are now in Jenkins CI
* Tests are now de-coupled from builds. We can now build XGBoost with one version of CUDA/JDK and test it with another version of CUDA/JDK
* Builds (compilation) are significantly faster because 1) They use C5 instances with faster CPU cores; and 2) build environment setup is cached using Docker containers
2019-04-26 18:39:12 -07:00
Nan Zhu
995698b0cb [BREAKING][jvm-packages] fix the non-zero missing value handling (#4349)
* fix the nan and non-zero missing value handling

* fix nan handling part

* add missing value

* Update MissingValueHandlingSuite.scala

* Update MissingValueHandlingSuite.scala

* stylistic fix
2019-04-26 11:10:33 -07:00
Xu Xiao
2d875ec019 [BLOCKING][jvm-packages] fix non-deterministic order within a partition (in the case of an upstream shuffle) on prediction (#4388)
* [jvm-packages][hot-fix] fix column mismatch caused by zip actions at XGBooostModel.transformInternal

* apply minibatch in prediction

* an iterator-compatible minibatch prediction

* regressor impl

* continuous working on mini-batch prediction of xgboost4j-spark

* Update Booster.java
2019-04-26 11:09:20 -07:00
Philip Hyunsu Cho
503cc42f48 [CI] Fix Windows tests (#4403)
* Install binary igraph

* Include Graphviz in PATH
2019-04-25 20:25:43 -07:00
Rong Ou
2c61f02add fix broken python test (#4395) 2019-04-23 16:01:23 -07:00
Philip Hyunsu Cho
bbe0dbd7ec Migrate pylint check to Python 3 (#4381)
* Migrate lint to Python 3

* Fix lint errors

* Use Miniconda3 to use Python 3.7

* Use latest pylint and astroid
2019-04-21 01:01:54 -07:00
James Lamb
5e97de6a41 fixed typos in R package docs (#4345)
* fixed typos in R package docs

* updated verbosity parameter in xgb.train docs
2019-04-21 15:54:11 +08:00
Nan Zhu
65db8d0626 [jvm-packages] support spark 2.4 and compatibility test with previous xgboost version (#4377)
* bump spark version

* keep float.nan

* handle brokenly changed name/value

* add test

* add model files

* add model files

* update doc
2019-04-17 11:33:13 -07:00
Egor Smirnov
711397d645 Optimizations of pre-processing for 'hist' tree method (#4310)
* oprimizations for pre-processing

* code cleaning

* code cleaning

* code cleaning after review

* Apply suggestions from code review

Co-Authored-By: SmirnovEgorRu <egor.smirnov@intel.com>
2019-04-16 17:36:19 -07:00
Jiaming Yuan
207f058711 Refactor CMake scripts. (#4323)
* Refactor CMake scripts.

* Remove CMake CUDA wrapper.
* Bump CMake version for CUDA.
* Use CMake to handle Doxygen.
* Split up CMakeList.
* Export install target.
* Use modern CMake.
* Remove build.sh
* Workaround for gpu_hist test.
* Use cmake 3.12.

* Revert machine.conf.

* Move CLI test to gpu.

* Small cleanup.

* Support using XGBoost as submodule.

* Fix windows

* Fix cpp tests on Windows

* Remove duplicated find_package.
2019-04-15 10:08:12 -07:00
Jiaming Yuan
84d992babc GPU multiclass metrics (#4368)
* Port multi classes metrics to CUDA.
2019-04-15 17:47:47 +08:00
James Lamb
be7bc07ca3 added files from local R build to gitignore (#4346) 2019-04-13 03:02:02 +08:00
James Lamb
edae664afb [r-package] cut CI-time dependency on craigcitro/r-travis (fixes #4348) (#4353)
* [r-package] cut CI-time dependency on craigcitro/r-travis (fixes #4348)

* Install R

* Install R on OSX

* Remove gfortran symlink

* Specify CRAN repo

* added more R dependencies needed for testing

* removed heavy R dependencies in CI

* fixed bug in env var, removed unnecessary apt installs of R

* fix to R installs
2019-04-12 00:22:48 -07:00
Rong Ou
f4521bf6aa refactor tests to get rid of duplication (#4358)
* refactor tests to get rid of duplication

* address review comments
2019-04-12 00:21:48 -07:00
Xu Xiao
3078b5944d add OpenMP option in CMakeLists.txt (#4339) 2019-04-10 17:35:06 -07:00
Adam Pocock
a448a8320c [jvm-packages] Fixing the NativeLibLoader on Java 9+ (#4351)
The old NativeLibLoader had a short-circuit load path which modified
java.library.path and attempted to load the xgboost library from outside
the jar first, falling back to loading the library from inside the jar.
This path is a no-op every time when using XGBoost outside of it's
source tree. Additionally it triggers an illegal reflective access
warning in the module system in 9, 10, and 11.

On Java 12 the ClassLoader fields are not accessible via reflection
(separately from the illegal reflective acces warning), and so it fails
in a way that isn't caught by the code which falls back to loading the
library from inside the jar.

This commit removes that code path and always loads the xgboost library
from inside the jar file as it's a valid technique across multiple JVM
implementations and works with all versions of Java.
2019-04-10 12:41:44 -07:00
Jean-Francois Zinque
956e73f183 Fix matrix attributes not sliced (#4311) 2019-04-10 11:14:44 -07:00
Jiaming Yuan
5c2575535f Fix Histogram allocation. (#4347)
* Fix Histogram allocation.

nidx_map is cleared after `Reset`, but histogram data size isn't changed hence
histogram recycling is used in later iterations.  After a reset(building new
tree), newly allocated node will start from 0, while recycling always choose
the node with smallest index, which happens to be our newly allocated node 0.
2019-04-10 19:21:26 +08:00
Rong Ou
81c1cd40ca add a test for cpu predictor using external memory (#4308)
* add a test for cpu predictor using external memory

* allow different page size for testing
2019-04-10 13:25:10 +12:00
James Lamb
b72eab3e07 Added travis logo (#4344) 2019-04-08 21:20:15 -07:00
Mayank Suman
360f25ec27 Added language classifier for python (#4327)
* Added language classifier for python

* Removed python2 language classifier

* Fix formatting
2019-04-08 11:13:26 -07:00
Yang Yang
c7bc739ed2 Fix document about colsample_by* parameter (#4340)
Correct the calculation mistake in colsample_by* example.
2019-04-08 11:10:04 -07:00
Xu Xiao
60a9af567c [jvm-packages] Add methods operating attributes of booster in jvm package, which follow API design in python package. (#4336) 2019-04-08 11:00:35 -07:00
Andy Adinets
9080bba815 C API example (#4333) 2019-04-08 11:22:03 +12:00
Jiaxiang Li
2e052e74b6 Update CONTRIBUTORS.md (#4335) 2019-04-05 10:45:23 -07:00
Jiaxiang Li
1ca5698221 Make the train and test input with same colnames. (#4329)
Fix the bug report of https://github.com/dmlc/xgboost/issues/4328.
I am the beginner of the Git so just try my best to follows the guide, https://xgboost.readthedocs.io/en/latest/contribute.html#r-package.
I find there is no `dev`  branch, so I pull this fix from my master branch to the original master branch.
2019-04-04 15:59:27 -07:00
Philip Hyunsu Cho
70be1e38c2 [CI] Optimize external Docker build cache (#4334)
* When building pull requests, use Docker cache for master branch

Docker build caches are per-branch, so new pull requests will initially
have no build cache, causing the Docker containers to be built from
scratch. New pull requests should use the cache associated with the
master branch. This makes sense, since most pull requests do not modify
the Dockerfile.

* Add comments
2019-04-04 15:59:07 -07:00
Philip Hyunsu Cho
37c75aac41 [CI] Add external Docker build cache (#4331) 2019-04-04 13:36:39 -07:00
Jiaming Yuan
82dca3c108 Don't store DMatrix handle until it's initialized. (#4317)
* Use a temporary variable to store the handle.
* Decode c++ error message.
* Simple note about saved binary.
2019-04-01 18:29:28 +08:00
sriramch
2f7087eba1 Improve HostDeviceVector exception safety (#4301)
* make the assignments of HostDeviceVector exception safe.
* storing a dummy GPUDistribution instance in HDV for CPU based code.
* change testxgboost binary location to build directory.
2019-03-31 22:48:58 +08:00
Hajime Morrita
680a1b36f3 Get rid of a few trivial compiler warnings. (#4312) 2019-03-31 00:02:29 +08:00
Nan Zhu
ad4de0d718 [jvm-packages] handle NaN as missing value explicitly (#4309)
* handle nan

* handle nan explicitly

* make code better and handle sparse vector in spark

* Update XGBoostGeneralSuite.scala
2019-03-30 19:34:26 +08:00
Rong Ou
7ea5b772fb do not filter shared library files (#4303) 2019-03-28 19:40:54 +08:00
Philip Hyunsu Cho
7aed8f3d48 [CI] Upgrade to GCC 5.3.1, CMake 3.6.0 (#4306)
* Upgrade to GCC 5.3.1, CMake 3.6.0

* <regex> is now okay
2019-03-28 00:21:21 -07:00
Rong Ou
8c8021dfa7 use all cores to build on linux (#4304) 2019-03-27 19:51:08 -07:00
Rory Mitchell
3f312e30db Retire DVec class in favour of c++20 style span for device memory. (#4293) 2019-03-28 13:59:58 +13:00
Jiaming Yuan
c85181dd8a Remove remaining silent and debug_verbose. (#4299) 2019-03-28 03:30:46 +08:00
Rory Mitchell
6d5b34d824 Further optimisations for gpu_hist. (#4283)
- Fuse final update position functions into a single more efficient kernel

- Refactor gpu_hist with a more explicit ellpack  matrix representation
2019-03-24 17:17:22 +13:00
Rong Ou
5aa42b5f11 jenkins build for cuda 10.0 (#4281)
* jenkins build for cuda 10.0

* yum install nccl2 for cuda 10.0
2019-03-22 22:35:18 -07:00
Philip Hyunsu Cho
263e2038e9 Bump Python version number (#4285) 2019-03-21 14:40:44 -07:00
Harry Braviner
b374e0a7ab [jvm-packages] Allow supression of Rabit output in Booster::train in xgboost4j (#4262)
* Make train in xgboost4j respect print params

Previously no setting in params argument of Booster::train would prevent
the Rabit.trackerPrint call. This can fill up a lot of screen space in
the case that many folds are being trained.
* Setting "silent" in this map to "true", "True", a non-zero integer, or
  a string that can be parsed to such an int will prevent printing.
* Setting "verbose_eval" to "False" or "false" will prevent printing.
* Setting "verbose_eval" to an int (or a String parseable to an int) n
  will result in printing every n steps, or no printing is n is zero.

This is to match the python behaviour described here:
https://www.kaggle.com/c/rossmann-store-sales/discussion/17499

* Fixed 'slient' typo in xgboost4j test

* private access on two methods
2019-03-21 18:25:12 +08:00
Nan Zhu
45c89a6792 [jvm-packages] logging version number (#4271)
* print version number

* add property file
2019-03-21 18:24:29 +08:00
Rory Mitchell
8eab966998 Allow unique prediction vector for each input matrix (#4275) 2019-03-21 11:38:16 +13:00
Jiaming Yuan
09bd9e68cf Use Monitor in quantile hist. (#4273) 2019-03-20 09:26:22 +08:00
Rory Mitchell
00465d243d Optimisations for gpu_hist. (#4248)
* Optimisations for gpu_hist.

* Use streams to overlap operations.

* ColumnSampler now uses HostDeviceVector to prevent repeatedly copying feature vectors to the device.
2019-03-20 13:30:06 +13:00
Rory Mitchell
7814183199 Fix travis R tests (#4277) 2019-03-20 12:56:04 +13:00
Nan Zhu
359ed9c5bc [jvm-packages] add configuration flag to control whether to cache transformed training set (#4268)
* control whether to cache data

* uncache
2019-03-18 10:13:28 +08:00
Jiaming Yuan
29a1356669 Deprecate reg:linear' in favor of reg:squarederror'. (#4267)
* Deprecate `reg:linear' in favor of `reg:squarederror'.
* Replace the use of `reg:linear'.
* Replace the use of `silent`.
2019-03-17 17:55:04 +08:00
Jiaming Yuan
cf8d5b9b76 Mark CUDA 10.1 as unsupported. (#4265) 2019-03-17 16:59:15 +08:00
Jiaming Yuan
fdcae024e7 Remove deprecated C APIs. (#4266) 2019-03-17 16:42:44 +08:00
Jiaming Yuan
7b1b11390a Mark Scikit-Learn RF interface as experimental in doc. (#4258)
* Mark Scikit-Learn RF interface as experimental in doc.
2019-03-16 00:45:32 +08:00
Rory Mitchell
5465b73e7c Fix multi-GPU test failures (#4259) 2019-03-15 14:40:43 +13:00
Andy Adinets
4352fcdb15 Brought the silent parameter for the SKLearn-like API back, marked it deprecated. (#4255)
* Brought the silent parameter for the SKLearn-like API back, marked it deprecated.

- added deprecation notice and warning
- removed silent from the tests for the SKLearn-like API
2019-03-14 09:45:08 +13:00
Andy Adinets
b833b642ec Improved multi-node multi-GPU random forests. (#4238)
* Improved multi-node multi-GPU random forests.

- removed rabit::Broadcast() from each invocation of column sampling
- instead, syncing the PRNG seed when a ColumnSampler() object is constructed
- this makes non-trivial column sampling significantly faster in the distributed case
- refactored distributed GPU tests
- added distributed random forests tests
2019-03-13 12:36:28 +13:00
Philip Hyunsu Cho
99a714be64 Simplify README page (#4254) 2019-03-12 11:58:08 -07:00
Jiaming Yuan
7b9043cf71 Fix clang-tidy warnings. (#4149)
* Upgrade gtest for clang-tidy.
* Use CMake to install GTest instead of mv.
* Don't enforce clang-tidy to return 0 due to errors in thrust.
* Add a small test for tidy itself.

* Reformat.
2019-03-13 02:25:51 +08:00
Tong He
259fb809e9 fix R-devel errors (#4251) 2019-03-12 10:06:54 -07:00
Andy Adinets
a36c3ed4f4 Added SKLearn-like random forest Python API. (#4148)
* Added SKLearn-like random forest Python API.

- added XGBRFClassifier and XGBRFRegressor classes to SKL-like xgboost API
- also added n_gpus and gpu_id parameters to SKL classes
- added documentation describing how to use xgboost for random forests,
  as well as existing caveats
2019-03-12 22:28:19 +08:00
jess
6fb4c5efef Activating Open Collective (#4244)
* Added backers and sponsors on the README

* Re-arrange sections

* Resize AWS logo
2019-03-11 15:36:29 -07:00
Rory Mitchell
4eeeded7d1 Remove various synchronisations from cuda API calls, instrument monitor (#4205)
* Remove various synchronisations from cuda API calls, instrument monitor
with nvtx profiler ranges.
2019-03-10 15:01:23 +13:00
Philip Hyunsu Cho
f83e62dca5 Address #4042: Prevent out-of-range access in column matrix (#4231) 2019-03-08 17:11:42 -08:00
Philip Hyunsu Cho
331cd3e4f7 Document limitation of one-split-at-a-time Greedy tree learning heuristic (#4233) 2019-03-08 10:05:39 -08:00
Jiaming Yuan
617f572c0f Update R contribute link. (#4236) 2019-03-09 01:50:07 +08:00
Philip Hyunsu Cho
20845e8ccf Broken link for NCCL: cannot use CUDA 10.1 (#4232) 2019-03-08 09:10:29 -08:00
Shaochen Shi
224786f67f [xgboost4j-spark] Allow set the parameter "maxLeaves". (#4226)
* Allow set the parameter "maxLeaves".

* Add "setMaxLeaves" to XGBoostRegressor.
2019-03-07 18:36:47 -08:00
Rong Ou
9837b09b20 support cuda 10.1 (#4223)
* support cuda 10.1

* add cuda 10.1 to jenkins build matrix
2019-03-08 12:22:12 +13:00
Rong Ou
0944360416 minor fix: log InitDataOnce() only when it is actually called (#4206) 2019-03-08 10:53:09 +13:00
Christopher Suchanek
ac3d03089b [jvm-packages] remove shutdown of handler shutdown (#4224) 2019-03-06 19:32:43 -08:00
Philip Hyunsu Cho
28bd6cde22 Add sponsors (#4222) 2019-03-06 13:11:06 -08:00
Jonas
00ea7b83c9 Fix docs for num_parallel_tree (#4221)
Minor formatting correction for `num_parallel_tree`.
2019-03-06 23:47:51 +08:00
Philip Hyunsu Cho
67c38805a1 Update build doc: PyPI wheel now support multi-GPU (#4219) 2019-03-05 13:25:31 -08:00
Nan Zhu
5f34078fba [jvm-packages] bump version for master (#4209)
* update version

* bump version
2019-03-04 23:12:24 -08:00
Philip Hyunsu Cho
3f83dcd502 Release 0.82 (#4201) 2019-03-04 18:14:36 -08:00
Adam November
0c1d5f1120 Fix snapshot artifact name in docs. (#4196) 2019-03-03 13:27:50 -08:00
Matthew Jones
92b7577c62 [REVIEW] Enable Multi-Node Multi-GPU functionality (#4095)
* Initial commit to support multi-node multi-gpu xgboost using dask

* Fixed NCCL initialization by not ignoring the opg parameter.

- it now crashes on NCCL initialization, but at least we're attempting it properly

* At the root node, perform a rabit::Allreduce to get initial sum_gradient across workers

* Synchronizing in a couple of more places.

- now the workers don't go down, but just hang
- no more "wild" values of gradients
- probably needs syncing in more places

* Added another missing max-allreduce operation inside BuildHistLeftRight

* Removed unnecessary collective operations.

* Simplified rabit::Allreduce() sync of gradient sums.

* Removed unnecessary rabit syncs around ncclAllReduce.

- this improves performance _significantly_ (7x faster for overall training,
  20x faster for xgboost proper)

* pulling in latest xgboost

* removing changes to updater_quantile_hist.cc

* changing use_nccl_opg initialization, removing unnecessary if statements

* added definition for opaque ncclUniqueId struct to properly encapsulate GetUniqueId

* placing struct defintion in guard to avoid duplicate code errors

* addressing linting errors

* removing

* removing additional arguments to AllReduer initialization

* removing distributed flag

* making comm init symmetric

* removing distributed flag

* changing ncclCommInit to support multiple modalities

* fix indenting

* updating ncclCommInitRank block with necessary group calls

* fix indenting

* adding print statement, and updating accessor in vector

* improving print statement to end-line

* generalizing nccl_rank construction using rabit

* assume device_ordinals is the same for every node

* test, assume device_ordinals is identical for all nodes

* test, assume device_ordinals is unique for all nodes

* changing names of offset variable to be more descriptive, editing indenting

* wrapping ncclUniqueId GetUniqueId() and aesthetic changes

* adding synchronization, and tests for distributed

* adding  to tests

* fixing broken #endif

* fixing initialization of gpu histograms, correcting errors in tests

* adding to contributors list

* adding distributed tests to jenkins

* fixing bad path in distributed test

* debugging

* adding kubernetes for distributed tests

* adding proper import for OrderedDict

* adding urllib3==1.22 to address ordered_dict import error

* added sleep to allow workers to save their models for comparison

* adding name to GPU contributors under docs
2019-03-02 10:03:22 +13:00
Yanbo Liang
9fefa2128d [jvm-packages] Fix early stop with xgboost4j-spark (#4176)
* Fix early stop with xgboost4j-spark

* Update XGBoost.java

* Update XGBoost.java

* Update XGBoost.java

To use -Float.MAX_VALUE as the lower bound, in case there is positive metric.

* Only update best score if the current score is better (no update when equal)

* Update xgboost-spark tutorial to fix early stopping docs.
2019-03-01 13:02:57 -08:00
Jiaming Yuan
7ea5675679 Add PushCSC for SparsePage. (#4193)
* Add PushCSC for SparsePage.

* Move Push* definitions into cc file.
* Add std:: prefix to `size_t` make clang++ happy.
* Address monitor count == 0.
2019-03-02 01:58:08 +08:00
Patrick Ford
74009afcac Added trees_to_df() method for Booster class (#4153)
* add test_parse_tree.py to tests/python

* Fix formatting

* Fix pylint error

* Ignore 'no member' error for Pandas dataframe
2019-02-26 13:28:24 -08:00
Nan Zhu
1b7405f688 [jvm-packages] fix comments in objectiveTrait (#4174) 2019-02-22 00:32:13 -08:00
Nan Zhu
dc2add96c5 [jvm-packages] upgrade spark version (#4170) 2019-02-21 11:51:36 -08:00
Rong Ou
8e0a08fbcf Update python benchmarking script (#4164)
* a few tweaks to speed up data generation

* del variable to save memory

* switch to random numpy arrays
2019-02-21 15:16:09 +13:00
Abhai Kollara Dilip
54793544a2 Update README.rst (#4167)
Fixes error when copy pasting.
2019-02-20 14:46:56 -08:00
Philip Hyunsu Cho
2aaae2e7bb Fix #4163: always copy sliced data (#4165)
* Revert "Accept numpy array view. (#4147)"

This reverts commit a985a99cf0.

* Fix #4163: always copy sliced data

* Remove print() from the test; check shape equality

* Check if 'base' attribute exists

* Fix lint

* Address reviewer comment

* Fix lint
2019-02-20 14:46:34 -08:00
Jiaming Yuan
cecbe0cf71 Fix test_gpu_coordinate. (#3974)
* Fix test_gpu_coordinate.

* Use `gpu_coord_descent` in test.
* Reduce number of running rounds.

* Remove nthread.

* Use githubusercontent for r-appveyor.

* Use githubusercontent in travis r tests.
2019-02-19 14:09:10 -08:00
Rory Mitchell
c8c472f39a Fix incorrect device in multi-GPU algorithm (#4161) 2019-02-20 09:23:15 +13:00
Nan Zhu
1dac5e2410 more correct way to build node stats in distributed fast hist (#4140)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* more changes

* temp

* update

* udpate rabit

* change the histogram

* update kfactor

* sync per node stats

* temp

* update

* final

* code clean

* update rabit

* more cleanup

* fix errors

* fix failed tests

* enforce c++11

* broadcast subsampled feature correctly

* init col

* temp

* col sampling

* fix histmastrix init

* fix col sampling

* remove cout

* fix out of bound access

* fix core dump

remove core dump file

* update

* add fid

* update

* revert some changes

* temp

* temp

* pass all tests

* bring back some tests

* recover some changes

* fix lint issue

* enable monotone and interaction constraints

* don't specify default for monotone and interactions

* recover column init part

* more recovery

* fix core dumps

* code clean

* revert some changes

* fix test compilation issue

* fix lint issue

* resolve compilation issue

* fix issues of lint caused by rebase

* fix stylistic changes and change variable names

* modularize depth width

* address the comments

* fix failed tests

* wrap perf timers with class

* temp

* pass all lossguide

* pass tests

* add comments

* more changes

* use separate flow for single and tests

* add test for lossguide hist

* remove duplications

* syncing stats for only once

* recover more changes

* recover more changes

* fix root-stats

* simplify code

* remove outdated comments
2019-02-18 13:45:30 -08:00
Jiaming Yuan
a985a99cf0 Accept numpy array view. (#4147)
* Accept array view (slice) in metainfo.
2019-02-18 22:21:34 +08:00
Jiaming Yuan
0ff84d950e Upgrade rabit. (#4159) 2019-02-18 22:16:58 +08:00
Kenichi Nagahara
60f05352c5 Fix typo in demo (#4156) 2019-02-18 18:42:41 +08:00
Philip Hyunsu Cho
549c8d6ae9 Prevent empty quantiles in fast hist (#4155)
* Prevent empty quantiles

* Revise and improve unit tests for quantile hist

* Remove unnecessary comment

* Add #2943 as a test case

* Skip test if no sklearn

* Revise misleading comments
2019-02-17 16:01:07 -08:00
Jiaming Yuan
e1240413c9 Fix gpu_hist apply_split test. (#4158) 2019-02-18 02:48:28 +08:00
Jiaming Yuan
2e618af743 Fix cpplint. (#4157)
* Add comment after #endif.
* Add missing headers.
2019-02-18 00:16:29 +08:00
Rory Mitchell
71a604fae3 Fix for windows compilation (#4139) 2019-02-17 19:42:32 +13:00
Jiaming Yuan
1fe874e58a Fix empty subspan. (#4151)
* Silent the death tests.
2019-02-17 04:48:03 +08:00
Pasha Stetsenko
ff2d4c99fa Update datatable usage (#4123) 2019-02-17 03:44:09 +08:00
Jiaming Yuan
754fe8142b Make `HistCutMatrix::Init' be aware of groups. (#4115)
* Add checks for group size.
* Simple docs.
* Search group index during hist cut matrix initialization.

Co-authored-by: Jiaming Yuan <jm.yuan@outlook.com>
Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
2019-02-16 04:39:41 +08:00
Philip Hyunsu Cho
37ddfd7d6e Fix broken R test: Install Homebrew GCC (#4142)
* Fix broken R test: Install Homebrew GCC

Missing GCC Fortran causes installation failure of a dependency package
(igraph)

* Register gfortran system-wide

* Use correct keg

* Set env vars to change compiler choice

* Do not break other Mac builds

* Nuclear option: symlink gfortran

* Use /usr/local/bin instead of /usr/bin

* Symlink library path too

* Update run_test.sh
2019-02-15 07:23:05 -08:00
Rong Ou
d506a8bc63 [jvm-packages] add verbosity param (#4138) 2019-02-13 20:57:17 -08:00
Nan Zhu
c18a3660fa Separate Depthwidth and Lossguide growing policy in fast histogram (#4102)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* init

* more changes

* temp

* update

* udpate rabit

* change the histogram

* update kfactor

* sync per node stats

* temp

* update

* final

* code clean

* update rabit

* more cleanup

* fix errors

* fix failed tests

* enforce c++11

* broadcast subsampled feature correctly

* init col

* temp

* col sampling

* fix histmastrix init

* fix col sampling

* remove cout

* fix out of bound access

* fix core dump

remove core dump file

* disbale test temporarily

* update

* add fid

* print perf data

* update

* revert some changes

* temp

* temp

* pass all tests

* bring back some tests

* recover some changes

* fix lint issue

* enable monotone and interaction constraints

* don't specify default for monotone and interactions

* recover column init part

* more recovery

* fix core dumps

* code clean

* revert some changes

* fix test compilation issue

* fix lint issue

* resolve compilation issue

* fix issues of lint caused by rebase

* fix stylistic changes and change variable names

* use regtree internal function

* modularize depth width

* address the comments

* fix failed tests

* wrap perf timers with class

* fix lint

* fix num_leaves count

* fix indention

* Update src/tree/updater_quantile_hist.cc

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>

* Update src/tree/updater_quantile_hist.h

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>

* Update src/tree/updater_quantile_hist.cc

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>

* Update src/tree/updater_quantile_hist.cc

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>

* Update src/tree/updater_quantile_hist.cc

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>

* Update src/tree/updater_quantile_hist.h

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>

* merge

* fix compilation
2019-02-13 12:56:19 -08:00
Rong Ou
3be1b9ae30 reformat benchmark_tree.py to get rid of lint errors (#4126) 2019-02-13 18:54:56 +13:00
Rong Ou
9b917cda4f [jvm-packages] fix simple logic error :) (#4128)
@CodingCat
2019-02-11 21:47:30 -08:00
Philip Hyunsu Cho
99a290489c Update Python docstring for ranking functions (#4121)
* Update Python docstring for ranking functions

* Fix formatting
2019-02-10 12:22:02 -08:00
Nan Zhu
3320a52192 [jvm-packages] force use per-group weights in spark layer (#4118) 2019-02-10 05:38:03 +08:00
Yuan (Terry) Tang
ba584e5e9f Add link to InfoWorld 2019 award (#4116) 2019-02-08 12:43:23 -08:00
Rong Ou
2a9b085bc8 [jvm-packages] minor fix of params (#4114) 2019-02-08 00:21:59 -08:00
Jiaming Yuan
f8ca2960fc Use nccl group calls to prevent from dead lock. (#4113)
* launch all reduce sequentially.
* Fix gpu_exact test memory leak.
2019-02-08 06:12:39 +08:00
Nan Zhu
05243642bb [jvm-packages] better fix for shutdown applications (#4108)
* intentionally failed task

* throw exception

* more

* stop sparkcontext directly

* stop from another thread

* new scope

* use a new thread

* daemon threads

* don't join the killer thread

* remove injected errors

* add comments
2019-02-07 09:02:17 -08:00
Jiaming Yuan
017c97b8ce Clean up training code. (#3825)
* Remove GHistRow, GHistEntry, GHistIndexRow.
* Remove kSimpleStats.
* Remove CheckInfo, SetLeafVec in GradStats and in SKStats.
* Clean up the GradStats.
* Cleanup calcgain.
* Move LossChangeMissing out of common.
* Remove [] operator from GHistIndexBlock.
2019-02-07 14:22:13 +08:00
Nan Zhu
325b16bccd [jvm-packages] fix return type of setEvalSets (#4105) 2019-02-06 11:00:29 -08:00
Nan Zhu
ae3bb9c2d5 Distributed Fast Histogram Algorithm (#4011)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* init

* allow hist algo

* more changes

* temp

* update

* remove hist sync

* udpate rabit

* change hist size

* change the histogram

* update kfactor

* sync per node stats

* temp

* update

* final

* code clean

* update rabit

* more cleanup

* fix errors

* fix failed tests

* enforce c++11

* fix lint issue

* broadcast subsampled feature correctly

* revert some changes

* fix lint issue

* enable monotone and interaction constraints

* don't specify default for monotone and interactions

* update docs
2019-02-05 05:12:53 -08:00
Jiaming Yuan
8905df4a18 Perform clang-tidy on both cpp and cuda source. (#4034)
* Basic script for using compilation database.

* Add `GENERATE_COMPILATION_DATABASE' to CMake.
* Rearrange CMakeLists.txt.
* Add basic python clang-tidy script.
* Remove modernize-use-auto.
* Add clang-tidy to Jenkins
* Refine logic for correct path detection

In Jenkins, the project root is of form /home/ubuntu/workspace/xgboost_PR-XXXX

* Run clang-tidy in CUDA 9.2 container
* Use clang_tidy container
2019-02-05 16:07:43 +08:00
Jiaming Yuan
1088dff42c Prevent training without setting up caches. (#4066)
* Prevent training without setting up caches.

* Add warning for internal functions.
* Check number of features.

* Address reviewer's comment.
2019-02-03 01:03:29 -08:00
Philip Hyunsu Cho
7a652a8c64 Speed up Jenkins by not compiling CMake (#4099) 2019-02-03 00:08:14 -08:00
tmitanitky
59f868bc60 enable xgb_model in scklearn XGBClassifier and test. (#4092)
* Enable xgb_model parameter in XGClassifier scikit-learn API

https://github.com/dmlc/xgboost/issues/3049

* add test_XGBClassifier_resume():

test for xgb_model parameter in XGBClassifier API.

* Update test_with_sklearn.py

* Fix lint
2019-01-31 11:29:19 -08:00
Nan Zhu
0d0ce32908 [jvm-packages] adding logs for parameters (#4091) 2019-01-30 21:50:55 -08:00
Philip Hyunsu Cho
a60e224484 Add Jenkins status badge (#4090) 2019-01-30 14:03:18 -08:00
Nan Zhu
e0094d996e fix doc about max_depth (#4078)
* fix doc

* Update doc/parameter.rst

Co-Authored-By: CodingCat <CodingCat@users.noreply.github.com>
2019-01-30 12:53:44 -08:00
Philip Hyunsu Cho
a1c35cadf0 Fix failing Travis CI on Mac (#4086)
* Fix failing Travis CI on Mac

Use Homebrew Addon + latest Mac image

* Use long command for pytest

* Downgrade OSX image to xcode9.3, to use Java 8

* Install pytest in Python 2 environment

* Remove clang-tidy from Travis
2019-01-30 09:43:57 -08:00
Jiaming Yuan
4fac9874e0 Check booster for dart in feature importance. (#4073)
* Check booster for dart in feature importance.
2019-01-22 16:03:54 +08:00
Jiaming Yuan
301cef4638 Correct JVM CMake GPU flag. (#4071) 2019-01-21 20:36:38 +08:00
Rory Mitchell
1fc37e4749 Require leaf statistics when expanding tree (#4015)
* Cache left and right gradient sums

* Require leaf statistics when expanding tree
2019-01-17 21:12:20 -08:00
Andy Adinets
0f8af85f64 Fixed single-GPU tests. (#4053)
- ./testxgboost (without filters) failed if run on a multi-GPU machine because
  the memory was allocated on the current device, but device 0
  was always passed into LaunchN
2019-01-11 09:33:15 +02:00
Egor Smirnov
5f151c5cf3 Performance optimizations for Intel CPUs (#3957)
* Initial performance optimizations for xgboost

* remove includes

* revert float->double

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* fix for CI

* Check existence of _mm_prefetch and __builtin_prefetch

* Fix lint
2019-01-08 21:08:13 -08:00
KyleLi1985
dade7c3aff [jvm-packages] Performance consideration and Alignment input parameter of repartition function (#4049) 2019-01-07 08:38:05 -08:00
Nan Zhu
773ddbcfcb [BLOCKING] fix the issue with infrequent feature (#4045)
* fix the issue with infrequent feature

* handle exception

* use only 2 workers

* address the comments
2019-01-06 16:01:03 -08:00
Nan Zhu
e290ec9a80 [jvm-packages] fix safe execution (#4046) 2019-01-05 19:45:37 -08:00
Kodi Arfer
6a569b8cd9 Avoid generating NaNs in UnwoundPathSum (#3943)
* Avoid generating NaNs in UnwoundPathSum.

Kudos to Jakub Zakrzewski for tracking down the bug.

* Add a test
2019-01-03 15:04:46 -08:00
Jiaming Yuan
55bc149efb Fix sparse page segfault. (#4040)
* Remove usage of raw pointers in SparsePageSource.
2019-01-03 23:40:40 +08:00
Shayak Banerjee
431c850c03 [jvm-packages] Updates to Java Booster to support other feature importance measures (#3801)
* Updates to Booster to support other feature importances

* Add returns for Java methods

* Pass Scala style checks

* Pass Java style checks

* Fix indents

* Use class instead of enum

* Return map string double

* A no longer broken build, thanks to mvn package local build

* Add a unit test to increase code coverage back

* Address code review on main code

* Add more unit tests for different feature importance scores

* Address more CR
2019-01-02 01:13:14 -08:00
Jiaming Yuan
1f022929f4 Use Span in gpu coordinate. (#4029)
* Use Span in gpu coordinate.

* Use Span in device code.
* Fix shard size calculation.
  - Use lower_bound instead of upper_bound.
* Check empty devices.
2019-01-02 11:32:43 +08:00
Nan Zhu
f368d0de2b [jvm-packages] fix the scalability issue of prediction (#4033) 2018-12-29 20:46:30 -08:00
Tatsuhito KATO
15fe2f1e7c fix typos (#4027) 2018-12-28 00:36:47 +08:00
Jiaming Yuan
be948df23f Fix ignoring dart in updater configuration. (#4024)
* Fix ignoring dart in updater configuration.
2018-12-26 18:24:45 +08:00
Jiaming Yuan
9897b5042f Use Span in GPU exact updater. (#4020)
* Use Span in GPU exact updater.

* Add a small test.
2018-12-26 12:44:46 +08:00
Jiaming Yuan
7735252925 Document num_parallel_tree. (#4022) 2018-12-25 22:00:58 +08:00
Jiaming Yuan
85939c6a6e Merge duplicated linear updater parameters. (#4013)
* Merge duplicated linear updater parameters.

* Split up coordinate descent parameter.
2018-12-22 13:21:49 +08:00
Rory Mitchell
f75a21af25 Reduce tree expand boilerplate code (#4008) 2018-12-20 15:52:28 +13:00
Rory Mitchell
84c99f86f4 Combine TreeModel and RegTree (#3995) 2018-12-19 12:16:40 +13:00
Nan Zhu
c055a32609 [jvm-packages]support multiple validation datasets in Spark (#3910)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* wrap iterators

* enable copartition training and validationset

* add parameters

* converge code path and have init unit test

* enable multi evals for ranking

* unit test and doc

* update example

* fix early stopping

* address the offline comments

* udpate doc

* test eval metrics

* fix compilation issue

* fix example
2018-12-17 21:03:57 -08:00
Jiaming Yuan
c8c7b9649c Fix and optimize logger (#4002)
* Fix logging switch statement.

* Remove debug_verbose_ in AllReducer.

* Don't construct the stream when not needed.

* Make default constructor deleted.

* Remove redundant IsVerbose.
2018-12-17 19:23:05 +08:00
Sam Wilkinson
a2dc929598 Update CONTRIBUTORS.md (#3999) 2018-12-15 18:10:52 +08:00
Andy Adinets
42bf90eb8f Column sampling at individual nodes (splits). (#3971)
* Column sampling at individual nodes (splits).

* Documented colsample_bynode parameter.

- also updated documentation for colsample_by* parameters

* Updated documentation.

* GetFeatureSet() returns shared pointer to std::vector.

* Sync sampled columns across multiple processes.
2018-12-14 22:37:35 +08:00
Jiaming Yuan
e0a279114e Unify logging facilities. (#3982)
* Unify logging facilities.

* Enhance `ConsoleLogger` to handle different verbosity.
* Override macros from `dmlc`.
* Don't use specialized gamma when building with GPU.
* Remove verbosity cache in monitor.
* Test monitor.
* Deprecate `silent`.
* Fix doc and messages.
* Fix python test.
* Fix silent tests.
2018-12-14 19:29:58 +08:00
Sam Wilkinson
fd722d60cd Deprecation warning for lists passed into DMatrix (#3970)
* Ensure lists cannot be passed into DMatrix

The documentation does not include lists as an allowed type for the data inputted into DMatrix. Despite this, a list can be passed in without an error. This change would prevent a list form being passed in directly.
2018-12-14 19:26:11 +08:00
lyxthe
53f695acf2 scikit-learn api section documentation correction (#3967)
* update description of early stopping rounds

the description of early stopping round was quite inconsistent in the scikit-learn api section since the fit paragraph tells that when early stopping rounds occurs, the last iteration is returned not the best one, but the predict paragraph tells that when the predict is called without ntree_limit specified, then ntree_limit is equals to best_ntree_limit.

Thus, when reading the fit part, one could think that it is needed to specify what is the best iter when calling the predict, but when reading the predict part, then the best iter is given by default, it is the last iter that you have to specify if needed.

* Update sklearn.py

* Update sklearn.py

fix doc according to the python_lightweight_test error
2018-12-14 00:27:04 -08:00
Rory Mitchell
3d81c48d3f Remove leaf vector, add tree serialisation test, fix Windows tests (#3989) 2018-12-13 10:28:38 +13:00
Tong He
84a3af8dc0 Fix CRAN check warnings/notes (#3988)
* fix

* reorder declaration to match initialization
2018-12-12 08:23:20 -06:00
Andy Adinets
4be5edaf92 Initialized AllReducer counters to 0. (#3987) 2018-12-12 09:09:20 +13:00
Rory Mitchell
93f9ce9ef9 Single precision histograms on GPU (#3965)
* Allow single precision histogram summation in gpu_hist

* Add python test, reduce run-time of gpu_hist tests

* Update documentation
2018-12-10 10:55:30 +13:00
Philip Hyunsu Cho
9af6b689d6 Use int instead of char in CLI config parser (#3976) 2018-12-07 01:00:21 -08:00
Philip Hyunsu Cho
4f26053b09 Fix typo in Feature Interaction Constraints tutorial (#3975) 2018-12-06 19:38:40 -08:00
Jiaming Yuan
48dddfd635 Porting elementwise metrics to GPU. (#3952)
* Port elementwise metrics to GPU.

* All elementwise metrics are converted to static polymorphic.
* Create a reducer for metrics reduction.
* Remove const of Metric::Eval to accommodate CubMemory.
2018-12-01 18:46:45 +13:00
Rory Mitchell
a9d684db18 GPU performance logging/improvements (#3945)
- Improved GPU performance logging

- Only use one execute shards function

- Revert performance regression on multi-GPU

- Use threads to launch NCCL AllReduce
2018-11-29 14:36:51 +13:00
Philip Hyunsu Cho
c5f92df475 Disable retries in Jenkins CI, since we're now using On-Demand instances instead of Spot (#3948) 2018-11-28 14:57:09 -08:00
Philip Hyunsu Cho
c5130e487a Fix #3894: Allow loading pickles without self.booster attributes (redux) (#3944) 2018-11-28 09:31:46 -08:00
Nan Zhu
9c4ff50e83 [jvm-packages]Fix early stopping condition (#3928)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* update version

* 0.82

* fix early stopping condition

* remove unused

* update comments

* udpate comments

* update test
2018-11-24 00:18:07 -08:00
Huafeng Wang
42cac4a30b [jvm-packages] Fix vector size of 'rawPredictionCol' in XGBoostClassificationModel (#3932)
* Fix vector size of 'rawPredictionCol' in XGBoostClassificationModel

* Fix UT
2018-11-23 21:09:43 -08:00
Philip Hyunsu Cho
f9302a56fb Fix #3894: Allow loading pickles without self.booster attributes (#3938)
The addition of self.booster attribute broke backward compatibility.
2018-11-23 12:15:50 -08:00
Philip Hyunsu Cho
7d3149a21f Add AUC-PR to list of metrics to maximize for early stopping (#3936) 2018-11-23 12:15:34 -08:00
Philip Hyunsu Cho
86aac98e54 [jvm-packages] Fix #3898: use correct group ID for maven-site-plugin (#3937) 2018-11-23 09:46:27 -08:00
Philip Hyunsu Cho
e9ab4a1c6c Address #3933: document limitation of DMLC CSV parser + recommend Pandas (#3934) 2018-11-23 04:13:36 -08:00
Nan Zhu
dc2bfbfde1 [jvm-packages] update version to 0.82-SNAPSHOT (#3920)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* update version

* 0.82
2018-11-18 16:47:48 -08:00
Prabakaran Kumaresshan
7ebe8dcf5b Fix link in binary classification demo README.md (#3918) (#3919) 2018-11-18 00:35:35 -08:00
Philip Hyunsu Cho
973fc8b1ff Use consistent type for sharding GPU data in GPU coordinate updater (#3917)
* Use consistent type for sharding GPU data in GPU coordinate updater

* Use fast integer ceiling trick
2018-11-18 00:20:00 -08:00
Jiaming Yuan
93f63324e6 Address deprecation of Python ABC. (#3909) 2018-11-16 19:43:32 +13:00
Nan Zhu
aa48b7e903 [jvm-packages][refactor] refactor XGBoost.scala (spark) (#3904)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* wrap iterators

* remove unused code

* refactor

* fix typo
2018-11-15 20:38:28 -08:00
Joey Gao
0cd326c1bc Add parameter to make node type configurable in plot tree (#3859)
* add parameters 'conditionNodeParams' and 'leafNodeParams' to function `to_graphviz` enable to configure node type
2018-11-16 17:29:37 +13:00
Philip Hyunsu Cho
3a150742c7 Update dmlc-core submodule (#3907) 2018-11-15 18:50:49 -08:00
theycallhimavi
0a0d4239d3 Fix Typo in learner.cc (#3902) 2018-11-16 12:54:36 +13:00
Jiaming Yuan
fe999bf968 Add back python2 tests for Travis light weight tests. (#3901) 2018-11-15 22:17:35 +13:00
Jiaming Yuan
2ea0f887c1 Refactor Python tests. (#3897)
* Deprecate nose tests.
* Format python tests.
2018-11-15 13:56:33 +13:00
Philip Hyunsu Cho
c76d993681 Enforce naming style in Python lint (#3896) 2018-11-14 10:35:25 -08:00
Philip Hyunsu Cho
a2a8954659 Update dmlc-core submodule (#3891) 2018-11-14 01:51:27 -08:00
Rory Mitchell
7af0946ac1 Improve update position function for gpu_hist (#3895) 2018-11-14 19:33:29 +13:00
Dr. Kashif Rasul
143475b27b use gain for sklearn feature_importances_ (#3876)
* use gain for sklearn feature_importances_

`gain` is a better feature importance criteria than the currently used `weight`

* added importance_type to class

* fixed test

* white space

* fix variable name

* fix deprecation warning

* fix exp array

* white spaces
2018-11-13 03:30:40 -08:00
Rory Mitchell
926eb651fe Minor refactor of split evaluation in gpu_hist (#3889)
* Refactor evaluate split into shard

* Use span in evaluate split

* Update google tests
2018-11-14 00:11:20 +13:00
Jiaming Yuan
daf77ca7b7 Enable running objectives with 0 GPU. (#3878)
* Enable running objectives with 0 GPU.

* Enable 0 GPU for objectives.
* Add doc for GPU objectives.
* Fix some objectives defaulted to running on all GPUs.
2018-11-13 20:19:59 +13:00
Jiaming Yuan
97984f4890 Fix gpu coordinate running on multi-gpu. (#3893) 2018-11-13 19:09:55 +13:00
ajing
0ddb8a7661 Update README.md (#3872)
SparkWithDataFrame was not there anymore. So replace with SparkMLlibPipeline.scala
2018-11-12 11:03:13 -08:00
Jiacheng Xu
d810e6dec9 Fix a typo in the R-package documentation: max.deph -> max.depth (#3890)
Signed-off-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com>
2018-11-12 01:43:23 -08:00
Philip Hyunsu Cho
be0bb7dd90 Remove unnecessary warning when 'gblinear' is selected (#3888) 2018-11-09 12:30:38 -08:00
Philip Hyunsu Cho
e38d5a6831 Document current limitation in number of features (#3886) 2018-11-09 00:32:43 -08:00
Philip Hyunsu Cho
828d75714d Fix #3857: take down AWS YARN tutorial, as it is outdated (#3885) 2018-11-08 23:08:32 -08:00
Philip Hyunsu Cho
ad6e0d55f1 Fix coef_ and intercept_ signature to be compatible with sklearn.RFECV (#3873)
* Fix coef_ and intercept_ signature to be compatible with sklearn.RFECV

* Fix lint

* Fix lint
2018-11-08 19:41:35 -08:00
Jiaming Yuan
19ee0a3579 Refactor fast-hist, add tests for some updaters. (#3836)
Add unittest for prune.

Add unittest for refresh.

Refactor fast_hist.

* Remove fast_hist_param.
* Rename to quantile_hist.

Add unittests for QuantileHist.

* Refactor QuantileHist into .h and .cc file.
* Remove sync.h.
* Remove MGPU_mock test.

Rename fast hist method to quantile hist.
2018-11-07 21:15:07 +13:00
Philip Hyunsu Cho
2b045aa805 Make C++ unit tests run and pass on Windows (#3869)
* Make C++ unit tests run and pass on Windows

* Fix logic for external memory. The letter ':' is part of drive letter,
so remove the drive letter before splitting on ':'.
* Cosmetic syntax changes to keep MSVC happy.

* Fix lint

* Add Windows guard
2018-11-06 17:17:24 -08:00
Jelle Zijlstra
d9642cf757 handle $PATH not being set in python library (#3845)
Fixes #3844
2018-11-06 15:27:02 -08:00
Nikita Titov
1bf4083dc6 open README with utf-8 and add gcc-8 (#3867) 2018-11-06 14:53:33 -08:00
Philip Hyunsu Cho
20d5abf919 Disallow std::regex since it's not supported by GCC 4.8.x (#3870) 2018-11-05 22:57:04 -08:00
Jiaming Yuan
f1275f52c1 Fix specifying gpu_id, add tests. (#3851)
* Rewrite gpu_id related code.

* Remove normalised/unnormalised operatios.
* Address difference between `Index' and `Device ID'.
* Modify doc for `gpu_id'.
* Better LOG for GPUSet.
* Check specified n_gpus.
* Remove inappropriate `device_idx' term.
* Clarify GpuIdType and size_t.
2018-11-06 18:17:53 +13:00
Jiaming Yuan
1698fe64bb Document GPU objectives in NEWS. (#3865) 2018-11-05 14:46:45 +13:00
Philip Hyunsu Cho
91cc14ea70 Add another contributor for rabit update 2018-11-04 10:29:21 -08:00
Philip Hyunsu Cho
78ec77fa97 Release 0.81 version (#3864)
* Release 0.81 version

* Update NEWS.md
2018-11-04 05:49:11 -08:00
Philip Hyunsu Cho
c22e90d5d2 Correct typo 2018-11-04 05:22:53 -08:00
Philip Hyunsu Cho
6da462234e Move MinGW-w64 + Python section to the end, since it's 'advanced' (#3863) 2018-11-04 05:12:27 -08:00
Philip Hyunsu Cho
a650131fc3 Update doc: colsample_bylevel now works for tree_method=hist (#3862)
This feature was introduced by #3635
2018-11-04 02:25:25 -08:00
Philip Hyunsu Cho
91537e7353 Fix #3342 and h2oai/h2o4gpu#625: Save predictor parameters in model file (#3856)
* Fix #3342 and h2oai/h2o4gpu#625: Save predictor parameters in model file

This allows pickled models to retain predictor attributes, such as
'predictor' (whether to use CPU or GPU) and 'n_gpu' (number of GPUs
to use). Related: h2oai/h2o4gpu#625

Closes #3342.

TODO. Write a test.

* Fix lint

* Do not load GPU predictor into CPU-only XGBoost

* Add a test for pickling GPU predictors

* Make sample data big enough to pass multi GPU test

* Update test_gpu_predictor.cu
2018-11-03 21:45:38 -07:00
Philip Hyunsu Cho
e04ab56b57 Fix #3747: Add coef_ and intercept_ as properties of sklearn wrapper (#3855)
* Fix #3747: Add coef_ and intercept_ as properties of sklearn wrapper

Scikit-learn expects linear learners to expose `coef_` and `intercept_`
as properties.

Closes #3747.

* Fix lint
2018-11-02 01:44:37 -07:00
Philip Hyunsu Cho
ad68865d6b [Blocking] Fix #3840: Clean up logic for parsing tree_method parameter (#3849)
* Clean up logic for converting tree_method to updater sequence

* Use C++11 enum class for extra safety

Compiler will give warnings if switch statements don't handle all
possible values of C++11 enum class.

Also allow enum class to be used as DMLC parameter.

* Fix compiler error + lint

* Address reviewer comment

* Better docstring for DECLARE_FIELD_ENUM_CLASS

* Fix lint

* Add C++ test to see if tree_method is recognized

* Fix clang-tidy error

* Add test_learner.h to R package

* Update comments

* Fix lint error
2018-11-01 19:33:35 -07:00
Philip Hyunsu Cho
583c88bce7 [jvm-packages] Require vanilla Apache Spark (#3854) 2018-11-01 19:15:40 -07:00
Philip Hyunsu Cho
2febc105a4 [jvm-packages] Fix JVM doc build (#3853)
To get around of the bug https://issues.apache.org/jira/browse/SUREFIRE-1588,
set useSystemClassLoader=false.
2018-11-01 15:16:08 -07:00
Jonathan Friedman
45d321da28 Fix typo in docs (#3852)
Fix typo in docs
2018-11-01 13:03:59 -07:00
Philip Hyunsu Cho
411df9f878 Test wheels on CUDA 10.0 container for compatibility (#3838) 2018-11-01 08:34:47 -07:00
Rory Mitchell
42200ec03e Allow XGBRanker sklearn interface to use other xgboost ranking objectives (#3848) 2018-11-01 13:34:25 +13:00
Chen Qin
87f49995be update rabit (#3835) 2018-10-30 09:15:19 -07:00
Zhao Hang
e3c1afac6b Update parameter.rst (#3843) 2018-10-31 00:19:45 +13:00
Matthew Tovbin
d81fedb955 [jvm-packages] RabitTracker for Scala: allow specifying host ip from the xgboost-tracker.properties file (#3833) 2018-10-26 22:01:36 -07:00
Nan Zhu
5fbe230636 [jvm-packages] documenting tracker (#3831)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* documenting tracker

* Make it a separate note
2018-10-25 18:53:46 -07:00
Philip Hyunsu Cho
d83c818000 Recommend pickling as the way to save XGBClassifier / XGBRegressor / XGBRanker (#3829)
The `save_model()` and `load_model()` method only saves the part of the model
that's common to all language interfaces and do not preserve Python-specific
attributes, such as `feature_names`. More crucially, label encoder is not
preserved either; this is needed for the scikit-learn wrapper, since you may
have string labels.

Fix: Explicitly recommend pickling as the way to save scikit-learn model
objects.
2018-10-25 11:12:41 -07:00
Andy Adinets
2a59ff2f9b Multi-GPU support in GPUPredictor. (#3738)
* Multi-GPU support in GPUPredictor.

- GPUPredictor is multi-GPU
- removed DeviceMatrix, as it has been made obsolete by using HostDeviceVector in DMatrix

* Replaced pointers with spans in GPUPredictor.

* Added a multi-GPU predictor test.

* Fix multi-gpu test.

* Fix n_rows < n_gpus.

* Reinitialize shards when GPUSet is changed.
* Tests range of data.

* Remove commented code.

* Remove commented code.
2018-10-23 22:59:11 -07:00
Bruno Tremblay
32de54fdee Update R-package/R/xgb.ggplot.R (#3820)
Changed width parameter of var important ggplot from 0.05 to 0.5 to make it more visible when displaying more variables.
2018-10-23 20:52:33 -07:00
Philip Hyunsu Cho
02130af47d Enable auto-locking of issues closed long ago (#3821)
* Enable auto-locking of issues closed long ago

Issues that were closed more than 90 days ago will be locked automatically so
that no additional comments would be allowed. We will use a bot to do
this: https://probot.github.io/apps/lock/

Background: As a maintainer, I often see people leaving comments to old issue
posts that were closed long ago. Those comments are hard to discover and assist
with, since they get buried under list of other active issues.

With the change, users who want to follow up with an old issue would be asked
to file a new issue.

* Exempt `feature-request` from auto locking

* Disable comment to avoid triggering notification
2018-10-23 19:21:58 -07:00
Nan Zhu
4ae225a08d [Blocking][jvm-packages] fix the early stopping feature (#3808)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* temp

* add method for classifier and regressor

* update tutorial

* address the comments

* update
2018-10-23 14:53:13 -07:00
Philip Hyunsu Cho
e26b5d63b2 [jvm-packages] Upgrade Scala to 2.11.12 to address CVE-2017-15288 (#3816)
A privilege escalation vulnerability (CVE-2017-15288) has been
identified in the Scala compilation daemon. See
https://nvd.nist.gov/vuln/detail/CVE-2017-15288

Fix: Upgrade Scala to 2.11.12.
2018-10-22 10:15:30 -07:00
Philip Hyunsu Cho
abf2f661be Fix #3708: Use dmlc::TemporaryDirectory to handle temporaries in cross-platform way (#3783)
* Fix #3708: Use dmlc::TemporaryDirectory to handle temporaries in cross-platform way

Also install git inside NVIDIA GPU container

* Update dmlc-core
2018-10-18 10:16:04 -07:00
Philip Hyunsu Cho
55ee9a92a1 Fix Python environment for distributed unit tests (#3806) 2018-10-18 00:12:02 -07:00
Philip Hyunsu Cho
b38c636d05 Fix #3523: Fix CustomGlobalRandomEngine for R (#3781)
**Symptom** Apple Clang's implementation of `std::shuffle` expects doesn't work
correctly when it is run with the random bit generator for R package:
```cpp
CustomGlobalRandomEngine::result_type
CustomGlobalRandomEngine::operator()() {
  return static_cast<result_type>(
      std::floor(unif_rand() * CustomGlobalRandomEngine::max()));
}
```

Minimial reproduction of failure (compile using Apple Clang 10.0):
```cpp
std::vector<int> feature_set(100);
std::iota(feature_set.begin(), feature_set.end(), 0);
    // initialize with 0, 1, 2, 3, ..., 99
std::shuffle(feature_set.begin(), feature_set.end(), common::GlobalRandom());
    // This returns 0, 1, 2, ..., 99, so content didn't get shuffled at all!!!
```

Note that this bug is platform-dependent; it does not appear when GCC or
upstream LLVM Clang is used.

**Diagnosis** Apple Clang's `std::shuffle` expects 32-bit integer
inputs, whereas `CustomGlobalRandomEngine::operator()` produces 64-bit
integers.

**Fix** Have `CustomGlobalRandomEngine::operator()` produce 32-bit integers.

Closes #3523.
2018-10-15 09:39:13 -07:00
Philip Hyunsu Cho
4302fc4027 Update committer list (#3788)
* Update committer list

* Update CONTRIBUTORS.md

* Minor format fix
2018-10-14 23:41:03 -07:00
Rory Mitchell
f00fd87b36 Address #2754, accuracy issues with gpu_hist (#3793)
* Address windows compilation error

* Do not allow divide by zero in weight calculation

* Update tests
2018-10-15 17:50:31 +13:00
trivialfis
516457fadc Add basic unittests for gpu-hist method. (#3785)
* Split building histogram into separated class.
* Extract `InitCompressedRow` definition.
* Basic tests for gpu-hist.
* Document the code more verbosely.
* Removed `HistCutUnit`.
* Removed some duplicated copies in `GPUHistMaker`.
* Implement LCG and use it in tests.
2018-10-15 15:47:00 +13:00
trivialfis
184efff9f9 Remove NoConstraint. (#3792) 2018-10-15 15:43:06 +13:00
Rory Mitchell
5d6baed998 Allow sklearn grid search over parameters specified as kwargs (#3791) 2018-10-14 12:44:53 +13:00
Juzer Shakir
1db28b8718 Typo fixed (#3784)
The word 'make' was been repeated twice, fixed to single.
2018-10-10 10:23:27 -07:00
KOLANICH
5480e05173 Added some instructions on using MinGW-built XGBoost with python. (#3774)
* Added some instructions on using MinGW-built XGBoost with python.

* Changes according to the discussion and some additions

* Fixed wording and removed redundancy.

* Even more fixes

* Fixed links. Removed redundancy.

* Some fixes according to the discussion

* fixes

* Some fixes

* fixes
2018-10-09 09:07:00 -07:00
weitian
9504f411c1 [jvm-packages] For training data with group, empty RDD partition threw exception (#3749) (#3750) 2018-10-09 09:03:22 -07:00
Philip Hyunsu Cho
ca33bf6476 Document gblinear parameters: feature_selector and top_k (#3780) 2018-10-08 22:41:54 -07:00
Philip Hyunsu Cho
133b8d94df Fix Jenkins syntax (#3777) 2018-10-08 14:56:42 -07:00
Philip Hyunsu Cho
11eaf3eed1 Retry Jenkins CI tests up to 3 times to improve reliability (redux) (#3776) 2018-10-08 11:39:00 -07:00
Philip Hyunsu Cho
6d42e56c85 Retry Jenkins CI tests up to 3 times to improve reliability (redux) (#3775) 2018-10-08 11:24:01 -07:00
Philip Hyunsu Cho
7a7269e983 Retry Jenkins CI tests up to 3 times to improve reliability (#3769) 2018-10-08 09:55:39 -07:00
Philip Hyunsu Cho
ea99b53d8e Document behavior of get_fscore() for zero-importance features (#3763) 2018-10-08 01:52:25 -07:00
Philip Hyunsu Cho
10cd7c8447 Fix #3714: preserve feature names when slicing DMatrix (#3766)
* Fix #3714: preserve feature names when slicing DMatrix

* Add test
2018-10-08 01:04:33 -07:00
Philip Hyunsu Cho
813d2436d3 Produce xgboost.so for XGBoost-R on Mac OSX, so that make install works (#3767)
* Produce xgboost.so for XGBoost-R on Mac OSX, so that `make install` works

* Modernize R build instructions

* Fix crossref
2018-10-07 14:09:54 -07:00
Philip Hyunsu Cho
c23783a0d1 Add notes to doc (#3765) 2018-10-07 14:09:09 -07:00
Philip Hyunsu Cho
91903ac5d4 Fix broken doc build due to Matplotlib 3.0 release (#3764) 2018-10-07 13:34:37 -07:00
Philip Hyunsu Cho
ae7e58b96e Test wheel compatibility on CPU containers, for all pull requests (#3762)
* Test wheel compatibility on CPU containers, for all pull requests

* Run wheel test only when multi-GPU flag is not set
2018-10-06 20:18:58 -07:00
Saumya Bhatnagar
e0fd60f4e5 [doc] Fix link in rank demo README.md . (#3759) 2018-10-06 12:12:54 -07:00
trivialfis
4b892c2b30 Remove obsoleted QuantileHistMaker. (#3761)
Fix #3755.
2018-10-06 11:22:15 -07:00
Nan Zhu
785094db53 [jvm-packages] fix issue when spark job execution thread cannot return before we execute first() (#3758)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* sparjJobThread

* update

* fix issue when spark job execution thread cannot return before we execute first()
2018-10-05 22:20:50 -07:00
zengxy
9e73087324 [jvm-packages] support specified feature names when getModelDump and getFeatureScore (#3733)
* [jvm-packages] support specified feature names for jvm when get ModelDump and get FeatureScore (#3725)

* typo and style fix
2018-10-04 09:05:42 -07:00
Rory Mitchell
34522d56f0 Allow plug-ins to be built by cmake (#3752)
* Remove references to AVX code.

* Allow plugins to be built by cmake
2018-10-04 22:03:52 +13:00
trivialfis
c6b5df67f6 Catch dmlc::Error. (#3751)
Fix #3643.
2018-10-04 16:51:38 +13:00
weitian
efc4f85505 [jvm-packages] Fix #3489: Spark repartitionForData can potentially shuffle all data and lose ordering required for ranking objectives (#3654) 2018-10-03 08:43:55 -07:00
trivialfis
d594b11f35 Implement transform to reduce CPU/GPU code duplication. (#3643)
* Implement Transform class.
* Add tests for softmax.
* Use Transform in regression, softmax and hinge objectives, except for Cox.
* Mark old gpu objective functions deprecated.
* static_assert for softmax.
* Split up multi-gpu tests.
2018-10-02 15:06:21 +13:00
Sergei Lebedev
87aca8c244 [jvm-packages] Fixed the distributed updater check (#3739)
The updater used in distributed training is grow_histmaker and not 
grow_colmaker as the error message stated prior to this commit.
2018-10-01 11:22:01 -07:00
Rory Mitchell
70d208d68c Dmatrix refactor stage 2 (#3395)
* DMatrix refactor 2

* Remove buffered rowset usage where possible

* Transition to c++11 style iterators for row access

* Transition column iterators to C++ 11
2018-10-01 01:29:03 +13:00
Philip Hyunsu Cho
b50bc2c1d4 Add multi-GPU unit test environment (#3741)
* Add multi-GPU unit test environment

* Better assertion message

* Temporarily disable failing test

* Distinguish between multi-GPU and single-GPU CPP tests

* Consolidate Python tests. Use attributes to distinguish multi-GPU Python tests from single-CPU counterparts
2018-09-29 11:20:58 -07:00
Philip Hyunsu Cho
baef5741df Separate out restricted and unrestricted tasks (#3736) 2018-09-27 23:06:14 -07:00
trivialfis
5a7f7e7d49 Implement devices to devices reshard. (#3721)
* Force clearing device memory before Reshard.
* Remove calculating row_segments for gpu_hist and gpu_sketch.
* Guard against changing device.
2018-09-28 17:40:23 +12:00
Tong He
0b7fd74138 fix R check warning (#3728) 2018-09-27 17:53:49 -07:00
Philip Hyunsu Cho
51478a39c9 Fix #3730: scikit-learn 0.20 compatibility fix (#3731)
* Fix #3730: scikit-learn 0.20 compatibility fix

sklearn.cross_validation has been removed from scikit-learn 0.20,
so replace it with sklearn.model_selection

* Display test names for Python tests for clarity
2018-09-27 15:03:05 -07:00
Philip Hyunsu Cho
fbe9d41dd0 Disable flaky tests in R-package/tests/testthat/test_update.R (#3723) 2018-09-26 14:21:41 -07:00
Nan Zhu
79d854c695 [jvm-packages] fix errors in example (#3719)
* add back train method but mark as deprecated

* fix scalastyle error

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix scalastyle error

* instrumentation

* use log console

* better measurement

* fix erros in example

* update histmaker
2018-09-22 16:39:38 -07:00
BruceZhao
3b5a1f389a [R] add a demo of multi-class classification R version (#3695)
* add a demo of multi-class classification R version

* add a demo of multi-class classification result

* add intro to the demo readme

* Delete train.md

* Update README.md
2018-09-21 23:06:40 -07:00
Takahiro Kojima
2405c59352 remove extra of (#3713) 2018-09-21 11:55:39 -07:00
Philip Hyunsu Cho
73140ce84c Fix #3702: do not round up integer thresholds for integer features in JSON dump (#3717) 2018-09-21 01:11:21 -07:00
Nan Zhu
aa53e9fc8d [jvm-packages] bump spark version (#3709) 2018-09-19 11:18:01 -07:00
trivialfis
9119f9e369 Fix gpu devices. (#3693)
* Fix gpu_set normalized and unnormalized.
* Fix DeviceSpan.
2018-09-19 17:39:42 +12:00
Andy Adinets
0f99cdfe0e Fixed an uninitialized pointer. (#3703) 2018-09-16 18:02:31 +12:00
Michael Mui
20a9e716bd [jvm-packages] Fix "obj_type" error to enable custom objectives and evaluations (#3646)
credits to @mmui
2018-09-14 12:06:33 -07:00
Dmitriy Rybalko
7bbb44182a update eval_metric doc (#3687) 2018-09-14 08:47:05 -07:00
Jerry Lin
9acd549dc7 [jvm-packages] Add rank:ndcg and rank:map to Spark supported objectives (#3697) 2018-09-13 09:51:24 -07:00
Chen Qin
42b108136f [jvm-packages] bump flink version number (#3686)
* bump flink version number

* bump flink version number

* add missing hadoop dependency
2018-09-13 09:33:09 -07:00
Philip Hyunsu Cho
bd41bd6605 Better error message for failed library loading (#3690)
* Better error message for failed lib loading

* Address review comment + fix lint
2018-09-12 22:37:26 -07:00
Philip Hyunsu Cho
3209b42b07 Include full text of Apache 2.0 license (#3698) 2018-09-12 20:46:55 -07:00
jakehoare
7707982a85 Amend xgb.createFolds to handle classes of a single element. (#3630)
* Amend xgb.createFolds to handle classes of a single element.

* Fix variable name
2018-09-12 09:23:05 -05:00
Vadim Khotilovich
ad3a0bbab8 Add the missing max_delta_step (#3668)
* add max_delta_step to SplitEvaluator

* test for max_delta_step

* missing x2 factor for L1 term

* remove gamma from ElasticNet
2018-09-12 08:43:41 -05:00
Nan Zhu
d1e75d615e [jvm-packages] Remove copy paste error in test suite (#3692)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* remove copy paste error
2018-09-11 13:08:36 -07:00
Joseph Bradley
14a8b96476 [jvm-packages] xgboost-spark warning when Spark encryption is turned on (#3667)
* added test, commented out right now

* reinstated test

* added fix for checking encryption settings

* fix by using RDD conf

* fix compilation

* renamed conf

* use SparkSession if available

* fix message

* nop

* code review fixes
2018-09-10 14:21:01 -07:00
Philip Hyunsu Cho
3564b68b98 Fix #3397: early_stop callback does not maximize metric of form NDCG@n- (#3685)
* Fix #3397: early_stop callback does not maximize metric of form NDCG@n-

Early stopping callback makes splits with '-' letter, which interferes
with metrics of form NDCG@n-. As a result, XGBoost tries to minimize
NDCG@n-, where it should be maximized instead.

Fix. Specify maxsplit=1.

* Python 2.x compatibility fix
2018-09-08 19:46:25 -07:00
Andy Adinets
f606cb8ef4 Fixed the performance regression within EvaluateSplits(). (#3680)
- it turns out creating an std::vector on every call is faster
  than cudaMallocHost()/cudaFreeHost()
2018-09-08 14:48:45 +12:00
Matthew Tovbin
beab6e08dd Remove println in jsonDecode (#3665)
Following issue  #3578
2018-09-07 15:47:26 -07:00
mrgutkun
4b43810f51 Fix #3663: Allow sklearn API to use callbacks (#3682)
* Fix #3663: Allow sklearn API to use callbacks

* Fix lint

* Add Callback API to Python API doc
2018-09-07 13:51:26 -07:00
Philip Hyunsu Cho
5a8bbb39a1 Revert #3677 and #3674 (#3678)
* Revert "Add scikit-learn as dependency for doc build (#3677)"

This reverts commit 308f664ade.

* Revert "Add scikit-learn tests (#3674)"

This reverts commit d176a0fbc8.
2018-09-06 20:43:17 -07:00
Sergei Chipiga
8dac0d1009 Fix typo in python demo (#3676) 2018-09-06 14:56:21 -07:00
Philip Hyunsu Cho
308f664ade Add scikit-learn as dependency for doc build (#3677) 2018-09-06 14:56:05 -07:00
Philip Hyunsu Cho
56e906a789 Update dmlc-core, to fix partitioned file loading (#3673) 2018-09-06 09:56:06 -07:00
Philip Hyunsu Cho
d176a0fbc8 Add scikit-learn tests (#3674)
* Add scikit-learn tests

Goal is to pass scikit-learn's check_estimator() for XGBClassifier,
XGBRegressor, and XGBRanker. It is actually not possible to do so
entirely, since check_estimator() assumes that NaN is disallowed,
but XGBoost allows for NaN as missing values. However, it is always
good ideas to add some checks inspired by check_estimator().

* Fix lint

* Fix lint
2018-09-06 09:55:28 -07:00
Philip Hyunsu Cho
190d888695 Document LambdaMART objectives: pairwise, listwise (#3672)
* Document LambdaMART objectives

* Distinguish between pairwise and listwise objectives
2018-09-06 09:54:37 -07:00
Philip Hyunsu Cho
c87153ed32 Fix CRAN check by removing reference to std::cerr (#3660)
* Fix CRAN check by removing reference to std::cerr

* Mask tests that fail on 32-bit Windows R
2018-09-05 11:44:00 -07:00
Philip Hyunsu Cho
9344f081a4 Add numpy and matplotlib as requirements for doc build (#3669) 2018-09-04 20:56:18 -07:00
Shiki-H
8f4acba34b moved data processing to wgetdata.sh (#3666) 2018-09-04 09:36:48 -07:00
Andrew Thia
9254c58e4d [TREE] add interaction constraints (#3466)
* add interaction constraints

* enable both interaction and monotonic constraints at the same time

* fix lint

* add R test, fix lint, update demo

* Use dmlc::JSONReader to express interaction constraints as nested lists; Use sparse arrays for bookkeeping

* Add Python test for interaction constraints

* make R interaction constraints parameter based on feature index instead of column names, fix R coding style

* Fix lint

* Add BlueTea88 to CONTRIBUTORS.md

* Short circuit when no constraint is specified; address review comments

* Add tutorial for feature interaction constraints

* allow interaction constraints to be passed as string, remove redundant column_names argument

* Fix typo

* Address review comments

* Add comments to Python test
2018-09-04 09:35:39 -07:00
Andy Adinets
dee0b69674 Fixed copy constructor for HostDeviceVectorImpl. (#3657)
- previously, vec_ in DeviceShard wasn't updated on copy; as a result,
  the shards continued to refer to the old HostDeviceVectorImpl object,
  which resulted in a dangling pointer once that object was deallocated
2018-09-01 11:38:09 +12:00
Philip Hyunsu Cho
86d88c0758 Fix #3648: XGBClassifier.predict() should return margin scores when output_margin=True (#3651)
* Fix #3648: XGBClassifier.predict() should return margin scores when output_margin=True

* Fix tests to reflect correct implementation of XGBClassifier.predict(output_margin=True)

* Fix flaky test test_with_sklearn.test_sklearn_api_gblinear
2018-08-30 21:05:05 -07:00
Vadim Khotilovich
5b662cbe1c [R] R-interface for SHAP interactions (#3636)
* add R-interface for SHAP interactions

* update docs for new roxygen version
2018-08-30 19:06:21 -05:00
Philip Hyunsu Cho
10c31ab2cb Fix #3638: Binary classification demo should produce LIBSVM with 0-based indexing (#3652) 2018-08-30 13:18:42 -07:00
Philip Hyunsu Cho
7b1427f926 Add validate_features parameter to sklearn API (#3653) 2018-08-29 23:21:46 -07:00
Andy Adinets
72cd1517d6 Replaced std::vector with HostDeviceVector in MetaInfo and SparsePage. (#3446)
* Replaced std::vector with HostDeviceVector in MetaInfo and SparsePage.

- added distributions to HostDeviceVector
- using HostDeviceVector for labels, weights and base margings in MetaInfo
- using HostDeviceVector for offset and data in SparsePage
- other necessary refactoring

* Added const version of HostDeviceVector API calls.

- const versions added to calls that can trigger data transfers, e.g. DevicePointer()
- updated the code that uses HostDeviceVector
- objective functions now accept const HostDeviceVector<bst_float>& for predictions

* Updated src/linear/updater_gpu_coordinate.cu.

* Added read-only state for HostDeviceVector sync.

- this means no copies are performed if both host and devices access
  the HostDeviceVector read-only

* Fixed linter and test errors.

- updated the lz4 plugin
- added ConstDeviceSpan to HostDeviceVector
- using device % dh::NVisibleDevices() for the physical device number,
  e.g. in calls to cudaSetDevice()

* Fixed explicit template instantiation errors for HostDeviceVector.

- replaced HostDeviceVector<unsigned int> with HostDeviceVector<int>

* Fixed HostDeviceVector tests that require multiple GPUs.

- added a mock set device handler; when set, it is called instead of cudaSetDevice()
2018-08-30 14:28:47 +12:00
Andy Adinets
58d783df16 Fixed issue 3605. (#3628)
* Fixed issue 3605.

- https://github.com/dmlc/xgboost/issues/3605

* Fixed the bug in a better way.

* Added a test to catch the bug.

* Fixed linter errors.
2018-08-28 10:50:52 -07:00
Rory Mitchell
78bea0d204 Add google test for a column sampling, restore metainfo tests (#3637)
* Add google test for a column sampling, restore metainfo tests

* Update metainfo test for visual studio

* Fix multi-GPU bug introduced in #3635
2018-08-28 16:10:26 +12:00
gorogm
7ef2b599c7 Link fixed. (#3640) 2018-08-27 20:25:50 -07:00
Rory Mitchell
686e990ffc GPU memory usage fixes + column sampling refactor (#3635)
* Remove thrust copy calls

* Fix  histogram memory usage

* Cap extreme histogram memory usage

* More efficient column sampling

* Use column sampler across updaters

* More efficient split evaluation on GPU with column sampling
2018-08-27 16:26:46 +12:00
trivialfis
60787ecebc Merge generic device helper functions into gpu set. (#3626)
* Remove the use of old NDevices* functions.
* Use GPUSet in timer.h.
2018-08-26 18:14:23 +12:00
Nan Zhu
3261002099 [jvm-packages] throw ControlThrowable instead of InterruptedException (#3632)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* interrupted exception is not rethrown
2018-08-25 20:30:21 -07:00
Philip Hyunsu Cho
cb4de521c1 Document CUDA requirement, lack of external memory on GPU (#3624)
* Document fact that GPU doesn't support external memory

* Document CUDA requirement
2018-08-22 22:47:10 -07:00
Philip Hyunsu Cho
4ed8a88240 Update Python API doc (#3619)
* Add XGBRanker to Python API doc

* Show inherited members of XGBRegressor in API doc, since XGBRegressor uses default methods from XGBModel

* Add table of contents to Python API doc

* Skip JVM doc download if not available

* Show inherited members for XGBRegressor and XGBRanker

* Expose XGBRanker to Python XGBoost module directory

* Add docstring to XGBRegressor.predict() and XGBRanker.predict()

* Fix rendering errors in Python docstrings

* Fix lint
2018-08-22 18:59:30 -07:00
Nan Zhu
4912c1f9c6 [jvm-packages] fix checkpoint save/load (#3614)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix update checkpoint func
2018-08-21 12:34:24 -07:00
Grant W Schneider
57f3c2f252 Remove errant $ (#3618) 2018-08-21 12:32:38 -07:00
Shiki-H
24a268a2e3 sklearn api for ranking (#3560)
* added xgbranker

* fixed predict method and ranking test

* reformatted code in accordance with pep8

* fixed lint error

* fixed docstring and added checks on objective

* added ranking demo for python

* fixed suffix in rank.py
2018-08-21 08:26:48 -07:00
Philip Hyunsu Cho
b13c3a8bcc Fix #3609: Removed unused parameter 'use_buffer' (#3610) 2018-08-21 07:54:15 -07:00
trivialfis
cf2d86a4f6 Add travis sanitizers tests. (#3557)
* Add travis sanitizers tests.

* Add gcc-7 in Travis.
* Add SANITIZER_PATH for CMake.
* Enable sanitizer tests in Travis.

* Fix memory leaks in tests.

* Fix all memory leaks reported by Address Sanitizer.
* tests/cpp/helpers.h/CreateDMatrix now returns raw pointer.
2018-08-19 16:40:30 +12:00
Philip Hyunsu Cho
983cb0b374 Add option to disable default metric (#3606) 2018-08-18 11:39:20 -07:00
Grace Lam
993e62b9e7 Add JSON model dump functionality (#3603)
* Add JSON model dump functionality

* Fix lint
2018-08-17 16:18:43 -07:00
Matthew Tovbin
b53a5a262c [jvm-packages] getTreeLimit return type should be Int 2018-08-17 09:36:00 -07:00
Philip Hyunsu Cho
ac7fc1306b Fix #3598: document that custom objective can't contain colon (:) (#3601) 2018-08-16 19:05:40 -07:00
Grace Lam
caf4a756bf Add JSON dump functionality documentation (#3600) 2018-08-16 16:32:04 -07:00
trivialfis
7c82dc92b2 Fix accessing DMatrix.handle before set. (#3599)
Close #3597.
2018-08-16 15:26:06 -07:00
Jakob Richter
725f4c36f2 replace nround with nrounds to match actual parameter (#3592) 2018-08-15 11:13:53 -07:00
Nan Zhu
73bd590a1d [jvm-packages] add the missing scm urls (#3589)
for some reason this part was missing in master branch????
2018-08-14 15:05:23 -07:00
trivialfis
9265964ee7 Fix ptrdiff_t namespace in Span. (#3588)
Fix #3587.
2018-08-15 10:04:55 +12:00
trivialfis
2c502784ff Span class. (#3548)
* Add basic Span class based on ISO++20.

* Use Span<Entry const> instead of Inst in SparsePage.

* Add DeviceSpan in HostDeviceVector, use it in regression obj.
2018-08-14 17:58:11 +12:00
Matthew Tovbin
2b7a1c5780 [jvm-packages] Avoid loosing precision when computing probabilities by converting to Double early (#3576) 2018-08-13 14:05:07 -07:00
Matthew Tovbin
ce0f0568a6 Make sure 'thresholds' are considered when executing predict method (#3577) 2018-08-13 14:04:47 -07:00
Philip Hyunsu Cho
6288f6d563 Update JVM packages version to 0.81-SNAPSHOT (#3584) 2018-08-13 10:17:52 -07:00
Philip Hyunsu Cho
96826a3515 Release version 0.80 (#3541)
* Up versions

* Write release note for 0.80
2018-08-13 01:38:37 -07:00
Mathew
06ef4db4cc Fix Spark 2.2 Support (Amending #3062) (#3325)
This pull request amends the broken #3062 allow Spark 2.2 to work.

Please note this won't work in Spark <=2.1 as sc.removeSparkListener was implemented in Spark 2.2. (So perhaps a more general method is better, although that is what was attempted in #3062)

This PR fixes: #3208, #3151 and the discussion in #1927.

I do find it strange that #3062 dose not work in Spark 2.2, it's probably due to some sort of public/private issue in the org.apache.spark.scheduler.LiveListenerBus class inheritance (In Spark itself). The error is: `java.lang.NoSuchMethodError: org.apache.spark.scheduler.LiveListenerBus.removeListener(Ljava/lang/Object;)V`
2018-08-12 18:35:20 -07:00
Rory Mitchell
645996b12f Remove accidental SparsePage copies (#3583) 2018-08-12 17:49:38 -07:00
Philip Hyunsu Cho
0b607fb884 Add link to XGBoost4J-Spark tutorial on AWS Yarn tutorial (#3582) 2018-08-12 07:27:28 -07:00
Philip Hyunsu Cho
4202332783 Clarify multi-GPU training, binary wheels, Pandas integration (#3581)
* Clarify multi-GPU training, binary wheels, Pandas integration

* Add a note about multi-GPU on gpu/index.rst
2018-08-11 19:21:28 -07:00
Matthew Tovbin
7300002516 [jvm-packages] Use treeLimit param in getTreeLimit (#3575) 2018-08-10 09:38:58 -07:00
Philip Hyunsu Cho
9c647d8130 Bring XGBoost4J Intro up-to-date (#3574) 2018-08-10 09:08:19 -07:00
Philip Hyunsu Cho
2e7c3a0ed5 Refined logic for locating git branch inside ReadTheDocs (#3573) 2018-08-09 15:28:12 -07:00
Philip Hyunsu Cho
aa4ee6a0e4 [BLOCKING] Adding JVM doc build to Jenkins CI (#3567)
* Adding Java/Scala doc build to Jenkins CI

* Deploy built doc to S3 bucket

* Build doc only for branches

* Build doc first, to get doc faster for branch updates

* Have ReadTheDocs download doc tarball from S3

* Update JVM doc links

* Put doc build commands in a script

* Specify Spark 2.3+ requirement for XGBoost4J-Spark

* Build GPU wheel without NCCL, to reduce binary size
2018-08-09 13:27:01 -07:00
Matthew Tovbin
bad76048d1 Eliminate use of System.out + proper error logging (#3572) 2018-08-09 10:06:17 -07:00
Rory Mitchell
bbb771f32e Refactor parts of fast histogram utilities (#3564)
* Refactor parts of fast histogram utilities

* Removed byte packing from column matrix
2018-08-09 17:59:57 +12:00
Philip Hyunsu Cho
3c72654e3b Revert "Fix #3485, #3540: Don't use dropout for predicting test sets" (#3563)
* Revert "Fix #3485, #3540: Don't use dropout for predicting test sets (#3556)"

This reverts commit 44811f2330.

* Document behavior of predict() for DART booster

* Add notice to parameter.rst
2018-08-08 09:48:55 -07:00
Zeno Gantner
e3e776bd58 grammar fixes and typos (#3568) 2018-08-08 09:48:27 -07:00
Nan Zhu
1c08b3b2ea [jvm-packages] enable predictLeaf/predictContrib/treeLimit in 0.8 (#3532)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* partial finish

* no test

* add test cases

* add test cases

* address comments

* add test for regressor

* fix typo
2018-08-07 14:01:18 -07:00
Philip Hyunsu Cho
246ec92163 Update broken links (#3565)
Fix #3559
Fix #3562
2018-08-07 05:27:39 -07:00
trivialfis
55caad6e49 Remove redundant FindGTest.cmake. (#3533)
During removal of FindGTest.cmake, also

* Fix gtest include dirs.
* Remove some blanks and use PWD for gtest dir.
2018-08-07 10:08:08 +12:00
Henry Gouk
69454d9487 Implementation of hinge loss for binary classification (#3477) 2018-08-07 10:06:42 +12:00
Philip Hyunsu Cho
44811f2330 Fix #3485, #3540: Don't use dropout for predicting test sets (#3556)
* Fix #3485, #3540: Don't use dropout for predicting test sets

Dropout (for DART) should only be used at training time.

* Add regression test
2018-08-05 10:17:21 -07:00
Philip Hyunsu Cho
109473dae2 Fix #3545: XGDMatrixCreateFromCSCEx silently discards empty trailing rows (#3553)
* Fix #3545: XGDMatrixCreateFromCSCEx silently discards empty trailing rows

Description: The bug is triggered when

1. The data matrix has empty rows at the bottom. More precisely, the rows
   `n-k+1`, `n-k+2`, ..., `n` of the matrix have missing values in all
   dimensions (`n` number of instances, `k` number of trailing rows)
2. The data matrix is given as Compressed Sparse Column (CSC) format.

Diagnosis: When the CSC matrix is converted to Compressed Sparse Row (CSR)
format (this is common format used for DMatrix), the trailing empty rows
are silently ignored. More specifically, the row pointer (`offset`) of the
newly created CSR matrix does not take account of these rows.

Fix: Modify the row pointer.

* Add regression test
2018-08-05 10:15:42 -07:00
Philip Hyunsu Cho
8c633d1ca3 Fix #3505: Prevent undefined behavior due to incorrectly sized base_margin (#3555)
The base margin will need to have length `[num_class] * [number of data points]`.
Otherwise, the array holding prediction results will be only partially
initialized, causing undefined behavior.

Fix: check the length of the base margin. If the length is not correct,
use the global bias (`base_score`) instead. Warn the user about the
substitution.
2018-08-05 10:14:07 -07:00
Philip Hyunsu Cho
4a429a7c4f Add reg:tweedie to supported objectives in XGBoost4J-Spark (#3552) 2018-08-05 07:42:59 -07:00
Philip Hyunsu Cho
7fefd6865d Fix #3402: wrong fid crashes distributed algorithm (#3535)
* Fix #3402: wrong fid crashes distributed algorithm

The bug was introduced by the recent DMatrix refactor (#3301). It was partially
fixed by #3408 but the example in #3402 was still failing. The example in #3402
will succeed after this fix is applied.

* Explicitly specify "this" to prevent compile error

* Add regression test

* Add distributed test to Travis matrix

* Install kubernetes Python package as dependency of dmlc tracker

* Add Python dependencies

* Add compile step

* Reduce size of regression test case

* Further reduce size of test
2018-08-04 19:20:04 -07:00
Nan Zhu
31d1baba3d [jvm-packages] Tutorial of XGBoost4J-Spark (#3534)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* add new

* update doc

* finish Gang Scheduling

* more

* intro

* Add sections: Prediction, Model persistence and ML pipeline.

* Add XGBoost4j-Spark MLlib pipeline example

* partial finished version

* finish the doc

* adjust code

* fix the doc

* use rst

* Convert XGBoost4J-Spark tutorial to reST

* Bring XGBoost4J up to date

* add note about using hdfs

* remove duplicate file

* fix descriptions

* update doc

* Wrap HDFS/S3 export support as a note

* update

* wrap indexing_mode example in code block
2018-08-03 21:17:50 -07:00
trivialfis
34dc9155ab Use __CUDA__ macro with __NVCC__. (#3539)
* __CUDA__ is defined in clang. Making the change won't make clang
compile xgboost, but syntax checking from clang is at least partially
working.
2018-08-02 22:04:23 +12:00
Philip Hyunsu Cho
70026655b0 Clarify supported OSes for XGBoost4J published JARs (#3547) 2018-08-01 19:51:44 -07:00
Philip Hyunsu Cho
437b368b1f Update dmlc-core submodule (#3546)
This bring many goodies, including:

* Ability to specify delimiter and weight_column for CSV files:
```python
dtrain = xgboost.DMatrix('train.csv?format=csv&label_column=0&weight_column=1&delimiter= ')
```
* Ability to choose between 0-based and 1-based indexing for LIBSVM/LIBFM files:
```python
dtrain = xgboost.DMatrix('train.libsvm?indexing_mode=1')    # use 1-based indexing
dtest = xgboost.DMatrix('test.libsvm')                      # use 0-based indexing (default)
dtest2 = xgboost.DMatrix('test2.libsvm?indexing_mode=-1')  # use heuristic to detect 0-based / 1-based
```
* Fix a bug in float parsing (issue dmlc/dmlc-core#440)
2018-08-01 15:15:40 -07:00
Nan Zhu
6cf97b4eae [jvm-packages] consider spark.task.cpus when controlling parallelism (#3530)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* consider spark.task.cpus when controlling parallelism

* fix bug

* fix conf setup

* calculate requestedCores within ParallelismController

* enforce spark.task.cpus = 1

* unify unit test case framework

* enable spark ui
2018-07-31 06:19:45 -07:00
trivialfis
860263f814 Enable building with sanitizers. (#3525) 2018-07-31 17:25:47 +12:00
Nan Zhu
b546321c83 [jvm-packages] the current version of xgboost does not consider missing value in prediction (#3529)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* consider missing value in prediction

* handle single prediction instance

* fix type conversion
2018-07-30 14:16:24 -07:00
wenduowang
3b62e75f2e Fix bug of using list(x) function when x is string (#3432)
* Fix bug of using list(x) function when x is string

list('abcdcba') = ['a', 'b', 'c', 'd', 'c', 'b', 'a']

* Allow feature_names/feature_types to be of any type

If feature_names/feature_types is iterable, e.g. tuple, list, then convert the value to list, except for string; otherwise construct a list with a single value

* Delete excess whitespace

* Fix whitespace to pass lint
2018-07-30 07:36:34 -07:00
jqmp
dd07c25d12 Fix typo in ElasticNet threshold function (#3527) 2018-07-30 14:08:14 +12:00
Philip Hyunsu Cho
2bb9b9d3db Fix typo in parameter.rst, gblinear section (#3518) 2018-07-28 18:58:15 -07:00
Nan Zhu
b5178d3d99 [jvm-packages] a better explanation about the inconsistent issue (#3524) 2018-07-28 17:34:39 -07:00
hlsc
5850a2558a fix DMatrix load_row_split bug (#3431) 2018-07-28 17:21:30 -07:00
trivialfis
8973f2cb0e Fix building dmlc-core from xgboost. (#3522)
Move building dmlc-core before adding DMLC_LOG_CUSTOMIZE.

Fix #3520.
2018-07-28 10:35:11 -07:00
Uddeshya Singh
3363b9142e Update faq.rst (#3521)
Just fixing a minor typo
2018-07-28 10:34:14 -07:00
Rory Mitchell
07ff52d54c Dynamically allocate GPU histogram memory (#3519)
* Expand histogram memory dynamically to prevent large allocations for large tree depths (e.g. > 15)

* Remove GPU memory allocation messages. These are misleading as a large number of allocations are now dynamic.

* Fix appveyor R test
2018-07-28 21:22:41 +12:00
Brandon Greenwell
b5fad42da2 Issue warning when requesting bivariate plotting (#3516) 2018-07-27 16:15:37 -07:00
Philip Hyunsu Cho
8a5209c55e Fix model saving for 'count:possion': max_delta_step as Booster attribute (#3515)
* Save max_delta_step as an extra attribute of Booster

Fixes #3509 and #3026, where `max_delta_step` parameter gets lost during serialization.

* fix lint

* Use camel case for global constant

* disable local variable case in clang-tidy
2018-07-27 09:55:54 -07:00
Andy Adinets
cc6a5a3666 Added finding quantiles on GPU. (#3393)
* Added finding quantiles on GPU.

- this includes datasets where weights are assigned to data rows
- as the quantiles found by the new algorithm are not the same
  as those found by the old one, test thresholds in
    tests/python-gpu/test_gpu_updaters.py have been adjusted.

* Adjustments and improved testing for finding quantiles on the GPU.

- added C++ tests for the DeviceSketch() function
- reduced one of the thresholds in test_gpu_updaters.py
- adjusted the cuts found by the find_cuts_k kernel
2018-07-27 14:03:16 +12:00
Nan Zhu
e2f09db77a [jvm-packages] minor fix for parameter name in example (#3507) 2018-07-25 19:57:40 -07:00
Rory Mitchell
a725272e19 Correct mistake from dmatrix refactor (#3408) 2018-07-24 15:03:36 +12:00
jqmp
e9a97e0d88 Add total_gain and total_cover importance measures (#3498)
Add `'total_gain'` and `'total_cover'` as possible `importance_type`
arguments to `Booster.get_score` in the Python package.

`get_score` already accepts a `'gain'` argument, which returns each
feature's average gain over all of its splits.  `'total_gain'` does the
same, but returns a total rather than an average.  This seems more
intuitively meaningful, and also matches the behavior of the R package's
`xgb.importance` function.

I also added an analogous `'total_cover'` command for consistency.

This should resolve #3484.
2018-07-23 00:30:55 -07:00
KOLANICH
a1505de631 Added configuration for python into .editorconfig (#3494)
* Added configuration for python into .editorconfig

* Fixed forgotten change in the number of spaces
2018-07-23 00:24:10 -07:00
KOLANICH
a393d44c5d Improved library loading a bit (#3481)
* Improved library loading a bit

* Fixed indentation.

* Fixes according to the discussion

* Moved the comment to a separate line.
* specified exception type
2018-07-20 16:03:44 -07:00
Philip Hyunsu Cho
8e90b60c4d Fix relpath in setup.py on Windows (#3493)
* Fix relpath in setup.py on Windows

Fixes #3480.

* Use only one lib file; use 4 space indent
2018-07-20 12:28:08 -07:00
Philip Hyunsu Cho
05b089405d Doc modernization (#3474)
* Change doc build to reST exclusively

* Rewrite Intro doc in reST; create toctree

* Update parameter and contribute

* Convert tutorials to reST

* Convert Python tutorials to reST

* Convert CLI and Julia docs to reST

* Enable markdown for R vignettes

* Done migrating to reST

* Add guzzle_sphinx_theme to requirements

* Add breathe to requirements

* Fix search bar

* Add link to user forum
2018-07-19 14:22:16 -07:00
Yanbo Liang
c004cea788 Expose setCustomObj & setCustomEval for XGBoostClassifier & XGBoostRegressor. (#3486) 2018-07-17 21:16:51 -07:00
KOLANICH
b6dcbf0e07 Added .editorconfig (#3478) 2018-07-17 20:05:55 -07:00
Rory Mitchell
0f145a0365 Resolve GPU bug on large files (#3472)
Remove calls to thrust copy, fix indexing bug
2018-07-16 20:43:45 +12:00
Rory Mitchell
1b59316444 Updates for GPU CI tests (#3467)
* Fail GPU CI after test failure

* Fix GPU linear tests

* Reduced number of GPU tests to speed up CI

* Remove static allocations of device memory

* Resolve illegal memory access for updater_fast_hist.cc

* Fix broken r tests dependency

* Update python install documentation for GPU
2018-07-16 18:05:53 +12:00
Henry Gouk
a13e29ece1 Add LASSO (#3429)
* Allow multiple split constraints

* Replace RidgePenalty with ElasticNet

* Add test for checking Ridge, LASSO, and Elastic Net are implemented
2018-07-15 16:38:26 +12:00
Yanbo Liang
2f8764955c [JVM-packages] Support single instance prediction. (#3464)
* Support single instance prediction.

* Address comments.
2018-07-12 14:17:53 -07:00
Thejaswi
2200939416 Upgrading to NCCL2 (#3404)
* Upgrading to NCCL2

* Part - II of NCCL2 upgradation

 - Doc updates to build with nccl2
 - Dockerfile.gpu update for a correct CI build with nccl2
 - Updated FindNccl package to have env-var NCCL_ROOT to take precedence

* Upgrading to v9.2 for CI workflow, since it has the nccl2 binaries available

* Added NCCL2 license + copy the nccl binaries into /usr location for the FindNccl module to find

* Set LD_LIBRARY_PATH variable to pick nccl2 binary at runtime

* Need the nccl2 library download instructions inside Dockerfile.release as well

* Use NCCL2 as a static library
2018-07-10 00:42:15 -07:00
Thejaswi
a6331925d2 Upgrade cuda version to 9.2 for CI workflows (#3460)
- Needed by the issue #3404
 - as v9.1 doesn't have a nccl2 release
2018-07-08 23:04:51 -07:00
Philip Hyunsu Cho
b40959042c Document 0.72.1 version (#3458) 2018-07-08 15:42:09 -07:00
kodonnell
6bed54ac39 python sklearn api: defaulting to best_ntree_limit if defined, otherwise current behaviour (#3445)
* python sklearn api: defaulting to best_ntree_limit if defined, otherwise current behaviour

* Fix whitespace
2018-07-08 14:35:52 -07:00
ngoyal2707
cb017d0c9a [jvm-packages] removed old group_data from spark api (#3451) 2018-07-07 22:21:01 -07:00
Nan Zhu
aa90e5c6ce [jvm-packages] disable booster setup for xgboost4j-spark (#3456)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* disable booster setup in spark

* check in parameter conversion

* fix compilation issue

* update exception type
2018-07-07 21:57:24 -07:00
Philip Hyunsu Cho
66e74d2223 Fix get_uint_info() (#3442)
* Add regression test
2018-07-05 20:06:59 -07:00
Philip Hyunsu Cho
48d6e68690 Add callback interface to re-direct console output (#3438)
* Add callback interface to re-direct console output

* Exempt TrackerLogger from custom logging

* Fix lint
2018-07-05 11:32:30 -07:00
Philip Hyunsu Cho
45bf4fbffb Add a notice for binary PyPI wheel (#3443) 2018-07-05 08:28:43 -07:00
Tianqi Chen
01aff45f26 Update README.md 2018-07-04 13:09:32 -07:00
Tianqi Chen
e62639c59b [DOCS] Update link to readme (#3437) 2018-07-04 12:24:33 -07:00
Yanbo Liang
aec6299c49 [jvm-packages] Expose nativeBooster for XGBoostClassificationModel and XGBoostRegressionModel. (#3428) 2018-07-01 15:06:16 -07:00
Nikita Titov
295252249e fixed MinGW missed dll (#3430) 2018-07-01 16:43:33 +00:00
liuliang01
0cf88d036f Add qid like ranklib format (#2749)
* add qid for https://github.com/dmlc/xgboost/issues/2748

* change names

* change spaces

* change qid to bst_uint type

* change qid type to size_t

* change qid first to SIZE_MAX

* change qid type from size_t to uint64_t

* update dmlc-core

* fix qids name error

* fix group_ptr_ error

* Style fix

* Add qid handling logic to SparsePage

* New MetaInfo format + backward compatibility fix

Old MetaInfo format (1.0) doesn't contain qid field. We still want to be able
to read from MetaInfo files saved in old format. Also, define a new format
(2.0) that contains the qid field. This way, we can distinguish files that
contain qid and those that do not.

* Update MetaInfo test

* Simply group assignment logic

* Explicitly set qid=nullptr in NativeDataIter

NativeDataIter's callback does not support qid field. Users of NativeDataIter
will need to call setGroup() function separately to set group information.

* Save qids_ in SaveBinary()

* Upgrade dmlc-core submodule

* Add a test for reading qid

* Add contributor

* Check the size of qids_

* Document qid format
2018-06-30 20:24:03 +00:00
Oliver Laslett
18813a26ab allow arbitrary cross validation fold indices (#3353)
* allow arbitrary cross validation fold indices

 - use training indices passed to `folds` parameter in `training.cv`
 - update doc string

* add tests for arbitrary fold indices
2018-06-30 19:23:49 +00:00
Mike Liu
594bcea83e Save and load model in sklearn API (#3192)
* Add (load|save)_model to XGBModel

* Add docstring

* Fix docstring

* Fix mixed use of space and tab

* Add a test

* Fix Flake8 style errors
2018-06-30 19:21:49 +00:00
Rory Mitchell
24fde92660 Build universal wheels using GPU CI (#3424) 2018-06-29 13:45:24 +00:00
Yun Ni
30d10ab035 Convert handle == nullptr from SegFault to user-friendly error. (#3021)
* Convert SegFault to user-friendly error.

* Apply the change to DMatrix API as well
2018-06-29 06:30:26 +00:00
cinqS
8bec8d5e9a Better doc for save_model() / load_model() (#3143)
Be clear that they do not save Python-specific attributes
2018-06-29 04:24:33 +00:00
pdesahb
12e34f32e2 Fix tweedie handling of base_score (#3295)
* fix tweedie margin calculations

* add entry to contributors
2018-06-28 15:43:05 +00:00
Henry Gouk
64b8cffde3 Refactor of FastHistMaker to allow for custom regularisation methods (#3335)
* Refactor to allow for custom regularisation methods

* Implement compositional SplitEvaluator framework

* Fixed segfault when no monotone_constraints are supplied.

* Change pid to parentID

* test_monotone_constraints.py now passes

* Refactor ColMaker and DistColMaker to use SplitEvaluator

* Performance optimisation when no monotone_constraints specified

* Fix linter messages

* Fix a few more linter errors

* Update the amalgamation

* Add bounds check

* Add check for leaf node

* Fix linter error in param.h

* Fix clang-tidy errors on CI

* Fix incorrect function name

* Fix clang-tidy error in updater_fast_hist.cc

* Enable SSE2 for Win32 R MinGW

Addresses https://github.com/dmlc/xgboost/pull/3335#issuecomment-400535752

* Add contributor
2018-06-28 07:37:25 +00:00
Philip Hyunsu Cho
cafc621914 Do not unzip google test archive if exists (#3416) 2018-06-28 04:10:39 +00:00
Philip Hyunsu Cho
e2743548ed Fix wget for google tests in tests (#3414)
CI tests were failing because wget prompts "the user" for a response
whenever the google test archive is already on the disk.

Fix: Use `-nc` option to skip download when the archive already
exists
2018-06-27 22:12:56 +00:00
Rory Mitchell
a0a1df1aba Refactor python tests (#3410)
* Add unit test utility

* Refactor updater tests. Add coverage for histmaker.
2018-06-27 11:20:27 +12:00
Adam Johnston
0988fb191f [jvm-packages] avoid use of Seq.apply in buildGroups (#3413) 2018-06-26 16:00:28 -07:00
ngoyal2707
5cd851ccef added code for instance based weighing for rank objectives (#3379)
* added code for instance based weighing for rank objectives

* Fix lint
2018-06-22 15:10:59 -07:00
Nan Zhu
d062c6f61b [jvm-packages] Maven central release stuffs (#3401)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* maven central release
2018-06-22 06:41:28 -07:00
PSEUDOTENSOR / Jonathan McKinney
9ac163d0bb Allow import via python datatable. (#3272)
* Allow import via python datatable.

* Write unit tests

* Refactor dt API functions

* Refactor python code

* Lint fixes

* Address review comments
2018-06-20 13:16:18 -07:00
James
eecf341ea7 [jvm-packages] Added latest version number example (#3374)
* Added latest version number example

* Added latest version number example
2018-06-18 22:09:39 -07:00
Thejaswi
0e78034607 Shared memory atomics while building histogram (#3384)
* Use shared memory atomics for building histograms, whenever possible
2018-06-19 16:03:09 +12:00
Yanbo Liang
2c4359e914 [jvm-packages] XGBoost Spark integration refactor (#3387)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* [jvm-packages] XGBoost Spark integration refactor. (#3313)

* XGBoost Spark integration refactor.

* Make corresponding update for xgboost4j-example

* Address comments.

* [jvm-packages] Refactor XGBoost-Spark params to make it compatible with both XGBoost and Spark MLLib (#3326)

* Refactor XGBoost-Spark params to make it compatible with both XGBoost and Spark MLLib

* Fix extra space.

* [jvm-packages] XGBoost Spark supports ranking with group data. (#3369)

* XGBoost Spark supports ranking with group data.

* Use Iterator.duplicate to prevent OOM.

* Update CheckpointManagerSuite.scala

* Resolve conflicts
2018-06-18 15:39:18 -07:00
Tong He
e6696337e4 Fix CRAN check for lintr (#3372)
* fix CRAN check

* Update submodules dmlc-core and rabit

* Add kintr to rmingw test
2018-06-18 12:53:52 -07:00
Bruce Qu
578a0c7ddb params confusion fixed (#3386) 2018-06-15 13:17:35 -07:00
Gorkem Ozkaya
34e3edfb1a Update index.md (#3228) 2018-06-07 21:51:06 -07:00
ngoyal2707
902ecbade8 added python doc string for nthreads to dmatrix (#3363) 2018-06-08 14:16:30 +12:00
Rory Mitchell
a96039141a Dmatrix refactor stage 1 (#3301)
* Use sparse page as singular CSR matrix representation

* Simplify dmatrix methods

* Reduce statefullness of batch iterators

* BREAKING CHANGE: Remove prob_buffer_row parameter. Users are instead recommended to sample their dataset as a preprocessing step before using XGBoost.
2018-06-07 10:25:58 +12:00
Andy Adinets
286dccb8e8 GPU binning and compression. (#3319)
* GPU binning and compression.

- binning and index compression are done inside the DeviceShard constructor
- in case of a DMatrix with multiple row batches, it is first converted into a single row batch
2018-06-05 17:15:13 +12:00
Rory Mitchell
3f7696ff53 Cleanup old artefacts in Jenkins (#3361) 2018-06-05 15:16:37 +12:00
Philip Hyunsu Cho
bd01acdfbc Save outputs in high precision in CLI prediction (#3356)
Currently, `CLIPredict()` saves prediction results in default 6-digit precision which causes precision loss. This PR sets precision to a level so that the conversion back to `bst_float` is lossless.

Related: #3298.
2018-06-03 14:15:47 -07:00
Nan Zhu
f66731181f Update 0.8 version num (#3358)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* update 0.80
2018-06-02 07:06:01 -07:00
Philip Hyunsu Cho
1214081f99 Release version 0.72 (#3337) 2018-06-01 16:00:31 -07:00
Ryota Suzuki
b7cbec4d4b Fix print.xgb.Booster for R (#3338)
* Fix print.xgb.Booster

valid_handle should be TRUE when x$handle is NOT null

* Update xgb.Booster.R

Modify is.null.handle to return TRUE for NULL handle
2018-05-29 11:44:55 -07:00
Kristian Gampong
a510e68dda Add validate_features option for Booster predict (#3323)
* Add validate_features option for Booster predict

* Fix trailing whitespace in docstring
2018-05-29 11:40:49 -07:00
Yanbo Liang
b018ef104f Remove output_margin from XGBClassifier.predict_proba argument list. (#3343) 2018-05-28 10:30:21 -07:00
trivialfis
34aeee2961 Fix test_param.cc header path (#3317) 2018-05-28 10:26:29 -07:00
Dave Challis
8efbadcde4 Point rabit submodule at latest commit from master. (#3330) 2018-05-28 10:21:10 -07:00
pdavalo
480e3fd764 Sklearn: validation set weights (#2354)
* Add option to use weights when evaluating metrics in validation sets

* Add test for validation-set weights functionality

* simplify case with no weights for test sets

* fix lint issues
2018-05-23 17:06:20 -07:00
Philip Hyunsu Cho
71e226120a For CRAN submission, remove all #pragma's that suppress compiler warnings (#3329)
* For CRAN submission, remove all #pragma's that suppress compiler warnings

A few headers in dmlc-core contain #pragma's that disable compiler warnings,
which is against the CRAN submission policy. Fix the problem by removing
the offending #pragma's as part of the command `make Rbuild`.

This addresses issue #3322.

* Fix script to improve Cygwin/MSYS compatibility

We need this to pass rmingw CI test

* Remove remove_warning_suppression_pragma.sh from packaged tarball
2018-05-23 09:58:39 -07:00
Thejaswi
d367e4fc6b Fix for issue 3306. (#3324) 2018-05-23 13:42:20 +12:00
Sergei Lebedev
8f6aadd4b7 [jvm-packages] Fixed CheckpointManagerSuite for Scala 2.10 (#3332)
As before, the compilation error is caused by mixing positional and
labelled arguments.
2018-05-19 18:28:11 -07:00
Rory Mitchell
3ee725e3bb Add cuda forwards compatibility (#3316) 2018-05-17 10:59:22 +12:00
Rory Mitchell
f8b7686719 Add cuda 8/9.1 centos 6 builds, test GPU wheel on CPU only container. (#3309)
* Add cuda 8/9.1 centos 6 builds, test GPU wheel on CPU only container.

* Add Google test
2018-05-17 10:57:01 +12:00
Tong He
098075b81b CRAN Submission for 0.71.1 (#3311)
* fix for CRAN manual checks

* fix for CRAN manual checks

* pass local check

* fix variable naming style

* Adding Philip's record
2018-05-14 17:32:39 -07:00
Nan Zhu
49b9f39818 [jvm-packages] update xgboost4j cross build script to be compatible with older glibc (#3307)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* static glibc glibc++

* update to build with glib 2.12

* remove unsupported flags

* update version number

* remove properties

* remove unnecessary command

* update poms
2018-05-10 06:39:44 -07:00
Philip Hyunsu Cho
9a8211f668 Update dmlc-core submodule (#3221)
* Update dmlc-core submodule

* Fix dense_parser to work with the latest dmlc-core

* Specify location of Google Test

* Add more source files in dmlc-minimum to get latest dmlc-core working

* Update dmlc-core submodule
2018-05-09 18:55:29 -07:00
mallniya
039dbe6aec freebsd support in libpath.py (#3247) 2018-05-09 16:13:30 -07:00
Clive Chan
0c0a78c255 Suggest git submodule update instead of delete + reclone (#3214) 2018-05-09 14:39:17 -07:00
Will Storey
747381b520 Improve .gitignore patterns (#3184)
* Adjust xgboost entries in .gitignore

They were overly broad. In particularly this was inconvenient when
working with tools such as fzf that use the .gitignore to decide what to
include. As written, we'd not look into /include/xgboost.

* Make cosmetic improvements to .gitignore

* Remove dmlc-core from .gitignore

This seems unnecessary and has the drawback that tools that use
.gitignore to know files to skip mean they won't look here, and being
able to inspect the submodule files with them is useful.
2018-05-09 14:31:59 -07:00
Samuel O. Ronsin
cc79a65ab9 Increase precision of bst_float values in tree dumps (#3298)
* Increase precision of bst_float values in tree dumps

* Increase precision of bst_float values in tree dumps

* Fix lint error and switch precision to right float variable

* Fix clang-tidy error
2018-05-09 14:12:21 -07:00
Brandon Greenwell
d13f1a0f16 Fix typo (#3305) 2018-05-09 10:18:36 -07:00
Rory Mitchell
088bb4b27c Prevent multiclass Hessian approaching 0 (#3304)
* Prevent Hessian in multiclass objective becoming zero

* Set default learning rate to 0.5 for "coord_descent" linear updater
2018-05-09 20:25:51 +12:00
Andrew V. Adinetz
b8a0d66fe6 Multi-GPU HostDeviceVector. (#3287)
* Multi-GPU HostDeviceVector.

- HostDeviceVector instances can now span multiple devices, defined by GPUSet struct
- the interface of HostDeviceVector has been modified accordingly
- GPU objective functions are now multi-GPU
- GPU predicting from cache is now multi-GPU
- avoiding omp_set_num_threads() calls
- other minor changes
2018-05-05 08:00:05 +12:00
Rory Mitchell
90a5c4db9d Update Jenkins CI for GPU (#3294) 2018-05-04 16:50:59 +12:00
Thejaswi
c80d51ccb3 Fix issue #3264, accuracy issues on k80 GPUs. (#3293) 2018-05-04 13:14:08 +12:00
Nan Zhu
e1f57b4417 [jvm-packages] scripts to cross-build and deploy artifacts to github (#3276)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* cross building files

* update

* build with docker

* remove

* temp

* update build script

* update pom

* update

* update version

* upload build

* fix path

* update README.md

* fix compiler version to 4.8.5
2018-04-28 07:41:30 -07:00
Yanbo Liang
4850f67b85 Fix broken link for xgboost-spark example. (#3275) 2018-04-26 06:45:01 -07:00
Thomas J. Leeper
c2b647f26e fix typo in README (#3263) 2018-04-22 09:24:38 -04:00
Nan Zhu
25b2919c44 [jvm-packages] change version of jvm to keep consistent with other pkgs (#3253)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* change version of jvm to keep consistent with other pkgs
2018-04-19 20:48:50 -07:00
Nan Zhu
d9dd485313 [jvm-packages] upgrade spark version to 2.3 (#3254)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* update default spark version to 2.3
2018-04-19 20:15:19 -07:00
Rory Mitchell
a185ddfe03 Implement GPU accelerated coordinate descent algorithm (#3178)
* Implement GPU accelerated coordinate descent algorithm. 

* Exclude external memory tests for GPU
2018-04-20 14:56:35 +12:00
Rory Mitchell
ccf80703ef Clang-tidy static analysis (#3222)
* Clang-tidy static analysis

* Modernise checks

* Google coding standard checks

* Identifier renaming according to Google style
2018-04-19 18:57:13 +12:00
Michal Josífko
3242b0a378 Update rabit submodule to latest version. (#3246) 2018-04-19 13:58:09 +12:00
Philip Hyunsu Cho
842e28fdcd Fix RMinGW build error: dependency 'data.table' not available (#3257)
The R package dependency 'data.table' is apparently unavailable in Windows binary format, resulting into the following build errors:
* https://ci.appveyor.com/project/tqchen/xgboost/build/1.0.1810/job/hhanvg0c2cqpn7bc
* https://ci.appveyor.com/project/tqchen/xgboost/build/1.0.1811/job/hg65t9wb3rt1f5k8

Fix: use type='both' to fall back to source when binary is unavailable
2018-04-18 10:56:44 -07:00
Philip Hyunsu Cho
230cb9b787 Release version 0.71 (#3200) 2018-04-11 21:43:32 +09:00
Nan Zhu
4109818b32 [jvm-packages] add back libsvm notes (#3232)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* add back libsvm notes
2018-04-10 09:00:58 -07:00
Rory Mitchell
443ff746e9 Fix logic in GPU predictor cache lookup (#3217)
* Fix logic in GPU predictor cache lookup

* Add sklearn test for GPU prediction
2018-04-04 15:08:22 +12:00
Rory Mitchell
a1ec7b1716 Change reduce operation from thrust to cub. Fix for cuda 9.1 error (#3218)
* Change reduce operation from thrust to cub. Fix for cuda 9.1 runtime error

* Unit test sum reduce
2018-04-04 14:21:48 +12:00
Philip Hyunsu Cho
017acf54d9 Fix up make pippack command for building source package for PyPI (#3199)
* Now `make pippack` works without any manual action: it will produce
  xgboost-[version].tar.gz, which one can use by typing
  `pip3 install xgboost-[version].tar.gz`.
* Detect OpenMP-capable compilers (clang, gcc-5, gcc-7) on MacOS
2018-03-28 10:32:52 -07:00
Tong He
ace4016c36 Replace cBind by cbind (#3203)
* modify test_helper.R

* fix noLD

* update desc

* fix solaris test

* fix desc

* improve fix

* fix url

* change Matrix cBind to cbind

* fix

* fix error in demo

* fix examples
2018-03-28 10:05:47 -07:00
Philip Hyunsu Cho
b087620661 Condense MinGW installation instruction (#3201) 2018-03-25 03:05:11 -07:00
Yuan (Terry) Tang
92782a8406 Change DESCRIPTION to more modern look (#3179)
So other things can be added in comment field, such as ORCID.
2018-03-23 10:45:10 -04:00
Arjan van der Velde
04221a7469 rank_metric: add AUC-PR (#3172)
* rank_metric: add AUC-PR

Implementation of the AUC-PR calculation for weighted data, proposed by Keilwagen, Grosse and Grau (https://doi.org/10.1371/journal.pone.0092209)

* rank_metric: fix lint warnings

* Implement tests for AUC-PR and fix implementation

* add aucpr to documentation for other languages
2018-03-23 10:43:47 -04:00
zhaocc
8fb3388af2 fix typo (#3188) 2018-03-21 19:24:29 -04:00
Will Storey
00d9728e4b Fix memory leak in XGDMatrixCreateFromMat_omp() (#3182)
* Fix memory leak in XGDMatrixCreateFromMat_omp()

This replaces the array allocated by new with a std::vector.

Fixes #3161
2018-03-18 15:03:27 +13:00
Will Storey
c85995952f Allow compilation with -Werror=strict-prototypes (#3183) 2018-03-18 12:25:42 +13:00
Rory Mitchell
9fa45d3a9c Fix bug with gpu_predictor caching behaviour (#3177)
* Fixes #3162
2018-03-18 10:35:10 +13:00
Ray Kim
cdc036b752 Fixed performance bug (#3171)
Minor performance improvements to gpu predictor
2018-03-15 09:40:24 +13:00
Rory Mitchell
7a81c87dfa Fix incorrect minimum value in quantile generation (#3167) 2018-03-14 08:21:18 -07:00
Vadim Khotilovich
706be4e5d4 Additional improvements for gblinear (#3134)
* fix rebase conflict

* [core] additional gblinear improvements

* [R] callback for gblinear coefficients history

* force eta=1 for gblinear python tests

* add top_k to GreedyFeatureSelector

* set eta=1 in shotgun test

* [core] fix SparsePage processing in gblinear; col-wise multithreading in greedy updater

* set sorted flag within TryInitColData

* gblinear tests: use scale, add external memory test

* fix multiclass for greedy updater

* fix whitespace

* fix typo
2018-03-13 01:27:13 -05:00
Andrew V. Adinetz
a1b48afa41 Added back UpdatePredictionCache() in updater_gpu_hist.cu. (#3120)
* Added back UpdatePredictionCache() in updater_gpu_hist.cu.

- it had been there before, but wasn't ported to the new version
  of updater_gpu_hist.cu
2018-03-09 15:06:45 +13:00
redditur
d5f1b74ef5 'hist': Montonic Constraints (#3085)
* Extended monotonic constraints support to 'hist' tree method.

* Added monotonic constraints tests.

* Fix the signature of NoConstraint::CalcSplitGain()

* Document monotonic constraint support in 'hist'

* Update signature of Update to account for latest refactor
2018-03-05 16:45:49 -08:00
Andrea Bergonzo
8937134015 Update build_trouble_shooting.md (#3144) 2018-03-02 16:23:45 -08:00
Philip Hyunsu Cho
32ea70c1c9 Documenting CSV loading into DMatrix (#3137)
* Support CSV file in DMatrix

We'd just need to expose the CSV parser in dmlc-core to the Python wrapper

* Revert extra code; document existing CSV support

CSV support is already there but undocumented

* Add notice about categorical features
2018-02-28 18:41:10 -08:00
Andrew V. Adinetz
d5992dd881 Replaced std::vector-based interfaces with HostDeviceVector-based interfaces. (#3116)
* Replaced std::vector-based interfaces with HostDeviceVector-based interfaces.

- replacement was performed in the learner, boosters, predictors,
  updaters, and objective functions
- only interfaces used in training were replaced;
  interfaces like PredictInstance() still use std::vector
- refactoring necessary for replacement of interfaces was also performed,
  such as using HostDeviceVector in prediction cache

* HostDeviceVector-based interfaces for custom objective function example plugin.
2018-02-28 13:00:04 +13:00
Yuan (Terry) Tang
11bfa8584d Remove unnecessary dependencies in distributed test (#3132) 2018-02-24 20:24:34 -05:00
Yuan (Terry) Tang
cf89fa7139 Remove additional "/" in external memory doc (#3131) 2018-02-24 14:27:03 -05:00
Yuan (Terry) Tang
5d4cc49080 Update GPU plug-in documentation link (#3130) 2018-02-24 13:37:12 -05:00
Philip Hyunsu Cho
3d7aff5697 Fix doc build (#3126)
* Fix doc build

ReadTheDocs build has been broken for a while due to incompatibilities between
commonmark, recommonmark, and sphinx. See:
* "Recommonmark not working with Sphinx 1.6"
  https://github.com/rtfd/recommonmark/issues/73
* "CommonMark 0.6.0 breaks compatibility"
  https://github.com/rtfd/recommonmark/issues/24
For now, we fix the versions to get the build working again

* Fix search bar
2018-02-21 16:57:30 -08:00
Dmitry Mottl
eb9e30bb30 Minor: fixed dropdown <li> width in xgboost.css (#3121) 2018-02-20 07:24:38 -08:00
Dmitry Mottl
20b733e1a0 Minor: removed extra parenthesis in doc (#3119) 2018-02-20 02:55:29 -08:00
tomisuker
8153ba6fe7 modify build guide from source on macOS (#2993)
* modify build guide from source on macOS

* fix; installation for macOS
2018-02-19 12:20:00 -08:00
Rory Mitchell
dd82b28e20 Update GPU code with dmatrix changes (#3117) 2018-02-17 12:11:48 +13:00
Rory Mitchell
10eb05a63a Refactor linear modelling and add new coordinate descent updater (#3103)
* Refactor linear modelling and add new coordinate descent updater

* Allow unsorted column iterator

* Add prediction cacheing to gblinear
2018-02-17 09:17:01 +13:00
Vadim Khotilovich
9ffe8596f2 [core] fix slow predict-caching with many classes (#3109)
* fix prediction caching inefficiency for multiclass

* silence some warnings

* redundant if

* workaround for R v3.4.3 bug; fixes #3081
2018-02-15 18:31:42 -06:00
Oleg Panichev
cf19caa46a Fix for ZeroDivisionError when verbose_eval equals to 0. (#3115) 2018-02-15 17:58:06 -06:00
Philip Hyunsu Cho
375d75304d Fix typos, addressing issues #2212 and #3090 (#3105) 2018-02-09 11:16:44 -08:00
Felipe Arruda Pontes
81d1b17f9c adding some docs based on core.Boost.predict (#1865) 2018-02-09 06:38:38 -08:00
cinqS
b99f56e386 added mingw64 installation instruction, and library file copy. (#2977)
* added mingw64 installation instruction, and library file copy.

* Change all `libxgboost.dll` to `xgboost.dll`

On Windows, the library file is called `xgboost.dll`, not `libxgboost.dll` as in the build doc previously
2018-02-09 01:54:15 -08:00
Abraham Zhan
874525c152 c_api.cc variable declared inapproiate (#3044)
In line 461, the "size_t offset = 0;" should be declared before any calculation, otherwise will cause compilation error. 

```
I:\Libraries\xgboost\src\c_api\c_api.cc(416): error C2146: Missing ";" before "offset" [I:\Libraries\xgboost\build\objxgboost.vcxproj]
```
2018-02-09 01:32:01 -08:00
Scott Lundberg
d878c36c84 Add SHAP interaction effects, fix minor bug, and add cox loss (#3043)
* Add interaction effects and cox loss

* Minimize whitespace changes

* Cox loss now no longer needs a pre-sorted dataset.

* Address code review comments

* Remove mem check, rename to pred_interactions, include bias

* Make lint happy

* More lint fixes

* Fix cox loss indexing

* Fix main effects and tests

* Fix lint

* Use half interaction values on the off-diagonals

* Fix lint again
2018-02-07 20:38:01 -06:00
Jonas
077abb35cd fix relative link to demo (#3066) 2018-02-07 01:09:03 -06:00
Vadim Khotilovich
94e655329f Replacing cout with LOG (#3076)
* change cout to LOG

* lint fix
2018-02-06 02:00:34 -06:00
Sergei Lebedev
7c99e90ecd [jvm-packages] Declared Spark as provided in the POM (#3093)
* [jvm-packages] Explicitly declared Spark dependencies as provided

* Removed noop spark-2.x profile
2018-02-05 10:06:06 -08:00
Peter M. Landwehr
86bf930497 Fix typo: cutomize -> customize (#3073) 2018-02-04 22:56:04 +01:00
Andrew V. Adinetz
24c2e41287 Fixed the bug with illegal memory access in test_large_sizes.py with 4 GPUs. (#3068)
- thrust::copy() called from dvec::copy() for gpairs invoked a GPU kernel instead of
  cudaMemcpy()
- this resulted in illegal memory access if the GPU running the kernel could not access
  the data being copied
- new version of dvec::copy() for thrust::device_ptr iterators calls cudaMemcpy(),
  avoiding the problem.
2018-02-01 16:54:46 +13:00
Tong He
98be9aef9a A fix for CRAN submission of version 0.7-0 (#3061)
* modify test_helper.R

* fix noLD

* update desc

* fix solaris test

* fix desc

* improve fix

* fix url
2018-01-27 17:06:28 -08:00
Vadim Khotilovich
c88bae112e change cmd to cmd.exe in appveyor (#3071) 2018-01-26 12:27:33 -06:00
tomasatdatabricks
5ef684641b Fixed SparkParallelTracker to work with Spark2.3 (#3062) 2018-01-25 04:31:38 +01:00
Rory Mitchell
f87802f00c Fix GPU bugs (#3051)
* Change uint to unsigned int

* Fix no root predictions bug

* Remove redundant splitting due to numerical instability
2018-01-23 13:14:15 +13:00
Yun Ni
8b2f4e2d39 [jvm-packages] Move cache files to TempDirectory and delete this directory after XGBoost job finishes (#3022)
* [jvm-packages] Move cache files to tmp dir and delete on exit

* Delete the cache dir when watches are deleted
2018-01-20 21:13:25 -08:00
Yun Ni
3f3f54bcad [jvm-packages] Update docs and unify the terminology (#3024)
* [jvm-packages] Move cache files to tmp dir and delete on exit

* [jvm-packages] Update docs and unify terminology

* Address CR Comments
2018-01-16 17:16:55 +01:00
Thejaswi
84ab74f3a5 Objective function evaluation on GPU with minimal PCIe transfers (#2935)
* Added GPU objective function and no-copy interface.

- xgboost::HostDeviceVector<T> syncs automatically between host and device
- no-copy interfaces have been added
- default implementations just sync the data to host
  and call the implementations with std::vector
- GPU objective function, predictor, histogram updater process data
  directly on GPU
2018-01-12 21:33:39 +13:00
Nan Zhu
a187ed6c8f [jvm-packages] tiny fix for empty partition in predict (#3014)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* tiny fix for empty partition in predict

* further fix
2018-01-07 08:34:18 -08:00
Yun Ni
740eba42f7 [jvm-packages] Add back the overriden finalize() method for SBooster (#3011)
* Convert SIGSEGV to XGBoostError

* Address CR Comments

* Address CR Comments
2018-01-06 14:07:37 -08:00
Yun Ni
65fb4e3f5c [jvm-packages] Prevent dispose being called on unfinalized JBooster (#3005)
* [jvm-packages] Prevent dispose being called twice when finalize

* Convert SIGSEGV to XGBoostError

* Avoid creating a new SBooster with the same JBooster

* Address CR Comments
2018-01-06 09:46:52 -08:00
Nan Zhu
9747ea2acb [jvm-packages] fix the pattern in dev script and version mismatch (#3009)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* fix the pattern in dev script and version mismatch
2018-01-06 06:59:38 -08:00
Zhirui Wang
bf43671841 update macOS gcc@5 installation guide (#3003)
After installing ``gcc@5``, ``CMAKE_C_COMPILER`` will not be set to gcc-5 in some macOS environment automatically and the installation of xgboost will still fail. Manually setting the compiler will solve the problem.
2018-01-04 11:28:26 -08:00
Nan Zhu
14c6392381 [jvm-packages] add dev script to update version and update versions (#2998)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* add dev script to update version and update versions
2018-01-01 21:28:53 -08:00
Vadim Khotilovich
526801cdb3 [R] fix for the 32 bit windows issue (#2994)
* [R] disable thred_local for 32bit windows

* [R] require C++11 and GNU make in DESCRIPTION

* [R] enable 32+64 build and check in appveyor
2017-12-31 14:18:50 -08:00
Philip Cho
4aa346c10b Update PyPI maintainer; use VERSION for binary wheels (#2992) 2017-12-31 12:03:08 +09:00
Philip Cho
3cef89e15e Tag version 0.7 (#2991)
Document all changes made in year 2017
2017-12-31 06:47:23 +09:00
Vladimir Surjaninov
3b09037e22 [Python] AppVeyor CI for Python wheel package (#2941)
* Build python wheel artifacts for Windows

* Remove Win32 target
2017-12-30 20:26:50 +08:00
csgwma
33ac8a0927 delete duplicated code in python-package (#2985) 2017-12-30 20:26:35 +08:00
Philip Cho
8d35c09c55 Tag version 0.7 (#2975)
* Tag version 0.7

* Document all changes made in year 2016
2017-12-30 20:16:41 +08:00
Nan Zhu
005a4a5e47 [jvm-packages] fix numAliveCores in SparkParallelismTracker when WebUI is disabled (#2990)
* add back train method but mark as deprecated

* add back train method but mark as deprecated

* fix scalastyle error

* fix scalastyle error

* update resource files

* Update SparkParallelismTracker.scala

* remove xgboost-tracker.properties
2017-12-29 19:22:58 -08:00
Yun Ni
9004ca03ca [jvm-packages] Saving models into a tmp folder every a few rounds (#2964)
* [jvm-packages] Train Booster from an existing model

* Align Scala API with Java API

* Existing model should not load rabit checkpoint

* Address minor comments

* Implement saving temporary boosters and loading previous booster

* Add more unit tests for loadPrevBooster

* Add params to XGBoostEstimator

* (1) Move repartition out of the temp model saving loop (2) Address CR comments

* Catch a corner case of training next model with fewer rounds

* Address comments

* Refactor newly added methods into TmpBoosterManager

* Add two files which is missing in previous commit

* Rename TmpBooster to checkpoint
2017-12-29 08:36:41 -08:00
Yuchao Dai
eedca8c8ec fix the typo in core.py (#2978) 2017-12-25 21:08:27 -08:00
Sergei Lebedev
7c6673cb9e [jvm-packages] Fixed test/train persistence (#2949)
* [jvm-packages] Fixed test/train persistence

Prior to this patch both data sets were persisted in the same directory,
i.e. the test data replaced the training one which led to

* training on less data (since usually test < train) and
* test loss being exactly equal to the training loss.

Closes #2945.

* Cleanup file cache after the training

* Addressed review comments
2017-12-19 07:11:48 -08:00
Rory Mitchell
7759ab99ee Fix Google test warnings and error (#2957) 2017-12-20 00:13:56 +13:00
Vadim Khotilovich
76f8f51438 [R] AppVeyor CI for R package (#2954)
* [R] fix finding R.exe with cmake on WIN when it is in PATH

* [R] appveyor config for R package

* [R] wrap the lines to make R check happier

* [R] install only binary dep-packages in appveyor

* [R] for MSVC appveyor, also build a binary for R package and keep as an artifact
2017-12-17 16:37:45 -06:00
Nan Zhu
4fa917b19f Update .travis.yml (#2951) 2017-12-15 13:09:36 -08:00
PSEUDOTENSOR / Jonathan McKinney
4d36036fe6 Avoid repeated cuda API call in GPU predictor and only synchronize used GPUs (#2936) 2017-12-09 16:00:42 +13:00
Vadim Khotilovich
e8a6597957 [R] maintenance Nov 2017; SHAP plots (#2888)
* [R] fix predict contributions for data with no colnames

* [R] add a render parameter for xgb.plot.multi.trees; fixes #2628

* [R] update Rd's

* [R] remove unnecessary dep-package from R cmake install

* silence type warnings; readability

* [R] silence complaint about incomplete line at the end

* [R] initial version of xgb.plot.shap()

* [R] more work on xgb.plot.shap

* [R] enforce black font in xgb.plot.tree; fixes #2640

* [R] if feature names are available, check in predict that they are the same; fixes #2857

* [R] cran check and lint fixes

* remove tabs

* [R] add references; a test for plot.shap
2017-12-05 09:45:34 -08:00
Rory Mitchell
1b77903eeb Fix several GPU bugs (#2916)
* Fix #2905

* Fix gpu_exact test failures

* Fix bug in GPU prediction where multiple calls to batch prediction can produce incorrect results

* Fix GPU documentation formatting
2017-12-04 08:27:49 +13:00
jac-stripe
1e3aabbadc Include symlinks to make wheel build work (#2909) 2017-12-01 11:27:58 -05:00
Katrin Leinweber
646db1528d simplify software citation (#2912)
* simplify software citation; answers #309

* fix import issues from dl.acm.org/citation.cfm?id=2939785's BibTeX
2017-12-01 02:58:13 -08:00
Rory Mitchell
c51adb49b6 Monotone constraints for gpu_hist (#2904) 2017-11-30 10:26:19 +13:00
Jerry Dumblauskas
5867c1b96d update doc string for grid parameter (#2647)
* update doc string for grid parameter

* update doc string for grid parameter
2017-11-29 11:22:46 -08:00
LevineHuang
878f307948 Fix minor typos (#2842)
* 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

* Fix minor typo

* Minor edits to coding style

Minor edits to coding style following the proposals of PEP8.
2017-11-29 11:22:09 -08:00
Rajiv Abraham
77715d5c62 Update to correct brew gcc command (#1931)
The previous command did not work for me. This one did.
2017-11-29 11:20:49 -08:00
EvanChong
790da458e7 Sync number of features after loaded matrix in different workers. (#2722) 2017-11-29 11:19:12 -08:00
Jay
bb097166b5 build.sh hints for errors related to: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path? (#2229)
* provide hints on how to build this on linux if a new user just clones the repository and is looking for help.

* add the recursive command example
2017-11-29 11:18:49 -08:00
avinocur
0ad20f8fe0 Parameterize host-ip to pass to tracker.py (#2831) 2017-11-29 11:14:34 -08:00
Sam O
602b34ab91 Fix performance of c_array in python core.py (#2786) 2017-11-29 11:12:49 -08:00
Viraj Navkal
9fbeeea46e Small fixes to notation in documentation (#2903)
* make every theta lowercase

* use uniform font and capitalization for function name
2017-11-28 13:32:35 -08:00
Rory Mitchell
c55f14668e Update gpu_hist algorithm (#2901) 2017-11-27 13:44:24 +13:00
Rory Mitchell
24f527a1c0 AVX gradients (#2878)
* AVX gradients

* Add google test for AVX

* Create fallback implementation, remove fma instruction

* Improved accuracy of AVX exp function
2017-11-27 08:56:01 +13:00
yskn67
3dcf966bc3 Fix XGDMatrixFree argument type (#2898) 2017-11-23 10:49:05 -08:00
tomisuker
70a4c419e9 FIX typo in doc (#2892)
* FIX link

* typo
2017-11-21 18:04:48 +01:00
Sergei Lebedev
8e141427aa [jvm-packages] Exposed train-time evaluation metrics (#2836)
* [jvm-packages] Exposed train-time evaluation metrics

They are accessible via 'XGBoostModel.summary'. The summary is not
serialized with the model and is only available after the training.

* Addressed review comments

* Extracted model-related tests into 'XGBoostModelSuite'

* Added tests for copying the 'XGBoostModel'

* [jvm-packages] Fixed a subtle bug in train/test split

Iterator.partition (naturally) assumes that the predicate is deterministic
but this is not the case for

    r.nextDouble() <= trainTestRatio

therefore sometimes the DMatrix(...) call got a NoSuchElementException
and crashed the JVM due to lack of exception handling in
XGBoost4jCallbackDataIterNext.

* Make sure train/test objectives are different
2017-11-20 22:21:54 +01:00
Joe Nyland
88177691b8 Update README (#2204)
I found the installation of the Python XGBoost package to be problematic as the documentation around compiler requirements was unclear, as discussed in #1501. I decided that I would improve the README.
2017-11-19 17:12:16 -08:00
Rory Mitchell
40c6e2f0c8 Improved gpu_hist_experimental algorithm (#2866)
- Implement colsampling, subsampling for gpu_hist_experimental

 - Optimised multi-GPU implementation for gpu_hist_experimental

 - Make nccl optional

 - Add Volta architecture flag

 - Optimise RegLossObj

 - Add timing utilities for debug verbose mode

 - Bump required cuda version to 8.0
2017-11-11 13:58:40 +13:00
Rory Mitchell
16c63f30d0 Fix MultiIndex detection (breaks for latest pandas==0.21.0). (#2872) 2017-11-11 11:12:23 +13:00
Dat Le
77ae4c8701 Update OSX build instructions (#2784)
* Update xgboost build for OS X

* Add notes on gcc and brew

* Update build.md

* Update build.md

* Update build.md
2017-11-06 13:07:10 +01:00
ebernhardson
78d0bd6c9d [jvm-packages] Repair spark model eval (#2841)
In the refactor to add base margins, #2532, all of the labels were lost
when creating the dmatrix. This became obvious as metrics like ndcg
always returned 1.0 regardless of the results.

Change-Id: I88be047e1c108afba4784bd3d892bfc9edeabe55
2017-11-04 23:28:47 +01:00
Seth Hendrickson
a8f670d247 [jvm-packages] Add some documentation to xgboost4j-spark plus minor style edits (#2823)
* add scala docs to several methods

* indentation

* license formatting

* clarify distributed boosters

* address some review comments

* reduce doc lengths

* change method name, clarify  doc

* reset make config

* delete most comments

* more review feedback
2017-11-02 13:16:02 -07:00
ebernhardson
46f2b820f1 [jvm-packages] Objectives starting with rank: are never classification (#2837)
Training a model with the experimental rank:ndcg objective incorrectly
returns a Classification model. Adjust the classification check to
not recognize rank:* objectives as classification.

While writing tests for isClassificationTask also turned up that
obj_type -> regression was incorrectly identified as a classification
task so the function was slightly adjusted to pass the new tests.
2017-10-30 17:36:03 +01:00
LevineHuang
91af8f7106 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
2017-10-26 22:12:54 -05:00
Rory Mitchell
d9d5293cdb Add warnings for large labels when using GPU histogram algorithms (#2834) 2017-10-26 17:31:10 +13:00
Rory Mitchell
13e7a2cff0 Various bug fixes (#2825)
* Fatal error if GPU algorithm selected without GPU support compiled

* Resolve type conversion warnings

* Fix gpu unit test failure

* Fix compressed iterator edge case

* Fix python unit test failures due to flake8 update on pip
2017-10-25 14:45:01 +13:00
LevineHuang
c71b62d48d Minor changes to code style (#2805)
Some minor changes to code style in file 'boost_from_prediction.py'.
2017-10-23 10:46:45 -05:00
Philip Cho
452063c32d Fix issue #2800 (#2817)
Problem:
Fast histogram updater crashes whenever subsampling picks zero rows

Diagnosis:
Row set data structure uses "nullptr" internally to indicate a non-existent
row set. Since you cannot take the address of the first element of an empty
vector, a valid row set ends up getting "nullptr" as well.

Fix:
Use an arbitrary value (not equal to "nullptr") to bypass nullptr check.
2017-10-23 10:46:25 -05:00
caoyi
3610025fb6 Fix typo (#2818)
Fix typo
2017-10-23 10:45:49 -05:00
Seth Hendrickson
ac7a9edb06 remove stale examples (#2816) 2017-10-20 23:18:46 +02:00
Qiang Luo
c09ad421a8 fix bug in loading config for pred task (#2795) 2017-10-20 00:10:14 -05:00
erikdf
5dca6745e1 Fixed typo in doc (#2799) 2017-10-18 18:20:47 -05:00
Justin Mills
b1793da30e Only set OpenMP_CXX_FLAGS when OpenMP is found (#2613)
* Only set OpenMP_CXX_FLAGS when OpenMP is found

I found this trying to get the Mac build working without OpenMP. Tips in
issue #2596 helped to point in the right direction.

* Revise check

* Trigger codecov
2017-10-16 23:02:13 -05:00
Yun Ni
b678e1711d [jvm-packages] Add SparkParallelismTracker to prevent job from hanging (#2697)
* Add SparkParallelismTracker to prevent job from hanging

* Code review comments

* Code Review Comments

* Fix unit tests

* Changes and unit test to catch the corner case.

* Update documentations

* Small improvements

* cancalAllJobs is problematic with scalatest. Remove it

* Code Review Comments

* Check number of executor cores beforehand, and throw exeception if any core is lost.

* Address CR Comments

* Add missing class

* Fix flaky unit test

* Address CR comments

* Remove redundant param for TaskFailedListener
2017-10-16 20:18:47 -07:00
Scott Lundberg
78c4188cec SHAP values for feature contributions (#2438)
* SHAP values for feature contributions

* Fix commenting error

* New polynomial time SHAP value estimation algorithm

* Update API to support SHAP values

* Fix merge conflicts with updates in master

* Correct submodule hashes

* Fix variable sized stack allocation

* Make lint happy

* Add docs

* Fix typo

* Adjust tolerances

* Remove unneeded def

* Fixed cpp test setup

* Updated R API and cleaned up

* Fixed test typo
2017-10-12 12:35:51 -07:00
Guang Wei Yu
ff9180cd73 Add a new winning solution to demo/README.md (#2778) 2017-10-09 18:07:07 -04:00
Julian Niedermeier
9a81c74a7b Add xgb_model parameter to sklearn fit (#2623)
Adding xgb_model paramter allows the continuation of model training.
Model has to be saved by calling `model.get_booster().save_model(path)`
2017-10-01 08:47:17 -04:00
Icyblade Dai
6e378452f2 coding style update (#2752)
* coding style update

Current coding style varies(for example: the mixed use of single quote and double quote), and it will be confusing, especially for new users.
This PR will try to follow proposal of PEP8, make the documents more readable.

* minor fix
2017-10-01 08:42:15 -04:00
Rory Mitchell
4cb2f7598b -Add experimental GPU algorithm for lossguided mode (#2755)
-Improved GPU algorithm unit tests
-Removed some thrust code to improve compile times
2017-10-01 00:18:35 +13:00
Sergei Lebedev
69c3b78a29 [jvm-packages] Implemented early stopping (#2710)
* Allowed subsampling test from the training data frame/RDD

The implementation requires storing 1 - trainTestRatio points in memory
to make the sampling work.

An alternative approach would be to construct the full DMatrix and then
slice it deterministically into train/test. The peak memory consumption
of such scenario, however, is twice the dataset size.

* Removed duplication from 'XGBoost.train'

Scala callers can (and should) use names to supply a subset of
parameters. Method overloading is not required.

* Reuse XGBoost seed parameter to stabilize train/test splitting

* Added early stopping support to non-distributed XGBoost

Closes #1544

* Added early-stopping to distributed XGBoost

* Moved construction of 'watches' into a separate method

This commit also fixes the handling of 'baseMargin' which previously
was not added to the validation matrix.

* Addressed review comments
2017-09-29 12:06:22 -07:00
Vadim Khotilovich
74db9757b3 [R package] GPU support (#2732)
* [R] MSVC compatibility

* [GPU] allow seed in BernoulliRng up to size_t and scale to uint32_t

* R package build with cmake and CUDA

* R package CUDA build fixes and cleanups

* always export the R package native initialization routine on windows

* update the install instructions doc

* fix lint

* use static_cast directly to set BernoulliRng seed

* [R] demo for GPU accelerated algorithm

* tidy up the R package cmake stuff

* R pack cmake: installs main dependency packages if needed

* [R] version bump in DESCRIPTION

* update NEWS

* added short missing/sparse values explanations to FAQ
2017-09-28 18:15:28 -05:00
Icyblade Dai
5c9f01d0a9 minor typo (#2751)
* minor typo

* typo

* Update discoverYourData.md
2017-09-28 07:45:10 +02:00
Andrew Hannigan
5c9f0ff9d9 Check existance of seed/nthread keys before checking their value. (#2669) 2017-09-27 03:05:59 -04:00
Philip Cho
0eaf43a5e1 A hack to fix broken search bar in doc (#2583)
Current version of xgboost.readthedocs.io has a broken search box.
Enabling themes on ReadTheDocs is known to break the search function, as
reported in
[this document](https://github.com/rtfd/readthedocs.org/issues/1487). To get
around the bug, we replace the `searchtools.js` file with our custom version.
2017-09-27 03:05:10 -04:00
Philip Cho
31ad40b963 Make __del__ method idempotent (#2627)
Addresses Issue #2533.
2017-09-27 03:03:55 -04:00
Tsukasa OMOTO
8d15024ac7 python: follow the default warning filters of Python (#2666)
* python: follow the default warning filters of Python

https://docs.python.org/3/library/warnings.html#default-warning-filters

* update tests

* update tests
2017-09-27 03:03:01 -04:00
zhxfl
178517524f fix bug for demo/multiclass_classification/train.py (#2747) 2017-09-25 22:37:21 -05:00
Sergei Lebedev
d570337262 [jvm-packages] (xgboost-spark) preserving num_class across save & load (#2742)
* [bugfix] (xgboost-spark) preserving num_class across save & load

* add testcase for save & load of multiclass model
2017-09-24 16:03:30 +02:00
Dmitry Mottl
c09204fa70 Update faq.md (#2727)
Changed dead link to actual one
2017-09-20 08:17:42 +02:00
Icyblade Dai
0e85b30fdd Fix issue 2670 (#2671)
* fix issue 2670

* add python<3.6 compatibility

* fix Index

* fix Index/MultiIndex

* fix lint

* fix W0622

really nonsense

* fix lambda

* Trigger Travis

* add test for MultiIndex

* remove tailing whitespace
2017-09-19 15:49:41 -04:00
Dmitry Mottl
ee80f348de Fixed links in faq.md (#2726) 2017-09-19 09:23:24 -07:00
Nan Zhu
1190dc62a7 Update CONTRIBUTORS.md (#2719) 2017-09-17 15:07:57 -07:00
Rory Mitchell
55ba362154 Fix cuda 9.0 compilation (#2718) 2017-09-17 17:13:11 +12:00
Mahmoud Rawas
a7ce4d2462 Returning back LabeledPoint into public, in referece to the discussion in : https://github.com/dmlc/xgboost/pull/2532#discussion_r137172759 (#2677) 2017-09-10 20:45:43 -07:00
Rory Mitchell
9c85903f0b Add GPU documentation (#2695)
* Add GPU documentation

* Update Python GPU tests
2017-09-10 19:42:46 +12:00
Rory Mitchell
e6a9063344 Integer gradient summation for GPU histogram algorithm. (#2681) 2017-09-08 15:07:29 +12:00
Rory Mitchell
15267eedf2 [GPU-Plugin] Major refactor 2 (#2664)
* Change cmake option

* Move source files

* Move google tests

* Move python tests

* Move benchmarks

* Move documentation

* Remove makefile support

* Fix test run

* Move GPU tests
2017-09-08 09:57:16 +12:00
Yun Ni
8244f6f120 Use Sudo-enabled VM which has 7.5GB memory (#2680) 2017-09-07 08:36:37 -07:00
Yun Ni
f04bde05fd Add Coverage Report for Java and Python (#2667)
* Add coverage report for java

* Add coverage report for python

* Increase memory for JVM unit tests

* Increase memory for JVM unit tests
2017-09-05 14:46:51 -07:00
SimonAB
2e9d06443e Add show_values option to feature importances plot (#2351)
Adding an option to remove the values from the features importances plot in Python.
2017-08-31 12:26:54 -05:00
PSEUDOTENSOR / Jonathan McKinney
0664298bb2 Update sklearn API to pass along n_jobs to DMatrix creation (#2658) 2017-08-31 15:24:59 +12:00
Rory Mitchell
19a53814ce [GPU-Plugin] Major refactor (#2644)
* Removal of redundant code/files.
* Removal of exact namespace in GPU plugin
* Revert double precision histograms to single precision for performance on Maxwell/Kepler
2017-08-30 10:53:52 +12:00
Sergei Lebedev
39adba51c5 Fixed compilation on Scala 2.10 (#2629) 2017-08-28 10:59:39 -07:00
Yun Ni
a00157543d Support instance weights for xgboost4j-spark (#2642)
* Support instance weights for xgboost4j-spark

* Use 0.001 instead of 0 for weights

* Address CR comments
2017-08-28 09:03:20 -07:00
Evan Culver
ba16475c3a Fix past participle tense in docs (#2637) 2017-08-25 14:16:57 +02:00
Rory Mitchell
70071fc38c Fix demo typo (#2632) 2017-08-23 17:21:51 +02:00
Boris Kostenko
cd366ecb4b fix build in case of spaces in path to make (#2619) 2017-08-23 02:29:33 -03:00
Rory Mitchell
332b26df95 Update GPU acceleration demo (#2617)
* Update GPU acceleration demo

* Fix parameter formatting
2017-08-19 21:27:48 +12:00
Rory Mitchell
5661a67d20 Add parallel sort for MSVC (#2609) 2017-08-17 17:14:39 +12:00
Rory Mitchell
ef23e424f1 [GPU-Plugin] Add GPU accelerated prediction (#2593)
* [GPU-Plugin] Add GPU accelerated prediction

* Improve allocation message

* Update documentation

* Resolve linker error for predictor

* Add unit tests
2017-08-16 12:31:59 +12:00
Rory Mitchell
71e5e622b1 Update cub submodule again (fixes GPU build) (#2599) 2017-08-13 22:14:40 +12:00
Rory Mitchell
ac2d0d0ac5 Updated cub submodule reference (#2597) 2017-08-12 23:00:56 -07:00
Vadim Khotilovich
e04e2fbe2c revert shallow submodule for cub (#2591) 2017-08-11 20:19:04 -07:00
Sergei Lebedev
771a95aec6 [jvm-packages] Added baseMargin to ml.dmlc.xgboost4j.LabeledPoint (#2532)
* Converted ml.dmlc.xgboost4j.LabeledPoint to Scala

This allows to easily integrate LabeledPoint with Spark DataFrame APIs,
which support encoding/decoding case classes out of the box. Alternative
solution would be to keep LabeledPoint in Java and make it a Bean by
generating boilerplate getters/setters. I have decided against that, even
thought the conversion in this PR implies a public API change.

I also had to remove the factory methods fromSparseVector and
fromDenseVector because a) they would need to be duplicated to support
overloaded calls with extra data (e.g. weight); and b) Scala would expose
them via mangled $.MODULE$ which looks ugly in Java.

Additionally, this commit makes it possible to switch to LabeledPoint in
all public APIs and effectively to pass initial margin/group as part of
the point. This seems to be the only reliable way of implementing distributed
learning with these data. Note that group size format used by single-node
XGBoost is not compatible with that scenario, since the partition split
could divide a group into two chunks.

* Switched to ml.dmlc.xgboost4j.LabeledPoint in RDD-based public APIs

Note that DataFrame-based and Flink APIs are not affected by this change.

* Removed baseMargin argument in favour of the LabeledPoint field

* Do a single pass over the partition in buildDistributedBoosters

Note that there is no formal guarantee that

    val repartitioned = rdd.repartition(42)
    repartitioned.zipPartitions(repartitioned.map(_ + 1)) { it1, it2, => ... }

would do a single shuffle, but in practice it seems to be always the case.

* Exposed baseMargin in DataFrame-based API

* Addressed review comments

* Pass baseMargin to XGBoost.trainWithDataFrame via params

* Reverted MLLabeledPoint in Spark APIs

As discussed, baseMargin would only be supported for DataFrame-based APIs.

* Cleaned up baseMargin tests

- Removed RDD-based test, since the option is no longer exposed via
  public APIs
- Changed DataFrame-based one to check that adding a margin actually
  affects the prediction

* Pleased Scalastyle

* Addressed more review comments

* Pleased scalastyle again

* Fixed XGBoost.fromBaseMarginsToArray

which always returned an array of NaNs even if base margin was not
specified. Surprisingly this only failed a few tests.
2017-08-10 14:29:26 -07:00
PSEUDOTENSOR / Jonathan McKinney
c1104f7d0a [GPU-Plugin] Add throw of asserts and added compute compatibility error check. (#2565)
* [GPU-Plugin] Added compute compatibility error check, added verbose timing
2017-08-10 16:07:07 +12:00
René Scheibe
75ea07b847 Fix parameter documentation inconsistencies (#2584)
* fix indentation - otherwise list items are rendered incorrectly
* consistency: no spaces inside square brackets
2017-08-07 19:07:10 +02:00
René Scheibe
a0c5bde024 Fix typo in sklearn documentation (#2580) 2017-08-07 19:06:11 +02:00
Vadim Khotilovich
2b3a4318c5 Several fixes (#2572)
* repared serialization after update process; fixes #2545

* non-stratified folds in python could omit some data instances

* Makefile: fixes for older makes on windows; clean R-package too

* make cub to be a shallow submodule

* improve $(MAKE) recovery
2017-08-06 13:03:50 -05:00
Philip Cho
70b65a282c Use jQuery 2.2.4 (#2581) 2017-08-05 15:37:38 -07:00
Rory Mitchell
eda9e180f0 [GPU-Plugin] Various fixes (#2579)
* Fix test large

* Add check for max_depth 0

* Update readme

* Add LBS specialisation for dense data

* Add bst_gpair_precise

* Temporarily disable accuracy tests on test_large.py

* Solve unused variable compiler warning

* Fix max_bin > 1024 error
2017-08-05 22:16:23 +12:00
Philip Cho
03e213c7cd Fix documentation for a misspelled parameter (#2569) 2017-08-02 21:50:09 +12:00
Rory Mitchell
0e06d1805d [WIP] Extract prediction into separate interface (#2531)
* [WIP] Extract prediction into separate interface

* Add copyright, fix linter errors

* Add predictor to amalgamation

* Fix documentation

* Move prediction cache into predictor, add GBTreeModel

* Updated predictor doc comments
2017-07-28 17:01:03 -07:00
Vadim Khotilovich
00eda28b3c MinGW: shared library prefix and appveyor CI (#2539)
* for MinGW, drop the 'lib' prefix from shared library name

* fix defines for 'g++ 4.8 or higher' to include g++ >= 5

* fix compile warnings

* [Appveyor] add MinGW with python; remove redundant jobs

* [Appveyor] also do python build for one of msvc jobs
2017-07-25 01:06:47 -05:00
Sergei Lebedev
d41dc078b6 [jvm-packages] Mentioned CMake in the docs (#2529) 2017-07-23 21:57:31 -07:00
Qiang Kou (KK)
4f3539b913 To compile on ARM cpu (#2513) 2017-07-21 21:16:30 -07:00
PSEUDOTENSOR / Jonathan McKinney
6b375f6ad8 Multi-threaded XGDMatrixCreateFromMat for faster DMatrix creation (#2530)
* Multi-threaded XGDMatrixCreateFromMat for faster DMatrix creation from numpy arrays for python interface.
2017-07-21 14:43:17 +12:00
Rory Mitchell
56550ff3f1 Fix pylint (#2537) 2017-07-21 11:41:56 +12:00
Sergei Lebedev
4eb255262f [jvm-packages] More brooming in tests (#2517)
* Deduplicated DataFrame creation in XGBoostDFSuite

* Extracted dermatology.data into MultiClassification

* Moved cache cleaning to SharedSparkContext

Cache files are prefixed with appName therefore this seems to be just the
place to delete them.

* Removed redundant JMatrix calls in xgboost4j-spark

* Slightly more readable buildDenseRDD in XGBoostGeneralSuite

* Generalized train/test DataFrame construction in XGBoostDFSuite

* Changed SharedSparkContext to setup a new context per-test

Hence the new name: PerTestSparkSession :)

* Fused Utils into PerTestSparkSession

* Whitespace fix in XGBoostDFSuite

* Ensure SparkSession is always eagerly created in PerTestSparkSession

* Renamed PerTestSparkSession->PerTest

because it was doing slightly more than creating/stopping the session.
2017-07-18 13:08:48 -07:00
PSEUDOTENSOR / Jonathan McKinney
ca7fc9fda3 [GPU-Plugin] Fix gpu_hist to allow matrices with more than just 2^{32} elements. Also fixed CPU hist algorithm. (#2518) 2017-07-18 11:19:27 +12:00
Rory Mitchell
c85bf9859e [GPU-Plugin] Improved load balancing search (#2521) 2017-07-17 11:50:57 +12:00
Michal Malohlava
33ee7d1615 [BUILD] Dockerfile and Jenkinsfile revisited (#2514)
Includes:
  - Dockerfile changes
    - Dockerfile clean up
    - Fix execution privileges of files used from Dockerfile.
    - New Dockerfile entrypoint to replace with_user script
    - Defined a placeholders for CPU testing (script and Dockerfile)
  - Jenkinsfile
    - Jenkins file milestone defined
    - Single source code checkout and propagation via stash/unstash
    - Bash needs to be explicitly used in launching make build, since we need
access to environment
    - Jenkinsfile build factory for cmake and make style of jobs
    - Archivation of artifacts (*.so, *.whl, *.egg) produced by cmake build

Missing:
  - CPU testing
  - Python3 env build and testing
2017-07-13 17:51:47 +12:00
Sergei Lebedev
66874f5777 [jvm-packages] Deduplicated train/test data access in tests (#2507)
* [jvm-packages] Deduplicated train/test data access in tests

All datasets are now available via a unified API, e.g. Agaricus.test.
The only exception is the dermatology data which requires parsing a
CSV file.

* Inlined Utils.buildTrainingRDD

The default number of partitions for local mode is equal to the number
of available CPUs.

* Replaced dataset names with problem types
2017-07-12 09:13:55 -07:00
Rory Mitchell
530f01e21c [GPU-Plugin] Add load balancing search to gpu_hist. Add compressed iterator. (#2504) 2017-07-11 22:36:39 +12:00
Philip Cho
64c8f6fa6d Use old parallel algorithm for histogram construction by default (#2501)
It has been reported that new parallel algorithm (#2493) results in excessive
message usage (see issue #2326). Until issues are resolved, XGBoost should use
the old parallel algorithm by default. The user would have to specify
`enable_feature_grouping=1` manually to enable the new algorithm.
2017-07-10 09:35:48 -07:00
Jeff Macaluso
be1f76a06a Fixed Spacing (#2498)
Fixed spacing under "Model Complexity" section
2017-07-08 09:17:45 -07:00
Vadim Khotilovich
7350085955 Fix broken make on windows (#2499)
* fix Makefile for make on windows

* clean up compilation warnings

* fix for `no file name for include` make warning
2017-07-08 09:17:31 -07:00
Philip Cho
ba820847f9 Patch to improve multithreaded performance scaling (#2493)
* Patch to improve multithreaded performance scaling

Change parallel strategy for histogram construction.
Instead of partitioning data rows among multiple threads, partition feature
columns instead. Useful heuristics for assigning partitions have been adopted
from LightGBM project.

* Add missing header to satisfy MSVC

* Restore max_bin and related parameters to TrainParam

* Fix lint error

* inline functions do not require static keyword

* Feature grouping algorithm accepting FastHistParam

Feature grouping algorithm accepts many parameters (3+), and it gets annoying to
pass them one by one. Instead, simply pass the reference to FastHistParam. The
definition of FastHistParam has been moved to a separate header file to
accomodate this change.
2017-07-07 08:25:07 -07:00
Rory Mitchell
6bfc472bec Update nccl (#2494) 2017-07-07 12:36:26 +12:00
Qiang Kou (KK)
e7530bdffc Not use -msse2 on power or arm arch. close #2446 (#2475) 2017-07-06 20:06:55 -04:00
69guitar1015
9091493250 Update bosch.py (#2482)
- fix deprecated expression on StratifiedKFold
- use range instead of xrange
2017-07-06 20:05:09 -04:00
Rory Mitchell
e939192978 Cmake improvements (#2487)
* Cmake improvements
* Add google test to cmake
2017-07-06 18:05:11 +12:00
Sergei Lebedev
8ceeb32bad Fixed a signature of XGBoostModel.predict (#2476)
Prior to this commit XGBoostModel.predict produced an RDD with
an array of predictions for each partition, effectively changing
the shape wrt the input RDD. A more natural contract for prediction
API is that given an RDD it returns a new RDD with the same number
of elements. This allows the users to easily match inputs with
predictions.

This commit removes one layer of nesting in XGBoostModel.predict output.
Even though the change is clearly non-backward compatible, I still
think it is well justified. See discussion in 06bd5dca for motivation.
2017-07-02 21:42:46 -07:00
Rory Mitchell
ed8bc4521e [GPU-Plugin] Resolve double compilation issue (#2479) 2017-07-03 13:29:10 +12:00
Rory Mitchell
5f1b0bb386 [GPU-Plugin] Unify gpu_gpair/bst_gpair. Refactor. (#2477) 2017-07-01 17:31:13 +12:00
Sergei Lebedev
d535340459 [jvm-packages] Exposed baseMargin (#2450)
* Disabled excessive Spark logging in tests

* Fixed a singature of XGBoostModel.predict

Prior to this commit XGBoostModel.predict produced an RDD with
an array of predictions for each partition, effectively changing
the shape wrt the input RDD. A more natural contract for prediction
API is that given an RDD it returns a new RDD with the same number
of elements. This allows the users to easily match inputs with
predictions.

This commit removes one layer of nesting in XGBoostModel.predict output.
Even though the change is clearly non-backward compatible, I still
think it is well justified.

* Removed boxing in XGBoost.fromDenseToSparseLabeledPoints

* Inlined XGBoost.repartitionData

An if is more explicit than an opaque method name.

* Moved XGBoost.convertBoosterToXGBoostModel to XGBoostModel

* Check the input dimension in DMatrix.setBaseMargin

Prior to this commit providing an array of incorrect dimensions would
have resulted in memory corruption. Maybe backport this to C++?

* Reduced nesting in XGBoost.buildDistributedBoosters

* Ensured consistent naming of the params map

* Cleaned up DataBatch to make it easier to comprehend

* Made scalastyle happy

* Added baseMargin to XGBoost.train and trainWithRDD

* Deprecated XGBoost.train

It is ambiguous and work only for RDDs.

* Addressed review comments

* Revert "Fixed a singature of XGBoostModel.predict"

This reverts commit 06bd5dcae7780265dd57e93ed7d4135f4e78f9b4.

* Addressed more review comments

* Fixed NullPointerException in buildDistributedBoosters
2017-06-30 08:27:24 -07:00
PSEUDOTENSOR / Jonathan McKinney
6b287177c8 [GPU-Plugin] Multi-GPU gpu_id bug fixes for grow_gpu_hist and grow_gpu methods, and additional documentation for the gpu plugin. (#2463) 2017-06-30 20:04:17 +12:00
Yaguang
91dae84a00 Update URL for "Multiclass logloss". (#2469)
The original URL shows 404 Error.
2017-06-30 08:06:09 +02:00
Rory Mitchell
48f3003302 [GPU-Plugin] Change GPU plugin to use tree_method parameter, bump cmake version to 3.5 for GPU plugin, add compute architecture 3.5, remove unused cmake files (#2455) 2017-06-29 16:19:45 +12:00
Sergei Lebedev
88488fdbb9 Fixed shared library loading in the Python package (#2461)
* Fixed DLL name on Windows in ``xgboost.libpath``

* Added support for OS X to ``xgboost.libpath``

* Use .dylib for shared library on OS X

This does not affect the JNI library, because it is not trully
cross-platform in the Makefile-build anyway.
2017-06-29 11:50:50 +12:00
Edi Bice
2911597f3d [jvm-packages] Expose prediction feature contribution on the Java side (#2441)
* Exposed prediction feature contribution on the Java side

* was not supplying the newly added argument

* Exposed from Scala-side as well

* formatting (keep declaration in one line unless exceeding 100 chars)
2017-06-28 13:34:51 -07:00
Sergei Lebedev
d01a31088b [jvm-packages] Test xgboost4j on Windows (#2451) 2017-06-26 11:19:18 -07:00
Zex Li
9bcbaa8869 Add build failure message (#2397)
* Add build failure message

* quit on error
2017-06-25 22:32:11 -04:00
Ryuichi Yamamoto
70ba492eb7 doc: Fix broken links in contribute.md (#2435) 2017-06-25 22:31:14 -04:00
Sergei Lebedev
91e778c6db [jvm-packages] JNI Cosmetics (#2448)
* [jvm-packages] Ensure the native library is loaded once

Previously any class using XGBoostJNI queried NativeLibLoader to make
sure the native library is loaded. This commit moves the initXGBoost
call to XGBoostJNI, effectively delegating the initialization to the class
loader.

Note also, that now XGBoostJNI would NOT suppress an IOException if it
occured in initXGBoost.

* [jvm-packages] Fused JNIErrorHandle with XGBoostJNI

There was no reason for having a separate class.
2017-06-23 11:49:30 -07:00
Rory Mitchell
0e48f87529 [GPU-Plugin] Make node_idx type 32 bit for hist algo. Set default n_gpus to 1. (#2445) 2017-06-23 18:26:45 +12:00
ebernhardson
169c983b5f [jvm-packages] Release dmatrix when no longer needed (#2436)
When using xgboost4j-spark I had executors getting killed much more
often than i would expect by yarn for overrunning their memory limits,
based on the memoryOverhead provided. It looks like a significant
amount of this is because dmatrix's were being created but not released,
because they were only released when the GC decided it was time to
cleanup the references.

Rather than waiting for the GC, relesae the DMatrix's when we know
they are no longer necessary.
2017-06-22 09:20:55 -07:00
Rory Mitchell
1899f9e744 [GPU-Plugin] Add basic continuous integration for GPU plugin. (#2431) 2017-06-22 10:15:28 -04:00
Sergei Lebedev
2cb51f7097 [jvm-packages] Another pack of build/CI improvements (#2422)
* [jvm-packages] Fixed compilation on Windows

* [jvm-packages] Build the JNI bindings on Appveyor

* [jvm-packages] Build & test on OS X

* [jvm-packages] Re-applied the CMake build changes reverted by #2395

* Fixed Appveyor JVM build

* Muted Maven on Travis

* Don't link with libawt

* "linux2"->"linux"

Python2.x and 3.X use slightly different values for ``sys.platform``.
2017-06-21 12:28:35 -07:00
Alfredo Cambera
46b9889cc5 Update build_trouble_shooting.md (#2430)
I had to fight with my linux box for a day to find the solution to the problem. I hope than this may help other users to save some time.
2017-06-20 21:36:10 -07:00
Pierre PACI
ee3d680e89 Fix Typo in documentation (#2416)
The objective section was missing a space and thus all the bullet were are the same level.
2017-06-17 09:22:59 -07:00
Bernie Gray
cd7659937b [R] many minor changes to increase the robustness of the R code (#2404)
* many minor changes to increase robustness of R code

* fixing which mistake in xgb.model.dt.tree.R and a few cosmetics
2017-06-15 22:56:23 -05:00
Sergei Lebedev
0db37c05bd [jvm-packages] Deterministically XGBoost training on exception (#2405)
Previously the code relied on the tracker process being terminated
by the OS, which was not the case on Windows.

Closes #2394
2017-06-12 20:19:28 -07:00
Thejaswi
34dfe2f6de [GPU-Plugin] Support for building to specific GPU architectures (#2390)
* Support for builing gpu-plugins to specific GPU architectures
1. Option GPU_COMPUTE_VER exposed from both Makefile and CMakeLists.txt
2. updater_gpu documentation updated accordingly

* Re-introduced GPU_COMPUTE_VER option in the cmake flow.
This seems to fix the compile-time, rdc=true and copy-constructor related
errors seen and discussed in PR #2390.
2017-06-13 09:51:38 +12:00
wxchan
65d2513714 [python-package] fix sklearn n_jobs/nthreads and seed/random_state bug (#2378)
* add a testcase causing RuntimeError

* move seed/random_state/nthread/n_jobs check to get_xgb_params()

* fix failed test
2017-06-12 09:33:42 -04:00
PSEUDOTENSOR / Jonathan McKinney
41efe32aa5 [GPU-Plugin] Multi-GPU for grow_gpu_hist histogram method using NVIDIA NCCL. (#2395) 2017-06-12 05:06:08 +12:00
Nan Zhu
e24f25e0c6 add Qubole example (#2401) 2017-06-09 20:33:26 -07:00
Sergei Lebedev
3820ab6a0b [jvm-packages] Minor improvements to the CMake build (#2379)
* [jvm-packages] Fixed JNI_OnLoad overload

It does not compile on Windows without proper export flags.

* [jvm-packages] Use JNI types directly where appropriate

* Removed lib hack from CMake build

Prior to this commit the CMake build use hardcoded lib prefix for
libxgboost and libxgboost4j. Unfortunatelly this did not play well with
Windows, which does not use the lib- prefix.
2017-06-09 08:25:09 -07:00
Sergei Lebedev
37c27ab8e8 [jvm-packages] Replaced create_jni.{bat,sh} with a Python version (#2383)
* [jvm-packages] Replaced create_jni.{bat,sh} with a Python version

This allows to have a single script for all platforms.

* [jvm-packages] Added all configuration options to create_jni.py
2017-06-07 21:55:45 -07:00
Vadim Khotilovich
c82276386d [R] xgb.importance: fix for multiclass gblinear, new 'trees' parameter (#2388) 2017-06-07 13:13:21 -05:00
Xiaoguang Sun
2ae56ca84f Use int32_t explicitly when serializing version (#2389)
Use int32_t explicitly when serializing version field of dmatrix in binary
format. On ILP64 architectures, although very little, size of int is 64 bits.
2017-06-07 10:03:42 -07:00
Thejaswi
85b2fb3eee [GPU-Plugin] Integration of a faster version of grow_gpu plugin into mainstream (#2360)
* Integrating a faster version of grow_gpu plugin
1. Removed the older files to reduce duplication
2. Moved all of the grow_gpu files under 'exact' folder
3. All of them are inside 'exact' namespace to avoid any conflicts
4. Fixed a bug in benchmark.py while running only 'grow_gpu' plugin
5. Added cub and googletest submodules to ease integration and unit-testing
6. Updates to CMakeLists.txt to directly build cuda objects into libxgboost

* Added support for building gpu plugins through make flow
1. updated makefile and config.mk to add right targets
2. added unit-tests for gpu exact plugin code

* 1. Added support for building gpu plugin using 'make' flow as well
2. Updated instructions for building and testing gpu plugin

* Fix travis-ci errors for PR#2360
1. lint errors on unit-tests
2. removed googletest, instead depended upon dmlc-core provide gtest cache

* Some more fixes to travis-ci lint failures PR#2360

* Added Rory's copyrights to the files containing code from both.

* updated copyright statement as per Rory's request

* moved the static datasets into a script to generate them at runtime

* 1. memory usage print when silent=0
2. tests/ and test/ folder organization
3. removal of the dependency of googletest for just building xgboost
4. coding style updates for .cuh as well

* Fixes for compilation warnings

* add cuda object files as well when JVM_BINDINGS=ON
2017-06-06 09:39:53 +12:00
Sergei Lebedev
2d9052bc7d libxgboost4j is now part of the CMake build (#2373)
* [jvm-packages] Added libxgboost4j to CMake build

* [jvm-packages] Wired CMake build into create_jni.sh

* User newer CMake version on Travis

* Lowered CMake version constraints

* Fixed various quirks in the new CMake build
2017-06-03 17:14:51 -07:00
Jakub Zakrzewski
ed6384ecbf [Python] Use appropriate integer types when calling native code. (#2361)
Don't use implicit conversions to c_int, which incidentally happen to work
on (some) 64-bit platforms, but:
* may lead to truncation of the input value to a 32-bit signed int,
* cause segfaults on some 32-bit architectures (tested on Ubuntu ARM,
  but is also the likely cause of issue #1707).

Also, when passing references use explicit 64-bit integers, where needed,
instead of c_ulong, which is not guaranteed to be this large.
2017-06-02 10:16:54 -07:00
Artem Krylysov
ed8da45f9d Fix C API header compatibility with C compilers (#2369) 2017-06-02 10:14:30 -07:00
Sergei Lebedev
97abfc487a [jvm-packages] Fixed checkstyle excludes on Windows (#2370)
XGBoostJNI.java was not excluded on Windows, probably because the path
specified in 'checkstyle-suppressions.xml' used UNIX file separators.
2017-06-02 10:14:13 -07:00
Michaël Benesty
8e2a1ff2bf Improve setinfo documentation on R package (#2357) 2017-05-30 20:08:31 +02:00
Sergei Lebedev
433269c335 Minor improvements to xgboost/jvm-packages build (#2356)
* Specified 'exec-maven-plugin' version

* Changed 'create_jni.sh' to fail on error

and also report each of the executed commands, which makes it easier
to debug.
2017-05-30 17:51:27 +02:00
davidt0x
b29b7d1d76 Fixed loop bound in create.new.tree.features (#2328)
for loop in create.new.tree.features was referencing length(trees) as the upper bound of the loop. trees is a base R dataset and not the model that the code is generating. Changed loop boundary to model$niter which should be the number of trees.
2017-05-30 17:50:33 +02:00
Juang, Yi-Lin
812300bb7f Update CONTRIBUTORS.md (#2350) 2017-05-27 08:38:32 -07:00
Juang, Yi-Lin
6776292951 Minor cleanup (#2342)
* Clean up demo of multiclass classification

* Remove extra space
2017-05-26 09:40:41 -04:00
Alexander Kiselev
f1dc82e3e1 Update parameter.md (#2348) 2017-05-25 09:27:10 -04:00
gaw89
0f3a404d91 Sklearn kwargs (#2338)
* Added kwargs support for Sklearn API

* Updated NEWS and CONTRIBUTORS

* Fixed CONTRIBUTORS.md

* Added clarification of **kwargs and test for proper usage

* Fixed lint error

* Fixed more lint errors and clf assigned but never used

* Fixed more lint errors

* Fixed more lint errors

* Fixed issue with changes from different branch bleeding over

* Fixed issue with changes from other branch bleeding over

* Added note that kwargs may not be compatible with Sklearn

* Fixed linting on kwargs note
2017-05-23 21:47:53 -05:00
gaw89
6cea1e3fb7 Sklearn convention update (#2323)
* Added n_jobs and random_state to keep up to date with sklearn API.
Deprecated nthread and seed.  Added tests for new params and
deprecations.

* Fixed docstring to reflect updates to n_jobs and random_state.

* Fixed whitespace issues and removed nose import.

* Added deprecation note for nthread and seed in docstring.

* Attempted fix of deprecation tests.

* Second attempted fix to tests.

* Set n_jobs to 1.
2017-05-22 08:22:05 -05:00
Vadim Khotilovich
da1629e848 [gbtree] fix update process to work with multiclass and multitree; fixes #2315 (#2332) 2017-05-21 23:47:57 -05:00
Vadim Khotilovich
b52db87d5c adding feature contributions to R and gblinear (#2295)
* [gblinear] add features contribution prediction; fix DumpModel bug

* [gbtree] minor changes to PredContrib

* [R] add feature contribution prediction to R

* [R] bump up version; update NEWS

* [gblinear] fix the base_margin issue; fixes #1969

* [R] list of matrices as output of multiclass feature contributions

* [gblinear] make order of DumpModel coefficients consistent: group index changes the fastest
2017-05-21 07:41:51 -04:00
Sergei Lebedev
e5e721722e Fix compilation on OS X with GCC 7 (#2256)
* Fix compilation on OS X with GCC 7

Compilation failed with

In file included from src/tree/tree_updater.cc:6:0:
include/xgboost/tree_updater.h:75:46: error: 'function' is not a member of 'std'
                                         std::function<TreeUpdater* ()> > {

caused by a missing <functional> include.

* Fixed another occurence of that issue spotted by @ClimberPG
2017-05-19 22:04:07 -07:00
PSEUDOTENSOR / Jonathan McKinney
3ca64ffa02 [GPU-Plugin] Improved split finding performance. (#2325) 2017-05-19 19:16:24 -07:00
jayzed82
29289d2302 Add option to choose booster in scikit intreface (gbtree by default) (#2303)
* Add option to choose booster in scikit intreface (gbtree by default)

* Add option to choose booster in scikit intreface: complete docstring.

* Fix XGBClassifier to work with booster option

* Added test case for gblinear booster
2017-05-18 23:12:27 -04:00
Nan Zhu
96f9776ab0 Update ISSUE_TEMPLATE.md (#2308)
* Update ISSUE_TEMPLATE.md

* Update ISSUE_TEMPLATE.md
2017-05-18 08:49:07 -07:00
Nan Zhu
a607f697e3 [jvm-packages] Disable fast histo for spark (#2296)
* add back train method but mark as deprecated

* fix scalastyle error

* disable fast histogram in xgboost4j-spark temporarily
2017-05-15 20:43:16 -07:00
Vadim Khotilovich
c66ca79221 [R] native routines registration (#2290)
* [R] add native routines registration

* c_api.h needs to include <cstdint> since it uses fixed width integer types

* [R] use registered native routines from R code

* [R] bump version; add info on native routine registration to the contributors guide

* make lint happy
2017-05-14 11:00:46 -07:00
Maurus Cuelenaere
6bd1869026 Add prediction of feature contributions (#2003)
* Add prediction of feature contributions

This implements the idea described at http://blog.datadive.net/interpreting-random-forests/
which tries to give insight in how a prediction is composed of its feature contributions
and a bias.

* Support multi-class models

* Calculate learning_rate per-tree instead of using the one from the first tree

* Do not rely on node.base_weight * learning_rate having the same value as the node mean value (aka leaf value, if it were a leaf); instead calculate them (lazily) on-the-fly

* Add simple test for contributions feature

* Check against param.num_nodes instead of checking for non-zero length

* Loop over all roots instead of only the first
2017-05-14 00:58:10 -05:00
Sergei Lebedev
e62be19c70 Removed 'flink.suffix' and added 'flink.version' (#2277)
The former was just Scala binary tag, and the latter was hardcoded in
the 'xgboost4j-flink' POM.
2017-05-10 08:42:40 -07:00
Nan Zhu
428453f7d6 [jvm-packages] fix the persistence of XGBoostEstimator (#2265)
* add back train method but mark as deprecated

* fix scalastyle error

* fix the persistence of XGBoostEstimator

* test persistence of a complete pipeline

* fix compilation issue

* do not allow persist custom_eval and custom_obj

* fix the failed tesl
2017-05-08 21:58:06 -07:00
Rory Mitchell
6bf968efe6 [GPU Plugin] Fast histogram speed improvements. Updated benchmarks. (#2258) 2017-05-08 09:21:38 -07:00
Dmitry Nikulin
98ea461532 Fix typo (#2264) 2017-05-07 16:54:48 -07:00
ebernhardson
197a9eacc5 [jvm-packages] Expose json dumps to scala (#2247)
* Add parameter passthru of format on Booster.getModelDump
2017-05-02 17:41:27 -07:00
ebernhardson
ccccf8a015 [jvm-packages] Accept groupData in spark model eval (#2244)
* Support model evaluation for ranking tasks by accepting
 groupData in XGBoostModel.eval
2017-05-02 10:03:20 -07:00
Vadim Khotilovich
a375ad2822 [R] maintenance Apr 2017 (#2237)
* [R] make sure things work for a single split model; fixes #2191

* [R] add option use_int_id to xgb.model.dt.tree

* [R] add example of exporting tree plot to a file

* [R] set save_period = NULL as default in xgboost() to be the same as in xgb.train; fixes #2182

* [R] it's a good practice after CRAN releases to bump up package version in dev

* [R] allow xgb.DMatrix construction from integer dense matrices

* [R] xgb.DMatrix: silent parameter; improve documentation

* [R] xgb.model.dt.tree code style changes

* [R] update NEWS with parameter changes

* [R] code safety & style; handle non-strict matrix and inherited classes of input and model; fixes #2242

* [R] change to x.y.z.p R-package versioning scheme and set version to 0.6.4.3

* [R] add an R package versioning section to the contributors guide

* [R] R-package/README.md: clean up the redundant old installation instructions, link the contributors guide
2017-05-01 22:51:34 -07:00
Philip Cho
d769b6bcb5 Fix performance degradation of BuildHist on Windows (#2243)
Reported in issue #2165. Dynamic scheduling of OpenMP loops involve
implicit synchronization. To implement synchronization, libgomp uses futex
(fast userspace mutex), whereas MinGW uses kernel-space mutex, which is more
costly. With chunk size of 1, synchronization overhead may become prohibitive
on Windows machines.

Solution: use 'guided' schedule to minimize the number of syncs
2017-05-01 15:54:44 -07:00
ebernhardson
da58f34ff8 Store metrics with learner (#2241)
Storing and then loading a model loses any eval_metric that was
provided. This causes implementations that always store/load, like
xgboost4j-spark, to be unable to eval with the desired metric.
2017-04-30 14:23:24 -07:00
ebernhardson
d3b866e3fd [jvm-packages] Expose json formatted booster dumps (#2233) (#2234)
* Change Booster dump from XGBoosterDumpModel to XGBoosterDumpModelEx

Allows exposing multiple formatting options of model dumping.
2017-04-29 20:23:09 -07:00
Qiang Kou (KK)
c441d0916e fix #2228 (#2238) 2017-04-29 18:44:08 -07:00
Rory Mitchell
8ab5d4611c [GPU-Plugin] (#2227)
* Add fast histogram algorithm
* Fix Linux build
* Add 'gpu_id' parameter
2017-04-25 16:37:10 -07:00
Tianqi Chen
d281c6aafa Update CONTRIBUTORS.md 2017-04-22 08:46:31 -07:00
Alex Bain
dbaa5d0bdf Disable invalid check for completely sparse batch that results in failed assertion for issue #1827 (#2213) 2017-04-21 09:28:02 -07:00
Nan Zhu
392aa6d1d3 [jvm-packages] make XGBoostModel hold BoosterParams as well (#2214)
* add back train method but mark as deprecated

* fix scalastyle error

* make XGBoostModel hold BoosterParams as well
2017-04-21 08:12:50 -07:00
Benjamin Pachev
e38bea3cdf Update README.md (#2202)
Add a link to a demo for the proposed PHP XGBoost wrapper.
2017-04-17 15:28:37 -07:00
avpronkin
31e800f340 erratum in index.md (#2203)
Mxnet instead of XGBoost
2017-04-17 15:24:18 -07:00
Seong-Jin Kim
8222755564 Fix typo in R-package README.md (#2190) 2017-04-13 20:22:23 +02:00
Preston Parry
1ab8088a09 Removes extraneous log (#2186)
This log appears to fire every time I ask the python package to make a prediction. It's the only log that fires from XGBoost. When we're getting predictions on millions of items a day in production, this log seems out of place.
2017-04-11 17:38:29 -07:00
Nan Zhu
a837fa9620 [jvm-packages] rdds containing boosters should be cleaned once we got boosters to driver (#2183) 2017-04-11 06:12:49 -07:00
Nan Zhu
f08077606c [jvm-packages] Clean external cache (#2181)
* add back train method but mark as deprecated

* fix scalastyle error

* change class to object in examples

* fix compilation error

* small fix for cleanExternalCache
2017-04-10 07:49:58 -07:00
Nan Zhu
8d8cbcc6db [jvm-packages] fixed several issues in unit tests (#2173)
* add back train method but mark as deprecated

* fix scalastyle error

* change class to object in examples

* fix compilation error

* fix several issues in tests
2017-04-06 06:25:23 -07:00
Philip Cho
2715baef64 Fix bugs in multithreaded ApplySplitSparseData() (#2161)
* Bugfix 1: Fix segfault in multithreaded ApplySplitSparseData()

When there are more threads than rows in rowset, some threads end up
with empty ranges, causing them to crash. (iend - 1 needs to be
accessible as part of algorithm)

Fix: run only those threads with nonempty ranges.

* Add regression test for Bugfix 1

* Moving python_omp_test to existing python test group

Turns out you don't need to set "OMP_NUM_THREADS" to enable
multithreading. Just add nthread parameter.

* Bugfix 2: Fix corner case of ApplySplitSparseData() for categorical feature

When split value is less than all cut points, split_cond is set
incorrectly.

Fix: set split_cond = -1 to indicate this scenario

* Bugfix 3: Initialize data layout indicator before using it

data_layout_ is accessed before being set; this variable determines
whether feature 0 is included in feat_set.

Fix: re-order code in InitData() to initialize data_layout_ first

* Adding regression test for Bugfix 2

Unfortunately, no regression test for Bugfix 3, as there is no
way to deterministically assign value to an uninitialized variable.
2017-04-02 11:37:39 -07:00
Denis M Korzhenkov
ed5e75de2f Nonreproducible sequence of evaluations fixed (#2153)
As `num_round=2` there is no `0003.model` file after training.
2017-03-29 10:11:23 -07:00
Rory Mitchell
a33fa05bda GPU Plugin: Bug fix #2048 (#2155) 2017-03-29 10:10:57 -07:00
Huffers
d45cf240a9 Remove xgboost's thread_local and switch to dmlc::ThreadLocalStore (#2121)
* Remove xgboost's own version of thread_local and switch to dmlc::ThreadLocalStore (#2109)

* Update dmlc-core
2017-03-27 09:09:18 -07:00
Philip Cho
14fba01b5a Improve multi-threaded performance (#2104)
* Add UpdatePredictionCache() option to updaters

Some updaters (e.g. fast_hist) has enough information to quickly compute
prediction cache for the training data. Each updater may override
UpdaterPredictionCache() method to update the prediction cache. Note: this
trick does not apply to validation data.

* Respond to code review

* Disable some debug messages by default
* Document UpdatePredictionCache() interface
* Remove base_margin logic from UpdatePredictionCache() implementation
* Do not take pointer to cfg, as reference may get stale

* Improve multi-threaded performance

* Use columnwise accessor to accelerate ApplySplit() step,
  with support for a compressed representation
* Parallel sort for evaluation step
* Inline BuildHist() function
* Cache gradient pairs when building histograms in BuildHist()

* Add missing #if macro

* Respond to code review

* Use wrapper to enable parallel sort on Linux

* Fix C++ compatibility issues

* MSVC doesn't support unsigned in OpenMP loops
* gcc 4.6 doesn't support using keyword

* Fix lint issues

* Respond to code review

* Fix bug in ApplySplitSparseData()

* Attempting to read beyond the end of a sparse column
* Mishandling the case where an entire range of rows have missing values

* Fix training continuation bug

Disable UpdatePredictionCache() in the first iteration. This way, we can
accomodate the scenario where we build off of an existing (nonempty) ensemble.

* Add regression test for fast_hist

* Respond to code review

* Add back old version of ApplySplitSparseData
2017-03-25 10:35:01 -07:00
Denis M Korzhenkov
332aea26a3 Formatting fixed for CLI parameters (#2145)
Fixed list of parameters format for CLI mode
2017-03-24 08:54:58 -07:00
Laurae
5c13aa0a8a GLM test unit: make run deterministic (#2147) 2017-03-24 08:54:39 -07:00
付雨帆
f1fe024a9d Update md grammar for the README.md (#2141) 2017-03-23 11:02:06 -07:00
Qin Xiaoming
12cf0ae122 Update sparse_page_dmatrix.h (#2139) 2017-03-23 11:01:40 -07:00
Yang Zhang
48835c3a4e Update predict leaf indices (#2135)
* Updated sklearn_parallel.py for soon-to-be-deprecated modules

* Updated predict_leaf_indices.py; Use python3 print() as other exmaples and removed unused module
2017-03-22 19:12:34 -07:00
Matthew R. Becker
a4bae1bdcd ENH more makefile updates (#2133)
This commit proposes a simpler single compiler specification for OSX and *nix. It also let's people override the setting on both systems, not just *nix.
2017-03-22 16:22:15 -05:00
Yang Zhang
cc012dac68 Updated sklearn_parallel.py for soon-to-be-deprecated modules (#2134) 2017-03-22 16:18:15 -05:00
Yang Zhang
f6f5003f79 Updated sklearn_examples.py for soon-to-be-deprecated modules (#2117) 2017-03-21 20:07:27 -07:00
Zhiquan
e65564ba59 Update rank_obj.cc (#2126)
typo: PairwieRankObj -> PairwiseRankObj
2017-03-21 20:06:16 -07:00
Matthew R. Becker
95b7dbb1ea ENH add gcc/g++ before clang for macs (#2125)
* ENH add gcc/g++ before clang for macs - will default to clang anyways and supports separate gcc installs

* BUG missed a ) - :(
2017-03-21 20:05:09 -07:00
Tianqi Chen
dc2fb978e1 new thread local requires xcode8 2017-03-17 09:40:34 -07:00
Icyblade Dai
301540f1d9 fix DeprecationWarning on sklearn.cross_validation (#2075)
* fix DeprecationWarning on sklearn.cross_validation

* fix syntax

* fix kfold n_split issue

* fix mistype

* fix n_splits multiple value issue

* split should pass a iterable

* use np.arange instead of xrange, py3 compatibility
2017-03-17 08:38:22 -05:00
Tianqi Chen
d581a3d0e7 [UPDATE] Update rabit and threadlocal (#2114)
* [UPDATE] Update rabit and threadlocal

* minor fix to make build system happy

* upgrade requirement to g++4.8

* upgrade dmlc-core

* update travis
2017-03-16 18:48:37 -07:00
Luckick
b0c972aa4d Typo Issue (#2100)
Contruct to Construct
2017-03-16 10:38:25 -07:00
Oleg Sofrygin
9d19e13ed0 adding a copy of base_margin to slice, fixes a bug where base_margin was notcopied during cross-validation (#2007) 2017-03-16 10:36:57 -07:00
Liam Huang
3a2b8332a6 bugfix: when metric's name contains - (#2090)
When metric's name contains `-`, Python will complain about insufficient arguments to unpack.
2017-03-16 10:36:39 -07:00
ZhouYong
fee1181803 fix online prediction function in learner.h (#2010)
I use the online prediction function(`inline void Predict(const SparseBatch::Inst &inst, ... ) const;`), the results obtained are different from the results of the batch prediction function(`  virtual void Predict(DMatrix* data, ...) const = 0`). After the investigation found that the online prediction function using the `base_score_` parameters, and the batch prediction function is not used in this parameter. It is found that the `base_score_` values are different when the same model file is loaded many times.

```
1st times:base_score_: 6.69023e-21
2nd times:base_score_: -3.7668e+19
3rd times:base_score_: 5.40507e+07
```
 Online prediction results are affected by `base_score_` parameters. After deleting the if condition(`if (out_preds->size() == 1)`) , the online prediction is consistent with the batch prediction results, and the xgboost prediction results are consistent with python version.  Therefore, it is likely that the online prediction function is bug
2017-03-16 10:35:52 -07:00
Matthew R. Becker
4a63f4ab43 BUG make sure to specify no openmp for some mac osx builds properly (#2095) 2017-03-10 18:36:15 -08:00
Shaform
15456c7882 Remove deprecated prefix bst: (#2091) 2017-03-09 09:06:37 -08:00
Holger Peters
95510b9667 Inform setuptools that this is a binary package (#1996)
* Inform setuptools that this is a binary package that needs platform-tags in wheel names.

This fixes issue #1995 .

* PEP8 Formatting

* Add docstring
2017-03-07 09:26:04 -06:00
cloverrose
288f309434 [jvm-packages] call setGroup for ranking task (#2066)
* [jvm-packages] call setGroup for ranking task

* passing groupData through xgBoostConfMap

* fix original comment position

* make groupData param

* remove groupData variable, use xgBoostConfMap directly

* set default groupData value

* add use groupData tests

* reduce rank-demo size

* use TaskContext.getPartitionId() instead of mapPartitionsWithIndex

* add DF use groupData test

* remove unused varable
2017-03-06 15:45:06 -08:00
geoHeil
cf6b173bd7 [jvm-packages] Spark pipeline persistence (#1906)
[jvm-packages] Spark pipeline persistence
2017-03-05 18:35:37 -08:00
Xin Yin
5b54b9437c Fixed Exception handling for fragmented Rabit 'print' tracker command. Fixed unit test. (#2081) 2017-03-05 13:40:59 -08:00
Nan Zhu
ab13fd72bd [jvm-packages] Scala/Java interface for Fast Histogram Algorithm (#1966)
* add back train method but mark as deprecated

* fix scalastyle error

* first commit in scala binding for fast histo

* java test

* add missed scala tests

* spark training

* add back train method but mark as deprecated

* fix scalastyle error

* local change

* first commit in scala binding for fast histo

* local change

* fix df frame test
2017-03-04 15:37:24 -08:00
Nan Zhu
ac30a0aff5 [jvm-packages][spark]Preserve num classes (#2068)
* add back train method but mark as deprecated

* fix scalastyle error

* change class to object in examples

* fix compilation error

* bump spark version to 2.1

* preserve num_class issues

* fix failed test cases

* rivising

* add multi class test
2017-03-04 14:14:31 -08:00
hlsc
a92093388d [jvm-packages] fix bug doing rabit call after finalize (#2079)
[jvm-packages]fix bug doing rabit call after finalize
2017-03-02 16:46:57 -08:00
Tianqi Chen
fd19b7a188 Automatically remove nan from input data when it is sparse. (#2062)
* [DATALoad] Automatically remove Nan when load from sparse matrix

* add log
2017-02-25 08:59:17 -08:00
moqiguzhu
5d093a7f4c in caret settings, if you want do 10*10 cross validation, you need to set repeats=10, number=10 and method=repeatedcv, (#2061)
if you set method=cv, actually just one 10-fold cross validation will be run; fixes #2055
2017-02-25 09:16:19 -05:00
Eric Liu
7927031ffe print_evaluation callback output on last iteration (#2036)
verbose_eval docs claim it will log the last iteration (http://xgboost.readthedocs.io/en/latest/python/python_api.html#xgboost.train). this is also consistent w/the behavior from 0.4. not a huge deal but I found it handy to see the last iter's result b/c my period is usually large.

this doesn't address logging the last stage found by early_stopping (as noted in docs) as I'm not sure how to do that.
2017-02-24 23:06:48 -05:00
Vadim Khotilovich
b4d97d3cb8 R maintenance Feb2017 (#2045)
* [R] better argument check in xgb.DMatrix; fixes #1480

* [R] showsd was a dummy; fixes #2044

* [R] better categorical encoding explanation in vignette; fixes #1989

* [R] new roxygen version docs update
2017-02-20 10:02:40 -08:00
Nan Zhu
63aec12a13 [jvm-packages] Bump spark to 2.1 (#2046) 2017-02-19 08:29:35 -08:00
Nan Zhu
185fe1d645 [jvm-packages] use ML's para system to build the passed-in params to XGBoost (#2043)
* add back train method but mark as deprecated

* fix scalastyle error

* use ML's para system to build the passed-in params to XGBoost

* clean
2017-02-18 11:56:27 -08:00
DougM
acce11d3f4 fix MLlib CrossValidator issues (wrong default value configuration) #1941 (#2042) 2017-02-18 08:10:47 -08:00
Theodore Vasiloudis
9fb46e2c5e [trivial] Fix typo in Poisson metric name. (#2026) 2017-02-09 09:32:06 -08:00
ANtlord
f054d812dc Fix typo in Python Package Introduction (#2023)
Fixed #2016
2017-02-08 23:35:13 -05:00
Xin Yin
4fb7fdb240 [jvm-packages] Fixed java.nio.BufferUnderFlow issue in Scala Rabit tracker. (#1993)
* [jvm-packages] Scala implementation of the Rabit tracker.

A Scala implementation of RabitTracker that is interface-interchangable with the
Java implementation, ported from `tracker.py` in the
[dmlc-core project](https://github.com/dmlc/dmlc-core).

* [jvm-packages] Updated Akka dependency in pom.xml.

* Refactored the RabitTracker directory structure.

* Fixed premature stopping of connection handler.

Added a new finite state "AwaitingPortNumber" to explicitly wait for the
worker to send the port, and close the connection. Stopping the actor
prematurely sends a TCP RST to the worker, causing the worker to crash
on AssertionError.

* Added interface IRabitTracker so that user can switch implementations.

* Default timeout duration changes.

* Dependency for Akka tests.

* Removed the main function of RabitTracker.

* A skeleton for testing Akka-based Rabit tracker.

* waitFor() in RabitTracker no longer throws exceptions.

* Completed unit test for the 'start' command of Rabit tracker.

* Preliminary support for Rabit Allreduce via JNI (no prepare function support yet.)

* Fixed the default timeout duration.

* Use Java container to avoid serialization issues due to intermediate wrappers.

* Added tests for Allreduce/model training using Scala Rabit tracker.

* Added spill-over unit test for the Scala Rabit tracker.

* Fixed a typo.

* Overhaul of RabitTracker interface per code review.

  - Removed methods start() waitFor() (no arguments) from IRabitTracker.
  - The timeout in start(timeout) is now worker connection timeout, as tcp
    socket binding timeout is less intuitive.
  - Dropped time unit from start(...) and waitFor(...) methods; the default
    time unit is millisecond.
  - Moved random port number generation into the RabitTrackerHandler.
  - Moved all Rabit-related classes to package ml.dmlc.xgboost4j.scala.rabit.

* More code refactoring and comments.

* Unified timeout constants. Readable tracker status code.

* Add comments to indicate that allReduce is for tests only. Removed all other variants.

* Removed unused imports.

* Simplified signatures of training methods.

 - Moved TrackerConf into parameter map.
 - Changed GeneralParams so that TrackerConf becomes a standalone parameter.
 - Updated test cases accordingly.

* Changed monitoring strategies.

* Reverted monitoring changes.

* Update test case for Rabit AllReduce.

* Mix in UncaughtExceptionHandler into IRabitTracker to prevent tracker from hanging due to exceptions thrown by workers.

* More comprehensive test cases for exception handling and worker connection timeout.

* Handle executor loss due to unknown cause: the newly spawned executor will attempt to connect to the tracker. Interrupt tracker in such case.

* Per code-review, removed training timeout from TrackerConf. Timeout logic must be implemented explicitly and externally in the driver code.

* Reverted scalastyle-config changes.

* Visibility scope change. Interface tweaks.

* Use match pattern to handle tracker_conf parameter.

* Minor clarification in JNI code.

* Clearer intent in match pattern to suppress warnings.

* Removed Future from constructor. Block in start() and waitFor() instead.

* Revert inadvertent comment changes.

* Removed debugging information.

* Updated test cases that are a bit finicky.

* Added comments on the reasoning behind the unit tests for testing Rabit tracker robustness.

* Fixed BufferUnderFlow bug in decoding tracker 'print' command.

* Merge conflicts resolution.
2017-02-04 10:20:39 -08:00
geoHeil
2250b9b6d2 [jvm-packages] try setting default profile (#1891)
* try setting default profile

* add spark pipeline persistence

* access spark session

* copy paste sparks default parameter reader

* remove unnecessary parameters, only change xml

* remove unnecessary changes 2
2017-01-31 08:33:51 -08:00
yexu15
179b384e39 A fix regarding the compatibility with python 2.6 (#1981)
* A fix regarding the compatibility with python 2.6

the syntax of {n: self.attr(n) for n in attr_names} is illegal in python 2.6

* Update core.py

add a space after comma
2017-01-29 20:18:28 -08:00
Philip Cho
5d74578095 Disallow multiple roots for tree_method=hist (#1979)
As discussed in issue #1978, tree_method=hist ignores the parameter
param.num_roots; it simply assumes that the tree has only one root. In
particular, when InitData() method initializes row_set_collection_, it simply
assigns all rows to node 0, the value that's hard-coded.

For now, the updater will simply fail when num_roots exceeds 1. I will revise
the updater soon to support multiple roots.
2017-01-21 12:02:29 -08:00
Srivatsan Ramanujam
036ee55fe0 adding sample weights for XGBRegressor (was this forgotten?) (#1874) 2017-01-21 11:58:03 -08:00
Vadim Khotilovich
2b5b96d760 [R] various R code maintenance (#1964)
* [R] xgb.save must work when handle in nil but raw exists

* [R] print.xgb.Booster should still print other info when handle is nil

* [R] rename internal function xgb.Booster to xgb.Booster.handle to make its intent clear

* [R] rename xgb.Booster.check to xgb.Booster.complete and make it visible; more docs

* [R] storing evaluation_log should depend only on watchlist, not on verbose

* [R] reduce the excessive chattiness of unit tests

* [R] only disable some tests in windows when it's not 64-bit

* [R] clean-up xgb.DMatrix

* [R] test xgb.DMatrix loading from libsvm text file

* [R] store feature_names in xgb.Booster, use them from utility functions

* [R] remove non-functional co-occurence computation from xgb.importance

* [R] verbose=0 is enough without a callback

* [R] added forgotten xgb.Booster.complete.Rd; cran check fixes

* [R] update installation instructions
2017-01-21 11:22:46 -08:00
wxchan
a073a2c3d4 fix ylim with max_num_features in python plot_importance (#1974) 2017-01-18 11:59:50 -08:00
Félix MIKAELIAN
a7d2833766 added the max_features parameter to the plot_importance function. (#1963)
* added the max_features parameter to the plot_importance function.

* renamed max_features parameter to max_num_features for better understanding

* removed unwanted character in docstring
2017-01-16 14:49:47 -08:00
Philip Cho
49ff7c1649 Rename parameter in fast_hist to disambiguate (#1962) 2017-01-13 11:35:55 -08:00
Philip Cho
aeb4e76118 Histogram Optimized Tree Grower (#1940)
* Support histogram-based algorithm + multiple tree growing strategy

* Add a brand new updater to support histogram-based algorithm, which buckets
  continuous features into discrete bins to speed up training. To use it, set
  `tree_method = fast_hist` to configuration.
* Support multiple tree growing strategies. For now, two policies are supported:
  * `grow_policy=depthwise` (default):  favor splitting at nodes closest to the
    root, i.e. grow depth-wise.
  * `grow_policy=lossguide`: favor splitting at nodes with highest loss change
* Improve single-threaded performance
  * Unroll critical loops
  * Introduce specialized code for dense data (i.e. no missing values)
* Additional training parameters: `max_leaves`, `max_bin`, `grow_policy`, `verbose`

* Adding a small test for hist method

* Fix memory error in row_set.h

When std::vector is resized, a reference to one of its element may become
stale. Any such reference must be updated as well.

* Resolve cross-platform compilation issues

* Versions of g++ older than 4.8 lacks support for a few C++11 features, e.g.
  alignas(*) and new initializer syntax. To support g++ 4.6, use pre-C++11
  initializer and remove alignas(*).
* Versions of MSVC older than 2015 does not support alignas(*). To support
  MSVC 2012, remove alignas(*).
* For g++ 4.8 and newer, alignas(*) is enabled for performance benefits.
* Some old compilers (MSVC 2012, g++ 4.6) do not support template aliases
  (which uses `using` to declate type aliases). So always use `typedef`.

* Fix a host of CI issues

* Remove dependency for libz on osx
* Fix heading for hist_util
* Fix minor style issues
* Add missing #include
* Remove extraneous logging

* Enable tree_method=hist in R

* Renaming HistMaker to GHistBuilder to avoid confusion

* Fix R integration

* Respond to style comments

* Consistent tie-breaking for priority queue using timestamps

* Last-minute style fixes

* Fix issuecomment-271977647

The way we quantize data is broken. The agaricus data consists of all
categorical values. When NAs are converted into 0's,
`HistCutMatrix::Init` assign both 0's and 1's to the same single bin.

Why? gmat only the smallest value (0) and an upper bound (2), which is twice
the maximum value (1). Add the maximum value itself to gmat to fix the issue.

* Fix issuecomment-272266358

* Remove padding from cut values for the continuous case
* For categorical/ordinal values, use midpoints as bin boundaries to be safe

* Fix CI issue -- do not use xrange(*)

* Fix corner case in quantile sketch

Signed-off-by: Philip Cho <chohyu01@cs.washington.edu>

* Adding a test for an edge case in quantile sketcher

max_bin=2 used to cause an exception.

* Fix fast_hist test

The test used to require a strictly increasing Test AUC for all examples.
One of them exhibits a small blip in Test AUC before achieving a Test AUC
of 1. (See bottom.)

Solution: do not require monotonic increase for this particular example.

[0] train-auc:0.99989 test-auc:0.999497
[1] train-auc:1 test-auc:0.999749
[2] train-auc:1 test-auc:0.999749
[3] train-auc:1 test-auc:0.999749
[4] train-auc:1 test-auc:0.999749
[5] train-auc:1 test-auc:0.999497
[6] train-auc:1 test-auc:1
[7] train-auc:1 test-auc:1
[8] train-auc:1 test-auc:1
[9] train-auc:1 test-auc:1
2017-01-13 09:25:55 -08:00
Luckick
ef8d92fc52 Validation Typo (#1949)
change valudation to validation
2017-01-09 10:40:43 -08:00
Andrey Tereskin
cfb9b11aa4 Make lib path relatrive to fix setup error #1932 (#1947) 2017-01-09 10:40:24 -08:00
Vadim Khotilovich
87e897f428 [R] fix #1903 (#1929) 2017-01-06 13:16:37 -08:00
Vadim Khotilovich
d7406e07f3 [R] xgb.plot.tree fixes (#1939)
* [R] a few fixes and improvements to xgb.plot.tree

* [R] deprecate n_first_tree replace with trees; fix types in xgb.model.dt.tree
2017-01-06 11:09:51 -08:00
Vadim Khotilovich
d23ea5ca7d An option for doing binomial+1 or epsilon-dropout from DART paper (#1922)
* An option for doing binomial+1 or epsilon-dropout from DART paper

* use callback-based discrete_distribution to make MSVC2013 happy
2017-01-05 16:23:22 -08:00
Tong He
ce84af7923 0.6-4 submission (#1935) 2017-01-04 23:31:05 -08:00
Muneyuki Noguchi
8b827425b2 Fix comment in cross_validation.py (#1923)
cv() doesn't output std_value because show_stdv is set to False.
2017-01-02 09:40:41 -05:00
Kyle Willett
7e07b2b93d Correcting small typos in documentation. (#1901) 2016-12-31 20:47:51 +08:00
Tong He
f5c85836bf [R] Increase the version number, date and required R version (#1920)
* remove unnecessary line
2016-12-30 21:29:26 -08:00
Qiang Kou (KK)
7948d1c799 disable openmp on solaris (#1912) 2016-12-28 11:32:56 -08:00
adamist521
119763bc49 cross_validation is included in model_selection module since sklearn 0.18 (#1908) 2016-12-26 04:11:56 -05:00
Rory Mitchell
1957e6fb4d Fix cmake build for linux. Update GPU benchmarks. (#1904) 2016-12-23 09:18:56 +01:00
jokari69
fb0fc0c580 option to shuffle data in mknfolds (#1459)
* option to shuffle data in mknfolds

* removed possibility to run as stand alone test

* split function def in 2 lines for lint

* option to shuffle data in mknfolds

* removed possibility to run as stand alone test

* split function def in 2 lines for lint
2016-12-23 07:53:30 +08:00
Rory Mitchell
b49b339183 GPU Plugin: Add subsample, colsample_bytree, colsample_bylevel (#1895) 2016-12-22 16:30:36 +01:00
wxchan
cee4aafb93 fix dart bug (#1882) 2016-12-19 18:01:28 +01:00
Tong He
fa97259d66 Bump up version number, add cleanup script (#1886)
* fix cran check

* change required R version because of utils::globalVariables

* temporary commit, monotone not working

* fix test

* fix doc

* fix doc

* fix cran note and warning

* improve checks

* fix urls

* fix cran check

* add cleanup and bump up version number

* use clean in build

* Update Makefile
2016-12-18 15:11:43 -08:00
Yixuan Qiu
b14994aeff [R Package] Use the C++ 11 compiler to test OpenMP flags (#1881)
* fix segfault when gctorture() is enabled

* use the C++ 11 compiler to test OpenMP flags

* auto-generated configure script
2016-12-16 15:11:06 -08:00
Qiang Kou (KK)
5ebd8fb809 autoconf for solaris (#1880) 2016-12-16 21:56:10 +01:00
Tong He
674024c53a [R] Fix for cran submission of xgboost 0.6 (#1875)
fix cran check
2016-12-15 12:04:54 -08:00
Rory Mitchell
d943720883 GPU Plugin: Add bosch demo, update build instructions (#1872) 2016-12-15 07:57:27 +01:00
Matthew Drury
edc356f7ec Add monotonic tutorial. (#1870) 2016-12-14 20:17:19 -06:00
Ian
167864da75 python package tree plotting support fmap (#1856)
* to_graphviz and plot_tree support fmap

* [python-package] add model_plot docstring
2016-12-13 07:36:17 -06:00
Liam Huang
49bdb5c97f fix typo in comment. (#1850) 2016-12-11 19:49:04 +01:00
Vadim Khotilovich
b21e658a02 [R-package] JSON dump format and a couple of bugfixes (#1855)
* [R-package] JSON tree dump interface

* [R-package] precision bugfix in xgb.attributes

* [R-package] bugfix for cb.early.stop called from xgb.cv

* [R-package] a bit more clarity on labels checking in xgb.cv

* [R-package] test JSON dump for gblinear as well

* whitespace lint
2016-12-11 19:48:39 +01:00
AbdealiJK
0268dedeea config.mk: Set TEST_COVER to 0 by default (#1853)
Set the TEST_COVER to 0 by default so it uses optimization
-O3 when compiling.
2016-12-11 19:48:15 +01:00
Ruimin Wang
d9584ab82e refactor duplicate evaluation implementation (#1852) 2016-12-08 20:33:40 -08:00
RAMitchell
2b6aa7736f Add benchmarks, fix GCC build (#1848) 2016-12-08 18:59:10 +01:00
Xin Yin
e7fbc8591f [jvm-packages] Scala implementation of the Rabit tracker. (#1612)
* [jvm-packages] Scala implementation of the Rabit tracker.

A Scala implementation of RabitTracker that is interface-interchangable with the
Java implementation, ported from `tracker.py` in the
[dmlc-core project](https://github.com/dmlc/dmlc-core).

* [jvm-packages] Updated Akka dependency in pom.xml.

* Refactored the RabitTracker directory structure.

* Fixed premature stopping of connection handler.

Added a new finite state "AwaitingPortNumber" to explicitly wait for the
worker to send the port, and close the connection. Stopping the actor
prematurely sends a TCP RST to the worker, causing the worker to crash
on AssertionError.

* Added interface IRabitTracker so that user can switch implementations.

* Default timeout duration changes.

* Dependency for Akka tests.

* Removed the main function of RabitTracker.

* A skeleton for testing Akka-based Rabit tracker.

* waitFor() in RabitTracker no longer throws exceptions.

* Completed unit test for the 'start' command of Rabit tracker.

* Preliminary support for Rabit Allreduce via JNI (no prepare function support yet.)

* Fixed the default timeout duration.

* Use Java container to avoid serialization issues due to intermediate wrappers.

* Added tests for Allreduce/model training using Scala Rabit tracker.

* Added spill-over unit test for the Scala Rabit tracker.

* Fixed a typo.

* Overhaul of RabitTracker interface per code review.

  - Removed methods start() waitFor() (no arguments) from IRabitTracker.
  - The timeout in start(timeout) is now worker connection timeout, as tcp
    socket binding timeout is less intuitive.
  - Dropped time unit from start(...) and waitFor(...) methods; the default
    time unit is millisecond.
  - Moved random port number generation into the RabitTrackerHandler.
  - Moved all Rabit-related classes to package ml.dmlc.xgboost4j.scala.rabit.

* More code refactoring and comments.

* Unified timeout constants. Readable tracker status code.

* Add comments to indicate that allReduce is for tests only. Removed all other variants.

* Removed unused imports.

* Simplified signatures of training methods.

 - Moved TrackerConf into parameter map.
 - Changed GeneralParams so that TrackerConf becomes a standalone parameter.
 - Updated test cases accordingly.

* Changed monitoring strategies.

* Reverted monitoring changes.

* Update test case for Rabit AllReduce.

* Mix in UncaughtExceptionHandler into IRabitTracker to prevent tracker from hanging due to exceptions thrown by workers.

* More comprehensive test cases for exception handling and worker connection timeout.

* Handle executor loss due to unknown cause: the newly spawned executor will attempt to connect to the tracker. Interrupt tracker in such case.

* Per code-review, removed training timeout from TrackerConf. Timeout logic must be implemented explicitly and externally in the driver code.

* Reverted scalastyle-config changes.

* Visibility scope change. Interface tweaks.

* Use match pattern to handle tracker_conf parameter.

* Minor clarification in JNI code.

* Clearer intent in match pattern to suppress warnings.

* Removed Future from constructor. Block in start() and waitFor() instead.

* Revert inadvertent comment changes.

* Removed debugging information.

* Updated test cases that are a bit finicky.

* Added comments on the reasoning behind the unit tests for testing Rabit tracker robustness.
2016-12-07 06:35:42 -08:00
Simon DENEL
7078c41dad Changing omp_get_num_threads to omp_get_max_threads (#1831)
* Updating dmlc-core

* Changing omp_get_num_threads to omp_get_max_threads
2016-12-04 11:26:45 -08:00
AbdealiJK
47ba2de7d4 tests/cpp: Add tests for multiclass_metric.cc 2016-12-04 11:25:57 -08:00
AbdealiJK
a7e20555a3 tests/cpp: Add tests for rank_metrics.cc 2016-12-04 11:25:57 -08:00
AbdealiJK
5912e051b1 rank_metric.cc: Use GetWeight in EvalAMS
The GetWeight is a wrapper which sets the correct weight
if the weights vector is not provided. Hence accessing the default
weights vector is not recommended.
2016-12-04 11:25:57 -08:00
AbdealiJK
4a2ef130a7 tests/cpp: Add test for elementwise_metric.cc 2016-12-04 11:25:57 -08:00
AbdealiJK
03abd47f49 tests/cpp: Add tests for Metric RMSE 2016-12-04 11:25:57 -08:00
AbdealiJK
582c373274 tests/cpp: Add tests for metric.cc 2016-12-04 11:25:57 -08:00
AbdealiJK
cc859420ba tests/cpp: Add tests for TweedieRegression 2016-12-04 11:25:57 -08:00
AbdealiJK
fa865564f6 tests/cpp: Add tests for GammaRegression 2016-12-04 11:25:57 -08:00
AbdealiJK
401e4b5220 tests/cpp: Add tests for PoissonRegression 2016-12-04 11:25:57 -08:00
AbdealiJK
d41aab4f61 tests/cpp: Add tests for regression_obj.cc
Test the objective functions in regression_obj.cc

tests/cpp: Add tests for objective.cc and RegLossObj
2016-12-04 11:25:57 -08:00
AbdealiJK
fd99d39372 tests/cpp: Add tests for SplitEntry 2016-12-04 11:25:57 -08:00
AbdealiJK
62e3468603 tests/cpp: Add tests for param.h 2016-12-04 11:25:57 -08:00
AbdealiJK
d6407c3746 tests/cpp: Add tests for SparsePageDMatrix
The SparsePageDMatrix or external memory DMatrix reads data from the
file IO rather than load it into RAM.
2016-12-04 11:25:57 -08:00
AbdealiJK
c3629c91d3 tests/cpp: Add tests for SimpleCSRSource
Test the binary format saved and read by a SimpleDMatrix, which is
internally the SimpleCSRSource.
2016-12-04 11:25:57 -08:00
AbdealiJK
be0f55d563 tests/cpp: Add tests for SimpleDMatrix 2016-12-04 11:25:57 -08:00
AbdealiJK
ef7fe06cf8 tests/cpp/test_metainfo: Add tests to save and load 2016-12-04 11:25:57 -08:00
AbdealiJK
8eb69e0677 travis: Add code coverage on success
Update the code coverage of the project on codecov for easy viewing.

Also the gcov on travis uses a different version which cannot
find the directory of the given files, and it needs to be specified
in the -o flag. Hence now we loop over the list of files and
run them independently.
2016-12-04 11:25:57 -08:00
AbdealiJK
61a9b3a49e travis: Run CPP tests 2016-12-04 11:25:57 -08:00
AbdealiJK
006f9e0760 Makefile: Add CPP code coverage 2016-12-04 11:25:57 -08:00
AbdealiJK
1f2ad36bad Add make commands for tests
This adds the make commands required to build and run tests.
2016-12-04 11:25:57 -08:00
AbdealiJK
b045ccd764 data.cc: Remove redundant ftype variable 2016-12-04 11:25:57 -08:00
JohnStott
1683e07461 Fix issue introduced from correction to log2 (#1837)
https://github.com/dmlc/xgboost/pull/1642
2016-12-04 11:11:56 -08:00
Vadim Khotilovich
a44032d095 [CORE] The update process for a tree model, and its application to feature importance (#1670)
* [CORE] allow updating trees in an existing model

* [CORE] in refresh updater, allow keeping old leaf values and update stats only

* [R-package] xgb.train mod to allow updating trees in an existing model

* [R-package] added check for nrounds when is_update

* [CORE] merge parameter declaration changes; unify their code style

* [CORE] move the update-process trees initialization to Configure; rename default process_type to 'default'; fix the trees and trees_to_update sizes comparison check

* [R-package] unit tests for the update process type

* [DOC] documentation for process_type parameter; improved docs for updater, Gamma and Tweedie; added some parameter aliases; metrics indentation and some were non-documented

* fix my sloppy merge conflict resolutions

* [CORE] add a TreeProcessType enum

* whitespace fix
2016-12-04 09:33:52 -08:00
Nat Wilson
4398fbbe4a fix typo on documentation page (#1836)
replaces "Lanuages" -> "Languages"
2016-12-03 14:41:30 -08:00
Tong He
2f3958a455 Fix for CRAN Submission (#1826)
* fix cran check

* change required R version because of utils::globalVariables

* temporary commit, monotone not working

* fix test

* fix doc

* fix doc

* fix cran note and warning

* improve checks

* fix urls
2016-12-02 20:19:03 -08:00
xgdgsc
27ca50e2c2 change contribution link to open issues (#1834) 2016-12-02 11:03:03 -08:00
ccphillippi
dd477ac903 Move feature_importances_ to base XGBModel for XGBRegressor access (#1591) 2016-12-01 10:17:37 -08:00
AbdealiJK
6f16f0ef58 Use bst_float consistently throughout (#1824)
* Fix various typos

* Add override to functions that are overridden

gcc gives warnings about functions that are being overridden by not
being marked as oveirridden. This fixes it.

* Use bst_float consistently

Use bst_float for all the variables that involve weight,
leaf value, gradient, hessian, gain, loss_chg, predictions,
base_margin, feature values.

In some cases, when due to additions and so on the value can
take a larger value, double is used.

This ensures that type conversions are minimal and reduces loss of
precision.
2016-11-30 10:02:10 -08:00
Dr. Kashif Rasul
da2556f58a fixed some typos (#1814) 2016-11-25 16:34:57 -05:00
RAMitchell
be2f28ec08 Update build instructions, improve memory usage (#1811) 2016-11-25 09:43:22 -08:00
Yuan (Terry) Tang
80c8515457 Bump up the date of R package (#1813) 2016-11-25 03:20:18 -05:00
Jivan Roquet
0c19d4b029 [python-package] Provide a learning_rates parameter to xgb.cv() (#1770)
* Allow using learning_rates parameter when doing CV

- Create a new `callback_cv` method working when called from `xgb.cv()`
- Rename existing `callback` into `callback_train` and make it the default callback
- Get the logic out of the callbacks and place it into a common helper

* Add a learning_rates parameter to cv()

* lint

* remove caller explicit reference

* callback is aware of its calling context

* remove caller argument

* remove learning_rates param

* restore learning_rates for training, but deprecated

* lint

* lint line too long

* quick example for predefined callbacks
2016-11-24 09:49:07 -08:00
Alexey Grigorev
80e70c56b9 [jvm-packages] xgboost4j: publishing sources along with bins (#1797)
* xgboost4j: publishing sources along with bins

* description about building maven artifacts

* publishing scala source to local m2 as well
2016-11-21 15:02:57 -05:00
Ruimin Wang
d80cec3384 [jvm-pacakges] the first parameter in getModelDump should be featuremap path not model path (#1788)
* fix the model dump in xgboost4j example

* Modify the dump model part of scala version

* add the forgotten modelInfos
2016-11-21 08:52:26 -05:00
AbdealiJK
97371ff7e5 c_api.cc: Bring back silent argument (#1794)
In ecb3a271be the silent argument
in XGDMatrixCreateFromFile of c_api.cc was always overridden to
be false. This disabled the functionality to hide log messages.

This commit reverts that part to enable the hiding of log messages.
2016-11-20 22:04:36 -08:00
Nan Zhu
965091c4bb [jvm-packages] update methods in test cases to be consistent (#1780)
* add back train method but mark as deprecated

* fix scalastyle error

* change class to object in examples

* fix compilation error

* update methods in test cases to be consistent

* add blank lines

* fix
2016-11-20 22:49:18 -05:00
XianXing Zhang
ce708c8e7f [jvm-packages] Leverage the Spark ml API to read DataFrame from files in LibSVM format. (#1785) 2016-11-20 21:28:03 -05:00
Yuan (Terry) Tang
ca0069b708 Fix typo - eval_metric in param should be dictionary (#1791) 2016-11-20 18:52:41 -06:00
Yuan (Terry) Tang
090b37e85d Bumped up err assert in glm test (#1792) 2016-11-20 18:23:19 -06:00
Nan Zhu
5217e53156 stylistic fix (#1789)
* stylistic fix

* try multiple repos

* fix

* fix
2016-11-19 22:03:10 -05:00
Tianqi Chen
060a0ac396 Update setup.sh 2016-11-19 17:57:47 -08:00
Tianqi Chen
aa841ee58d Update setup.sh 2016-11-19 17:56:36 -08:00
baderbuddy
c52b2faba4 Added license information (#1783)
Added license information to the setup.py
2016-11-17 13:36:47 -08:00
Tony DiFranco
f11f2bd5fd add default to poisson -> max_delta_step to enable loading/saving/dumping of model (#1781) 2016-11-16 14:25:00 -08:00
Simon DENEL
58aa1129ea Fixing a few typos (#1771)
* Fixing a few typos

* Fixing a few typos
2016-11-13 15:47:52 -08:00
Richard Wong
b9a9d2bf45 Style fixes in Python documentation. (#1764) 2016-11-11 09:26:28 -08:00
Luckick
0ccb9b87d0 Typo Problem (#1759)
cross validation
2016-11-10 13:55:09 -08:00
Tianqi Chen
2fb19eb448 Add appveyor badge 2016-11-10 12:49:33 -08:00
Zhongxiao Ma
55bfc29942 keep builtin evaluations while using customized evaluation function (#1624)
* keep builtin evaluations while using customized evaluation function

* fix concat bytes to str
2016-11-10 12:40:48 -08:00
Morten Hustveit
8b9d9669bb Have ConsoleLogger log to stderr instead of stdout (#1714)
On Unix systems, it's common for programs to read their input from stdin, and
write their output to stdout.  Messages should be written to stderr, where they
won't corrupt a program's output, and where they can be seen by the user even
if the output is being redirected.

This is mostly a problem when XGBoost is being used from Python or from another
program.
2016-11-10 12:39:52 -08:00
wl2776
6b5a23ccd5 fix build in MSVC 2013 (#1757) 2016-11-10 12:34:30 -08:00
RAMitchell
e3a7f85f15 GPU plug-in improvements + basic Windows continuous integration (#1752)
* GPU Plugin: Reduce memory, improve performance, fix gcc compiler bug, add
out of memory exceptions

* Add basic Windows continuous integration for cmake VS2013, VS2015
2016-11-10 12:34:09 -08:00
joandre
91b75f9b41 Fix a small typo in GeneralParams class. Change customEval parameter name from "custom_obj" to "custom_eval". (#1741) 2016-11-06 12:44:49 -05:00
Tony DiFranco
2ad0948444 Tweedie Regression Post-Rebase (#1737)
* add support for tweedie regression

* added back readme line that was accidentally deleted

* fixed linting errors

* add support for tweedie regression

* added back readme line that was accidentally deleted

* fixed linting errors

* rebased with upstream master and added R example

* changed parameter name to tweedie_variance_power

* linting error fix

* refactored tweedie-nloglik metric to be more like the other parameterized metrics

* added upper and lower bound check to tweedie metric

* add support for tweedie regression

* added back readme line that was accidentally deleted

* fixed linting errors

* added upper and lower bound check to tweedie metric

* added back readme line that was accidentally deleted

* rebased with upstream master and added R example

* rebased again on top of upstream master

* linting error fix

* added upper and lower bound check to tweedie metric

* rebased with master

* lint fix

* removed whitespace at end of line 186 - elementwise_metric.cc
2016-11-05 17:02:32 -07:00
AbdealiJK
52b9867be5 Add docs fro update_seq (#1735)
* Fix typos and messages in docs

* parameter.md: Add docs for updater_seq

Mention the updater_seq parameter which sets the order of the tree
updaters to run and also specifies which ones to run. This can be
useful when pruning is not required or even a custom plugin is
being built along with xgboost.
2016-11-04 16:07:29 -07:00
AbdealiJK
b94fcab4dc Add dump_format=json option (#1726)
* Add format to the params accepted by DumpModel

Currently, only the test format is supported when trying to dump
a model. The plan is to add more such formats like JSON which are
easy to read and/or parse by machines. And to make the interface
for this even more generic to allow other formats to be added.

Hence, we make some modifications to make these function generic
and accept a new parameter "format" which signifies the format of
the dump to be created.

* Fix typos and errors in docs

* plugin: Mention all the register macros available

Document the register macros currently available to the plugin
writers so they know what exactly can be extended using hooks.

* sparce_page_source: Use same arg name in .h and .cc

* gbm: Add JSON dump

The dump_format argument can be used to specify what type
of dump file should be created. Add functionality to dump
gblinear and gbtree into a JSON file.

The JSON file has an array, each item is a JSON object for the tree.
For gblinear:
 - The item is the bias and weights vectors
For gbtree:
 - The item is the root node. The root node has a attribute "children"
   which holds the children nodes. This happens recursively.

* core.py: Add arg dump_format for get_dump()
2016-11-04 09:55:25 -07:00
Alireza Bagheri Garakani
9c693f0f5f scale_pos_weight default value (#1712)
Should say 1 (not 0)
2016-11-03 12:52:26 -07:00
David Lichtenberg
8156b71912 Typo is OSX installation instructions (#1718)
The `cd ..;` in the one liner takes you up a directory instead of into the xgboost directory. This will cause that step of the installation to fail. It seems like you are meant to enter the xgboost directory as you did in the instructions for installing xgboost without openmp.
2016-11-03 12:52:16 -07:00
AbdealiJK
378eb7d7c8 Fix typos and messages in docs (#1723) 2016-10-30 22:52:19 -07:00
Nan Zhu
6082184cd1 [jvm-packages] update API docs (#1713)
* add back train method but mark as deprecated

* fix scalastyle error

* update java doc

* update
2016-10-27 18:53:22 -07:00
Nan Zhu
d321375df5 [jvm-packages] Fix mis configure of nthread (#1709)
* add back train method but mark as deprecated

* fix scalastyle error

* change class to object in examples

* fix compilation error

* fix mis configuration
2016-10-27 12:10:35 -04:00
Nan Zhu
f12074d355 [jvm-packages] release blog (#1706) 2016-10-26 21:35:42 -04:00
Nan Zhu
f801c22710 [jvm-packages] change class to object in examples (#1703)
* change class to object in examples

* fix compilation error
2016-10-26 14:54:56 -04:00
Nan Zhu
016ab89484 [jvm-packages] Parameter tuning tool for XGBoost (#1664) 2016-10-23 16:58:18 -04:00
RAMitchell
ac41845d4b Add GPU accelerated tree construction plugin (#1679) 2016-10-20 20:14:47 -07:00
Eric Liu
9b2e41340b make DMatrix._init_from_npy2d only copy data when necessary (#1637)
* make DMatrix._init_from_npy2d only copy data when necessary

When creating DMatrix from a 2d ndarray, it can unnecessarily copy the input data. This can be problematic when the data is already very large--running out of memory. The copy is temporary (going out of scope at the end of this function) but it still adds to peak memory usage.

``numpy.array`` copies its input no matter what by default. By adding ``copy=False``, it will only do so when necessary. Since XGDMatrixCreateFromMat is readonly on the input buffer, this copy is not needed.

Also added comments explaining when a copy can happen (if data ordering/layout is wrong or if type is not 32-bit float).

* remove whitespace
2016-10-20 09:30:52 -07:00
Jan Gorecki
e79a803a30 simplify installation of R pkg devel version (#1653) 2016-10-18 10:24:01 -07:00
Liam Huang
001d8c4023 correct CalcDCG in rank_metric.cc and rank_obj.cc (#1642)
* correct CalcDCG in rank_metric.cc

DCG use log base-2, however `std::log` returns log base-e.

* correct CalcDCG in rank_obj.cc

DCG use log base-2, however `std::log` returns log base-e.

* use std::log2 instead of std::log

 make it more elegant

* use std::log2 instead of std::log

make it more elegant
2016-10-18 10:23:41 -07:00
ziguang1216
94a9e3222e [python-package] Fix the issue #1439 (#1666)
*Fix 1439
        *Fix python_wrapper when eval set name contain '-' will cause early_stop maximize variable con't set to True propely

Change-Id: Ib0595afd4ae7b445a84c00a3a8faeccc506c6d13
2016-10-18 10:22:51 -07:00
EQGM
d3fc815b45 fix the problem that there is no libxgboost.dll (#1674)
fix the problem that there is no libxgboost.dll built with Visual Studio.
2016-10-18 09:56:48 -07:00
saihttam
4b9d488387 Add option on OSX to use macports (#1675) 2016-10-18 09:56:00 -07:00
Adam Pocock
445029bb82 [jvm-packages] XGBoost4j Windows fixes (#1639)
* Changes for Mingw64 compilation to ensure long is a consistent size.

Mainly impacts the Java API which would not compile, but there may be
silent errors on Windows with large datasets before this patch (as long
is 32-bits when compiled with mingw64 even in 64-bit mode).

* Adding ifdefs to ensure it still compiles on MacOS

* Makefile and create_jni.bat changes for Windows.

* Switching XGDMatrixCreateFromCSREx JNI call to use size_t cast

* Fixing lint error, adding profile switching to jvm-packages build to make create-jni.bat get called, adding myself to Contributors.Md
2016-10-18 08:35:25 -04:00
Jiading Gai
be90deb9b6 Fix a bug to handle Executable and Library with same name (xgboost) correctly. (#1669)
add_library(libxgboost SHARED ${SOURCES}) builds a library named
liblibxgboost.so; However, simply changing it to add_library(xgboost ...)
won't work, as add_executable(xgboost ...) and add_library(xgbboost ...)
will then have the same target name. This patch correctly handles the
same-name situation through SET_TARGET_PROPERTIES.
2016-10-15 18:29:40 -07:00
Nan Zhu
f5c776f64f [jvm-packages] add apache maven repo url and bump up default spark version to 2.0.1 (#1650)
* add apache maven repo url and bump up default spark version to 2.0.1
2016-10-13 08:55:03 -04:00
Nan Zhu
813a53882a [jvm-packages] deprecate Flaky test (#1662)
* deprecate flaky test
2016-10-13 07:21:24 -04:00
Yuan (Terry) Tang
63829d656c Fix mknfold using new StratifiedKFold API (#1660) 2016-10-12 14:43:37 -07:00
Nan Zhu
b56c6097d9 [jvm-packages] add Spark and XGBoost tutorial (#1649)
* add back train method but mark as deprecated

* add Spark and XGBoost tutorial

* fix scalastyle error
2016-10-11 09:41:24 -07:00
Tianqi Chen
8a7a6dba71 Update .travis.yml 2016-10-09 20:37:57 -07:00
Jonathan Rahn
c8ae52f17a add scikit-learn v0.18 compatibility (#1636)
* add scikit-learn v0.18 compatibility

import KFold & StratifiedKFold from sklearn.model_selection instead of sklearn.cross_validation

* change DeprecationWarning to ImportError

DeprecationWarning isn't an exception, so it should work the other way around.
2016-10-09 20:37:28 -07:00
Yuan (Terry) Tang
a64fd74421 Fix wrong expected feature types (#1646) 2016-10-08 21:16:29 -07:00
Kirill Sevastyanenko
485b6c86cc rm redundant lines in travis.yml (#1633) 2016-10-08 10:48:58 -07:00
Vadim Khotilovich
f9648ac320 [R-package] store numeric attributes with higher precision (#1628) 2016-10-03 11:01:17 -07:00
Nan Zhu
1673bcbe7e [jvm-packages] separate classification and regression model and integrate with ML package (#1608) 2016-09-30 11:49:03 -04:00
Shengwen Yang
3b9987ca9c Fix the issue 1474 (#1615)
* Fix 1474

* Fix crash issue when saving and loading poisson model

* Rollback the wrong fix
2016-09-29 19:29:47 -07:00
Vadim Khotilovich
3efff6d052 fix for VX (#1614) 2016-09-27 15:19:20 -07:00
Nan Zhu
37bc122c90 [jvm-packages] Robust dmatrix creation (#1613)
* add back train method but mark as deprecated

* robust matrix creation in jvm
2016-09-26 13:35:04 -04:00
phoenixbai
915ac0b8fe the fix of missing value assignment for name_ variable in EvalRankList method (#1558) 2016-09-26 08:57:17 -05:00
Vadim Khotilovich
693ddb860e More robust DMatrix creation from a sparse matrix (#1606)
* [CORE] DMatrix from sparse w/ explicit #col #row; safer arg types

* [python-package] c-api change for _init_from_csr _init_from_csc

* fix spaces

* [R-package] adopt the new XGDMatrixCreateFromCSCEx interface

* [CORE] redirect old sparse creators to new ones
2016-09-25 10:01:22 -07:00
Guido Tapia
e06f6a0df7 Update README.md - added windows binaries (#1600)
Added a link to the nightly windows binaries hosted on Guido Tapia's (my) blog
2016-09-21 23:14:07 -07:00
Guido Tapia
b0bfddba72 Update build.md - added link to nightly windows binaries (#1601)
Apologies for 2 PRs, was easier using githubs interface rather than doing it through git
2016-09-21 23:13:56 -07:00
chanis
62830be29d [python-package] modify libpath.py and fix typos (#1594)
* Update Makefile

* Update Makefile

* modify __init__.py

* modified libpath.py and fixed typos
2016-09-21 10:12:19 -07:00
Vlad Sandulescu
9f8116416b Added KDD Cup 2016 competition (#1596)
merged thanks
2016-09-21 11:47:01 -04:00
reg.zhuce
3ee145b8dc [jvm-packages] IndexOutOfBoundsException (#1589)
ml.dmlc.xgboost4j.scala.spark.XGBoost.scala:51

values is empty when we meet it at first time, so values(0) throw an IndexOutOfBoundsException.
It should be  dVector.values(i) instead of values(i).
2016-09-20 09:13:47 -04:00
chanis
d8876b0b73 [python-package] modify __init__.py (#1587)
* Update Makefile

* Update Makefile

* modify __init__.py
2016-09-19 09:43:36 -07:00
Manuel Schiller
d3c4d19c91 fix spelling mistake (#1584) 2016-09-18 09:52:01 -07:00
Xin Yin
7245145712 [jvm-packages] Fixed the sanity check for parameter 'nthread' against 'spark.task.cpus'. (#1582) 2016-09-16 11:31:35 -04:00
chanis
4041c39090 fix Makefile (#1579)
* Update Makefile

* Update Makefile
2016-09-15 10:44:49 -07:00
Nan Zhu
4ad648e856 [jvm-packages] predictLeaf with Dataframe (#1576)
* add back train method but mark as deprecated

* predictLeaf with Dataset

* fix

* fix
2016-09-15 06:15:47 -04:00
Nan Zhu
bb388cbb31 default eval func (#1574) 2016-09-14 13:26:16 -04:00
Tong He
4733357278 [R] Monotonic Constraints in Tree Construction (#1557)
* fix cran check

* change required R version because of utils::globalVariables

* temporary commit, monotone not working

* fix test

* fix doc

* fix doc
2016-09-11 22:16:33 -07:00
Nan Zhu
fb02797e2a [jvm-packages] Integration with Spark Dataframe/Dataset (#1559)
* bump up to scala 2.11

* framework of data frame integration

* test consistency between RDD and DataFrame

* order preservation

* test order preservation

* example code and fix makefile

* improve type checking

* improve APIs

* user docs

* work around travis CI's limitation on log length

* adjust test structure

* integrate with Spark -1 .x

* spark 2.x integration

* remove spark 1.x implementation but provide instructions on how to downgrade
2016-09-11 15:02:58 -04:00
chanis
7ff742ebf7 Update Makefile (#1566) 2016-09-11 09:48:11 -07:00
Tianqi Chen
c93c9b7ed6 [TREE] Experimental version of monotone constraint (#1516)
* [TREE] Experimental version of monotone constraint

* Allow default detection of montone option

* loose the condition of strict check

* Update gbtree.cc
2016-09-07 21:28:43 -07:00
Norbert
8cac37b2b4 Practical XGBoost in Python online course (#1542) 2016-09-06 11:12:56 -07:00
Tianqi Chen
ecec5f7959 [CORE] Refactor cache mechanism (#1540) 2016-09-02 20:39:07 -07:00
Nan Zhu
6dabdd33e3 [jvm-packages] bump to next version (#1535)
* bump to next version

* fix

* fix
2016-09-01 12:18:21 -04:00
闻波
8cdfec71b3 remove a redundant sentence, and a word 'and' (#1526)
* fix a typo

* fix a typo and some code format

* Update training.py

* delete redundant sentence
2016-08-31 11:51:40 -07:00
JohnStott
fd7c3b3543 MS Visual Studio 2015 fix (#1530)
Fixed to work with future versions of visual studio i.e., 2015

MSVC has it's own section for setting compile parameters, it shouldn't need to fall into section below i.e., checking for c++11 as this is definitely already supported, though this isn't an issue for Visual Studio 2012, it breaks for later versions
of visual studio i.e., 2015 when the default c++ is version 14.  Though still backward compatible with c++11
2016-08-31 11:51:16 -07:00
Nan Zhu
7fb3fbf577 impose shuffle when creating training RDD (#1531) 2016-08-31 07:34:10 -04:00
Nan Zhu
3f198b9fef [jvm-packages] allow training with missing values in xgboost-spark (#1525)
* allow training with missing values in xgboost-spark

* fix compilation error

* fix bug
2016-08-29 21:45:49 -04:00
Dex Groves
6014839961 Fix minor typos in parameters.md (#1521) 2016-08-29 09:02:03 -04:00
Nan Zhu
74db1e8867 [jvm-packages] remove APIs with DMatrix from xgboost-spark (#1519)
* test consistency of prediction functions between DMatrix and RDD

* remove APIs with DMatrix from xgboost-spark

* fix compilation error in xgboost4j-example

* fix test cases
2016-08-28 21:25:49 -04:00
Nan Zhu
6d65aae091 [jvm-packages] test consistency of prediction functions with DMatrix and RDD (#1518)
* test consistency of prediction functions between DMatrix and RDD

* fix the failed test cases
2016-08-28 20:27:03 -04:00
Nan Zhu
d7f79255ec improve test of save/load model (#1515) 2016-08-27 17:16:22 -04:00
kiselev1189
53ce511be3 Fix how maximize_metric value is determined in early_stop (#1451)
* Update callback.py

* Update callback.py
2016-08-27 13:09:24 -07:00
Tianqi Chen
df38f251be Fix warnings from g++5 or higher (#1510) 2016-08-26 16:14:10 -07:00
Preston Parry
0627213544 Fixes typo "candicate" (#1508) 2016-08-26 14:00:27 -07:00
Preston Parry
cf4951b0b0 Fixes another typo "candicate" (#1509) 2016-08-26 14:00:23 -07:00
Dan Harbin
78ae772f2c Make python package wheelable (#1500)
Currently xgboost can only be installed by running:

    python setup.py install

Now it can be packaged (in binary form) as a wheel and installed like:

    pip install xgboost-0.6-py2-none-any.whl

distutils and wheel install `data_files` differently than setuptools.
setuptools will install the `data_files` in the package directory whereas the
others install it in `sys.prefix`. By adding `sys.prefix` to the list of
directories to check for the shared library, xgboost can now be distributed as
a wheel.
2016-08-26 14:00:11 -07:00
Tong He
170b349f3e Fix the "No visible binding" CRAN checks (#1504)
* fix cran check

* change required R version because of utils::globalVariables
2016-08-26 10:24:04 -07:00
Francesco Mosconi
d754ce7dc1 Fixed OpenMP installation on MacOSX with gcc-6 (#1460)
* Fixed OpenMP installation on MacOSX with gcc-6

- Modified makefile from gcc-5 to gcc-6
- Removed deprecated install instructions from doc (gcc-5 was automatically forced if available in makefile on OSX)

* Fixed OpenMP installation on MacOSX with gcc-6

- Modified makefile from gcc-5 to gcc-6
- Removed deprecated install instructions from doc (gcc-5 was automatically forced if available in makefile on OSX)
2016-08-22 10:30:34 -07:00
Frank
93e85139bc fix #1476 (#1494) 2016-08-20 17:27:57 -07:00
Nan Zhu
dc1125eb56 evaluation with RDD data (#1492) 2016-08-20 18:31:10 -04:00
Nan Zhu
582ee63e34 enable train multiple models by distinguishing stage IDs (#1493) 2016-08-20 16:37:07 -04:00
Vadim Khotilovich
bdfa8c0e09 [R-package] a few fixes for R (#1485)
* [R] fix #1465

* [R] add sanity check to fix #1434

* [R] some clean-ups for custom obj&eval; require maximize only for early stopping
2016-08-20 05:09:03 -05:00
Tong He
b8e6551734 Add unittest for garbage collection's safety in R (#1490)
* Add test for garbage collection safety
2016-08-19 16:55:03 -07:00
Yixuan Qiu
664a3bc7de fix segfault when gctorture() is enabled (#1489) 2016-08-19 15:10:21 -07:00
Nan Zhu
70432cac5b make IEvaluation serializable (#1487) 2016-08-19 13:12:39 -04:00
SiNZeRo
f8fb18675e resolved dead link in demo/distributed-training/README.md (#1484) 2016-08-19 08:10:08 -05:00
Yuan (Terry) Tang
d5178231cb Update discoverYourData.Rmd (#1482)
* Fixed some typos
* RF is not experimental anymore
2016-08-19 00:46:45 -05:00
闻波
669a387c99 fix a typo and some code format (#1470)
* fix a typo

* fix a typo and some code format
2016-08-18 12:41:18 -07:00
Shuyu Liang
d85e287b99 Fix #1464 (#1468)
1. Remove the extra ` to fix https://xgboost.readthedocs.io/en/latest/build.html
2. Use ` for inline code
2016-08-18 11:57:13 -07:00
ZhuWen
59246350ca Fixed syntax error in https://xgboost.readthedocs.io/en/latest/build.html. (#1477) 2016-08-18 14:51:30 -04:00
Qiang Kou (KK)
6d0426e6e3 issue template (#1475) 2016-08-17 22:50:37 -07:00
hxd1011
c529cac6ff Update model.md (#1461)
make math better, specifically, unify the notation for Theta or theta. changed basic linear model notation from weight w to theta to make more consistent. Changed Obj function notation also
2016-08-12 16:43:07 -05:00
Hongliang Liu
c5a2b79558 PyPI (pip installation) setup for 0.6 code (#1445)
* force gcc-5 or clang-omp for Mac OS, prepare for pip pack

* add sklearn dep, make -j4

* finalize PyPI submission

* revert to Xcode clang for passing build #1468

* force to clang, try to solve cmake travis error

* remove sklearn dependency
2016-08-10 07:45:56 -05:00
Bargava
62e5b6b8b3 updating Mac installation instructions (#1443)
In Mac, even after gcc is installed from homebrew, gcc and g++ still point to clang's version. 

Need to update the make/config.mk file to point the gcc and g++ compliers to the version installed by homebrew. 

More details can be found in this blog: https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_on_Mac_OSX?lang=en
2016-08-08 09:20:15 -07:00
Baltazar Bieniek
7addebb2ea Updated - fix merged (#1425)
https://github.com/dmlc/xgboost/pull/1417
2016-08-02 14:46:45 -07:00
Tianqi Chen
37e29976cc Update param_tuning.md 2016-08-01 10:48:00 -07:00
Tianqi Chen
4a8d63b6c8 Tag version 0.6 (#1422) 2016-07-29 11:23:06 -07:00
Vadim Khotilovich
75f401481f no exception throwing within omp parallel; set nthread in Learner (#1421) 2016-07-29 10:08:03 -07:00
Baltazar Bieniek
89c4f67f59 Class function returns more than one value (#1417)
Fix to a bug when the class function returns more than one value. In that case, the code will fail.
2016-07-29 10:07:09 -07:00
Fangzhou
a8adf16228 fix bug: doing rabit call after finalize in spark prediction phase (#1420) 2016-07-28 23:11:20 -05:00
Johnny Ho
328e8e4c69 Update rabit repository (#1409) 2016-07-27 11:40:42 -07:00
Vadim Khotilovich
d5c143367d [R-package] GPL2 dependency reduction and some fixes (#1401)
* [R] do not remove zero coefficients from gblinear dump

* [R] switch from stringr to stringi

* fix #1399

* [R] separate ggplot backend, add base r graphics, cleanup, more plots, tests

* add missing include in amalgamation - fixes building R package in linux

* add forgotten file

* [R] fix DESCRIPTION

* [R] fix travis check issue and some cleanup
2016-07-27 00:05:04 -07:00
Tianqi Chen
f6423056c0 Update dmlc-core (#1408) 2016-07-26 10:53:31 -07:00
Tianqi Chen
c3eb4f7000 Move model doc images to web-data (#1397) 2016-07-23 23:53:22 -07:00
Earthson Lu
d29edc677c fix #1377 spark-mllib scope: default => provided (#1381) 2016-07-20 23:10:49 -04:00
Shengwen Yang
7089301b62 Metrics for gamma regression (#1369)
* Add deviance metric for gamma regression

* Simplify the computation of nloglik for gamma regression

* Add a description for gamma-deviance

* Minor fix
2016-07-18 09:10:44 -05:00
Yuan (Terry) Tang
c60a356273 Remove pypi downloads badge (#1365) 2016-07-16 13:36:05 -04:00
anpark
0e61c514a7 fix duplicate loop over output_group when predict (#1342)
* fix sparse page source meta info empty when load from dmatrix

* fix duplicate loop over output_group when predict
2016-07-13 10:03:10 -07:00
convexquad
313764b3be Expose predictLeaf functionality in Scala XGBoostModel (#1351) 2016-07-12 06:55:24 -04:00
Titouan Lorieul
75d9be55de [py] fix label encoding of eval sets in sklearn API (#1244) 2016-07-11 05:29:46 -05:00
Yuan (Terry) Tang
197b4c6b18 Update DESCRIPTION (#1348) 2016-07-10 09:59:16 -07:00
Yuan (Terry) Tang
5f179340a8 Merge pull request #1347 from marugari/prototype_dart
add Dart tutorial
2016-07-10 09:19:44 -05:00
marugari
c332eb5a2b add Dart tutorial 2016-07-10 20:12:42 +09:00
Rahul
f14c160f4f [jvm-packages][xgboost4j-spark][Minor] Move sparkContext dependency from the XGBoostModel (#1335)
* Move sparkContext dependency from the XGBoostModel

* Update Spark example to declare SparkContext as implict
2016-07-08 06:43:33 -04:00
anpark
3f32b3f0eb fix sparse page source meta info empty when load from dmatrix (#1336) 2016-07-07 21:17:35 -07:00
Shengwen Yang
77d17f6264 Add support for Gamma regression (#1258)
* Add support for Gamma regression

* Use base_score to replace the lp_bias

* Remove the lp_bias config block

* Add a demo for running gamma regression in Python

* Typo fix

* Revise the description for objective

* Add a script to generate the autoclaims dataset
2016-07-06 10:22:46 -07:00
Ryan Curtin
f74e2439e0 Fix spelling error. (#1331) 2016-07-05 12:58:24 -07:00
JP Rosevear
13445e3522 Check for visual studio 12.0 and newer for c++11 support (#1330) 2016-07-04 18:32:20 -07:00
Vadim Khotilovich
11efa038bd [R-package] various fixes for R CMD check (#1328)
* [R] fix xgb.create.features

* [R] fixes for R CMD check
2016-07-04 10:40:35 -07:00
RAMitchell
f8d23b97be Add build instructions for Visual Studio 2013 (#1327) 2016-07-03 21:30:50 -07:00
Tong He
44ed6d5674 Merge pull request #1264 from khotilov/r_callbacks
[R-package] callbacks per #892
2016-07-03 13:43:29 -07:00
Vadim Khotilovich
4fb1b8a5a7 Merge branch 'master' into r_callbacks 2016-07-03 15:04:58 -05:00
Muhammad Haseeb Tariq
7533191af7 Typos in README (#1326)
* Inconsistency in libsvm formats

* note on libsvm formats

* typos in README

* Update README.md

* Update README.md

* Update README.md
2016-07-03 15:14:35 -04:00
Muhammad Haseeb Tariq
14f9697025 Inconsistency in libsvm formats (#1325)
* Inconsistency in libsvm formats

* note on libsvm formats
2016-07-03 10:49:41 -07:00
RAMitchell
93196eb811 cmake build system (#1314)
* Changed c api to compile under MSVC

* Include functional.h header for MSVC

* Add cmake build
2016-07-02 19:07:35 -07:00
Frank
3b73824842 Fix ambiguous call to abs(c or c++). (#1308) 2016-06-29 14:28:28 -07:00
Vadim Khotilovich
344d7b4699 [R] disable for now some of the RF tests that fail in travis 2016-06-27 02:49:23 -05:00
Vadim Khotilovich
ae0ca486ed added name to DESCRIPTION 2016-06-27 02:23:37 -05:00
Vadim Khotilovich
4b2eedc186 fix merge conflicts 2016-06-27 02:18:59 -05:00
Vadim Khotilovich
e1a52e896c [R] rm renamed CB's docs 2016-06-27 02:01:54 -05:00
Vadim Khotilovich
fd4300b95a [R] additional and modified tests 2016-06-27 02:00:46 -05:00
Vadim Khotilovich
3b6b344561 [R] adopt demos and vignettes to a more consistent parameter style 2016-06-27 02:00:39 -05:00
Vadim Khotilovich
a0aa305268 [R] docs update - callbacks and parameter style 2016-06-27 01:59:58 -05:00
Vadim Khotilovich
e9eb34fabc [R] parameter style consistency 2016-06-27 01:58:03 -05:00
Vadim Khotilovich
56bd442b31 [R] simplified the code; parameter style consistency 2016-06-27 01:57:57 -05:00
Vadim Khotilovich
8473b18c3d [R] consolidate importFrom-s; parameter style 2016-06-27 01:50:03 -05:00
Vadim Khotilovich
b9aeeda074 [R] in predict: doc, examples, reshape parameter 2016-06-27 01:49:57 -05:00
Vadim Khotilovich
c342614a81 [R] add parameter deprecation related utilities; code style 2016-06-27 01:49:51 -05:00
Vadim Khotilovich
76650c096f [R] CB naming change; cv-prediction as CB; add.cb function to ensure proper CB order; docs; minor fixes + changes 2016-06-27 01:49:47 -05:00
Nan Zhu
bd5b07873e [jvm-packages] create dmatrix with specified missing value (#1272)
* create dmatrix with specified missing value

* update dmlc-core

* support for predict method in spark package

repartitioning

work around

* add more elements to work around training set empty partition issue
2016-06-21 17:35:17 -04:00
Nan Zhu
c9a73fe2a9 explicitly throw exception when detecting empty partition in training dataset (#1281) 2016-06-15 16:03:37 -04:00
Bill Chambers
465e5dfb87 Broken Link in README (#1275) 2016-06-13 15:41:24 -07:00
Tong He
9cb872b879 Merge pull request #914 from catena/master
R: fix "bestInd" and add "best_ntreelimit" to xgb.Booster
2016-06-13 11:13:00 -07:00
catena
661c062bd9 add best_ntreelimit attribute 2016-06-13 12:45:20 +05:30
Vladimir
aaf0a73486 fixed error when eval False (#1271) 2016-06-12 09:36:36 -07:00
Yoshinori Nakano
7cfeb5f012 fix Dart::NormalizeTrees (#1265) 2016-06-09 15:28:24 -07:00
Vadim Khotilovich
4e1269b522 print.xgb.cv fix - Rd too 2016-06-09 10:12:20 -05:00
Vadim Khotilovich
79704cdfb4 print.xgb.cv fix 2016-06-09 09:29:19 -05:00
Vadim Khotilovich
f34f9fb9f7 R-callbacks tests + other tests brushup 2016-06-09 02:53:37 -05:00
Vadim Khotilovich
2e0ffcc303 R-callbacks docs 2016-06-09 02:52:09 -05:00
Vadim Khotilovich
422b0000a8 R-callbacks refactor 2016-06-09 02:46:13 -05:00
Vadim Khotilovich
754f3a6e07 protection against returning 0-length vector 2016-06-09 02:45:02 -05:00
Vadim Khotilovich
bdf14007b5 print method; construct from initial xgb.Booster 2016-06-09 02:43:25 -05:00
Vadim Khotilovich
264c222fe0 Merge remote-tracking branch 'upstream/master' 2016-06-09 02:32:26 -05:00
Yoshinori Nakano
949d1e3027 add Dart booster (#1220) 2016-06-08 14:04:01 -07:00
Shengwen Yang
e034fdf74c Fix issue #1236: cli_main crashes when dumping count:poisson model (#1253) 2016-06-07 21:52:47 -07:00
Szilard Pafka
e2c1aa8b51 link to talk (video+slides) by Tianqi at Los Angeles Data Science meetup (#1254)
* link to talk (video+slides) by Tianqi

* benchmark
2016-06-07 21:43:52 -07:00
Vadim Khotilovich
9a48a40cf1 Fixes for multiple and default metric (#1239)
* fix multiple evaluation metrics

* create DefaultEvalMetric only when really necessary

* py test for #1239

* make travis happy
2016-06-04 22:17:35 -07:00
Vadim Khotilovich
26a82621a2 make travis happy 2016-06-04 22:38:24 -05:00
Vadim Khotilovich
ba04a1d552 py test for #1239 2016-06-04 22:08:10 -05:00
Yuan (Terry) Tang
9ef86072f4 Merge pull request #1241 from KhaoticMind/master
[py]Preserve the actual objective used on the booster - Fixed #1215
2016-06-01 09:11:49 -05:00
Antonio Augusto Santos
19129b289c Preserve the actal objective used on the booster
Save the actual objective used on xgboost.train.

Not saving it was giving problem in predict_proba, as issue  #1215
2016-05-31 19:01:10 -03:00
Vadim Khotilovich
22ad94d281 create DefaultEvalMetric only when really necessary 2016-05-31 08:20:25 -05:00
Vadim Khotilovich
64b9dcf7b5 fix multiple evaluation metrics 2016-05-31 08:20:17 -05:00
Tianqi Chen
6e3463097d Merge pull request #1232 from zl1zl/master
fix cli_main crashes when using count:poisson regression
2016-05-27 20:22:50 -07:00
Zhongliang Li
1dde863c98 fix cli_main crashes when using count:poisson regression 2016-05-26 10:03:29 -07:00
Tianqi Chen
2ef81e0673 Merge pull request #1228 from albertotb/master
XGBModel doctstring
2016-05-25 10:38:48 -07:00
Alberto Torres
118eb2f1bb Merge pull request #1 from albertotb/sklearn-docstring
Update sklearn.py
2016-05-25 15:02:41 +02:00
Alberto Torres
af2e9ebd82 Update sklearn.py 2016-05-25 15:00:11 +02:00
Tianqi Chen
5c14daffe2 Merge pull request #1221 from ryaninhust/master
[DATA] fix instance weights loading
2016-05-24 20:19:31 -07:00
Nan Zhu
c6631ad2ed specify spark version (#1224) 2016-05-24 18:19:32 -04:00
yuanbowen
5898f1c59e [DATA] fix instance weights loading 2016-05-23 18:40:41 +08:00
Nan Zhu
c85b9012c6 [jvm-packages] xgboost4j-spark external memory (#1219)
* implement external memory support for XGBoost4J

* remove extra space

* enable external memory for prediction

* update doc
2016-05-22 14:01:28 -04:00
Tianqi Chen
587999755f Merge pull request #1218 from tqchen/master
[DATA] fix async data writing
2016-05-21 19:40:41 -07:00
tqchen
d816208797 [DATA] fix async data writing 2016-05-21 18:46:36 -07:00
Tianqi Chen
a4d8c1b49f redirects funding info to UW page 2016-05-21 11:07:55 -07:00
Tianqi Chen
cc5112d405 Merge pull request #1214 from tqchen/master
add style
2016-05-20 13:11:48 -07:00
tqchen
2c0c06639c add style 2016-05-20 13:11:27 -07:00
Tianqi Chen
47f359ca9f Merge pull request #1213 from tqchen/master
[DOC] refactor doc
2016-05-20 13:10:11 -07:00
tqchen
84ae514d7e [DOC] refactor doc 2016-05-20 13:09:42 -07:00
Tianqi Chen
e4ea166d05 Merge pull request #1211 from tqchen/master
[PYTHON] Refactor trainnig API to use callback
2016-05-19 21:47:25 -07:00
tqchen
149589c583 [PYTHON] Refactor trainnig API to use callback 2016-05-19 21:31:23 -07:00
Tianqi Chen
03996dd4e8 Update NEWS.md 2016-05-19 11:04:48 -07:00
Michaël Benesty
51154f42fe Merge pull request #1118 from khotilov/parsing_speedup
[R-package] xgb.model.dt.tree up to x100 faster
2016-05-17 17:48:11 +02:00
Vadim Khotilovich
611b317057 make travis happy 2016-05-17 00:24:06 -05:00
Vadim Khotilovich
2b8b18583f some more xgb.model.dt.tree improvements 2016-05-17 00:24:06 -05:00
Vadim Khotilovich
be65949ba2 xgb.model.dt.tree up to x100 faster 2016-05-17 00:24:06 -05:00
Tianqi Chen
49bbd72d08 Merge pull request #1198 from khotilov/xgb_attributes
More functionality for model attributes
2016-05-16 09:31:58 -07:00
Vadim Khotilovich
ffed95eec0 py: replace attr_names() with attributes() 2016-05-15 22:04:38 -05:00
Vadim Khotilovich
26b36714ea doxygen suggested fix 2016-05-15 03:05:19 -05:00
Vadim Khotilovich
185fef3fce fixes for lint 2016-05-15 02:35:37 -05:00
Vadim Khotilovich
a13a3a4d76 attr_names for python interface; attribute deletion via set_attr 2016-05-15 02:05:10 -05:00
Vadim Khotilovich
8664217a5a [R] more attribute handling functionality 2016-05-14 18:19:18 -05:00
Vadim Khotilovich
ea9285dd4f methods to delete an attribute and get names of available attributes 2016-05-14 18:19:18 -05:00
Tianqi Chen
9c26566eb0 Merge pull request #1190 from geneorama/geneorama-patch-1
add `scale_pos_weight` to parameter documentation
2016-05-11 15:06:21 -07:00
Tianqi Chen
07003e8342 Merge pull request #1191 from SeanBE/fix-build-doc
make grammar and spelling fixes to build doc
2016-05-11 15:06:04 -07:00
Sean Löfgren
bf322322fe make grammar and spelling fixes to build doc 2016-05-11 22:56:29 +01:00
Gene Leynes
2e7abffffb add scale_pos_weight to parameter documentation 2016-05-11 14:10:36 -05:00
Tianqi Chen
617aeb912b Merge pull request #1186 from tqchen/master
Update rabit to latest
2016-05-10 20:18:14 -07:00
tqchen
44d4a62631 Update rabit to latest 2016-05-10 20:07:22 -07:00
Tianqi Chen
bab69919d2 Merge pull request #1181 from shaynekang/visible_deprecation_warning
Fix VisibleDeprecationWarning
2016-05-07 11:11:58 -07:00
Shayne Kang
bf24d6ae98 fix VisibleDeprecationWarning 2016-05-08 01:44:04 +09:00
Yuan (Terry) Tang
840481d215 Merge pull request #1180 from borundev/master
call to DMatrix was missing 'missing=self.missing'
2016-05-07 10:42:00 -04:00
Borun Dev Chowdhury
fc02f8a2dc cosmetic change
cosmetic change of putting space after comma compared to previous edit.
2016-05-07 12:33:37 +02:00
borundev
95bcff90af XGBModel.fit had a call to DMatrix without missing=self.missing. fixed that 2016-05-07 12:32:03 +02:00
Tianqi Chen
6e79ba831a Merge pull request #1166 from khotilov/r_api_fix
[R-package] C-API fix; attribute accessors
2016-05-06 20:35:28 -07:00
Yuan (Terry) Tang
b92e2252b0 Merge pull request #1173 from tlorieul/sklearn_get_trees_leaves
[py] added apply function in sklearn API to return the predicted leaves
2016-05-04 08:02:08 -05:00
Titouan Lorieul
3ab8f0b13d [py] added apply function in sklearn API to return the predicted leaves 2016-05-04 12:27:30 +02:00
Saiwing Yeung
28cdc10259 Fixed a typo (#1172)
panda -> Pandas
2016-05-03 19:29:22 -05:00
Alistair Johnson
6750c8b743 Added other feature importances in python package (#1135)
* added new function to calculate other feature importances

* added capability to plot other feature importance measures

* changed plotting default to fscore

* added info on importance_type to boilerplate comment

* updated text of error statement

* added self module name to fix call

* added unit test for feature importances

* style fixes
2016-05-02 12:25:24 -05:00
Vadim Khotilovich
5a78118396 use short-circuiting scalar && 2016-05-02 01:01:22 -05:00
Vadim Khotilovich
79c7c9e5bb R accessors for model attributes 2016-05-02 00:20:44 -05:00
Vadim Khotilovich
0839aed380 fix attribute accessors C-interface for R 2016-05-02 00:19:38 -05:00
Yuan (Terry) Tang
c2c61eefd9 Merge pull request #1164 from sinhrks/fix_doc
DOC/TST: Fix Python sklearn dep
2016-05-01 16:18:03 -05:00
Vadim Khotilovich
b5fb437aa7 learner attribute setter & getter for R interface 2016-05-01 15:40:51 -05:00
Vadim Khotilovich
b588479f66 .Call-interface functions need to return SEXP 2016-05-01 15:40:51 -05:00
sinhrks
9da2f3e613 DOC/TST: Fix Python sklearn dep 2016-05-01 17:27:43 +09:00
Tianqi Chen
2f2ad21de4 Merge pull request #1153 from khotilov/seed_in_configure
Fixes for repeated Configure calls
2016-04-30 10:43:14 -07:00
Yuan (Terry) Tang
da85a4e923 Merge pull request #1161 from Far0n/eta_decay_fix
[py] eta decay bugfix
2016-04-30 10:50:52 -04:00
Faron
ad3f49e881 [py] eta decay bugfix 2016-04-30 15:51:57 +02:00
Yuan (Terry) Tang
9bc2ac4bd0 Merge pull request #1158 from sinhrks/feature_bug
Bug mixing DMatrix's with and without feature names
2016-04-30 09:20:58 -04:00
sinhrks
6bab164d80 Bug mixing DMatrix's with and without feature names 2016-04-30 14:42:57 +09:00
Yuan (Terry) Tang
ff4dda2102 Merge pull request #1159 from saiwing-yeung/my-fix
fixed typo
2016-04-30 00:38:18 -04:00
Saiwing Yeung
a6909e389f fixed typo
panda -> Pandas
2016-04-30 09:24:39 +08:00
Yuan (Terry) Tang
3434083d3e Merge pull request #1017 from Far0n/hist
[py] split value histograms
2016-04-28 13:52:49 -05:00
Faron
cf607e2448 [py] split value histograms 2016-04-28 20:26:21 +02:00
Yuan (Terry) Tang
6691d5c3f4 Merge pull request #1141 from sinhrks/pandas_features
BUG: XGBClassifier.feature_importances_ raises ValueError if input is…
2016-04-27 18:07:51 -05:00
sinhrks
c55cc809e5 BUG: XGBClassifier.feature_importances_ raises ValueError if input is pandas DataFrame 2016-04-27 21:50:03 +09:00
Vadim Khotilovich
24e3c5773e Merge branch 'master' into seed_in_configure 2016-04-26 22:47:01 -05:00
Vadim Khotilovich
811c6ef58b obey the lint 2016-04-26 22:11:19 -05:00
Tianqi Chen
4149854633 Merge pull request #1068 from Laurae2/master
Updated obsolete installation instructions
2016-04-26 19:50:06 -07:00
Tianqi Chen
43c073d8c5 Merge pull request #1142 from sinhrks/flake8
Enable flake8 for Python
2016-04-26 19:47:42 -07:00
Tianqi Chen
5d7a69663b Merge pull request #1145 from khotilov/error_at_threshold
ability to specify threshold for the error metric
2016-04-26 19:46:37 -07:00
Vadim Khotilovich
3e0732dea9 in Configure, set random seed only for uninitialized model 2016-04-26 02:03:22 -05:00
Vadim Khotilovich
0527b17c9d avoid collecting duplicate parameters in Booster::cfg_ 2016-04-25 22:08:53 -05:00
Vadim Khotilovich
1160d0bf25 ability to specify threshold for the error metric 2016-04-25 01:29:04 -05:00
sinhrks
8fc2456c87 Enable flake8 2016-04-24 17:32:31 +09:00
Tianqi Chen
b3c9e6a0db Merge pull request #1139 from hxd1011/patch-2
Update parameter.md
2016-04-22 12:12:01 -07:00
hxd1011
04ace6311b Update parameter.md
add some detail how the parameter will affect model complexity, and comment on the base score.
2016-04-22 14:42:11 -04:00
Nan Zhu
060350f64c Merge pull request #1103 from dmlc/revert-1100-master
Revert "updating JVM docs"
2016-04-11 22:36:37 -04:00
Nan Zhu
e6de01baaf Revert "updating JVM docs" 2016-04-11 22:00:45 -04:00
Tianqi Chen
f2557ce530 Merge pull request #1102 from tqchen/master
allow common python output in single node
2016-04-11 16:04:52 -07:00
Tianqi Chen
db4c5bc627 Merge pull request #1100 from avloss/master
updating JVM docs
2016-04-11 15:49:33 -07:00
tqchen
49f3892942 allow common python output in single node 2016-04-11 15:48:16 -07:00
avl055
f75d78f686 updating JVM docs
adding “-DskipTests” to Docs for JVM. without this flag building takes
forever
2016-04-10 23:52:09 +01:00
Yuan (Terry) Tang
59610c49df Merge pull request #1098 from zyxue/patch-1
improved docstring for folds in cv function
2016-04-09 14:09:10 -04:00
zyxue
79b35da308 improved docstring for folds in cv function 2016-04-09 10:21:56 -07:00
Yuan (Terry) Tang
c791894668 Merge pull request #1097 from Far0n/patch-1
winning solution
2016-04-09 07:44:43 -04:00
Far0n
d7e5095e7c Update README.md
Winning solution added: "Homesite Quote Conversion" (@Kaggle)
2016-04-09 09:12:49 +02:00
Tong He
4af55518f2 Merge pull request #1050 from khotilov/S4toS3
[R-package] Convert to S3; some new DMatrix methods
2016-04-03 11:52:08 -07:00
Vadim Khotilovich
25965227b3 Merge branch 'master' into S4toS3 2016-04-02 14:30:44 -05:00
Tianqi Chen
714901eac5 Merge pull request #1071 from khotilov/make_fix
fix Makefile to use MAKE variable
2016-03-30 23:22:21 -07:00
Vadim Khotilovich
de63993543 Merge branch 'master' into make_fix 2016-03-31 01:19:52 -05:00
Vadim Khotilovich
9f177d7353 fix Makefile to use MAKE variable 2016-03-31 00:47:51 -05:00
Tianqi Chen
babf1d7840 Merge pull request #1048 from WojciechMigda/xgboostercreate-api-fix
XGBoosterCreate api unified to use const DMatrixHandle[] argument
2016-03-30 20:56:10 -07:00
Laurae2
77136baf2c Updated obsolete installation instructions
Fixed local compilation, and installation for R package and Python
package. Modified the according documents.
2016-03-30 17:43:54 +02:00
WojciechMigda
30a306b974 Merge branch 'master' into xgboostercreate-api-fix 2016-03-30 11:25:21 +02:00
Nan Zhu
6eda06256e Merge pull request #1057 from CodingCat/master
update doc
2016-03-28 20:09:53 -04:00
Nan Zhu
e27977d416 Merge branch 'master' into master 2016-03-28 19:03:04 -04:00
CodingCat
daeee84e4d update doc 2016-03-28 19:02:37 -04:00
Vadim Khotilovich
33131e2e13 make travis happy 2016-03-27 20:28:40 -05:00
Vadim Khotilovich
fb5291271e fix print.xgb.DMatrix doc 2016-03-27 19:42:26 -05:00
Vadim Khotilovich
4b760762f9 added unit tests for xgb.DMatrix 2016-03-27 19:23:08 -05:00
Vadim Khotilovich
71f402ac16 convert S4 to S3; add some extra methods to DMatrix 2016-03-27 19:22:22 -05:00
Vadim Khotilovich
d27bfb61b0 consolidated DMatrix&Booster stuff into xgb.DMatrix.R & xgb.Booster.R 2016-03-27 19:17:13 -05:00
Vadim Khotilovich
1d504d6c6c added XGDMatrixNumCol_R function 2016-03-27 19:11:22 -05:00
Wojciech Migda
6a5eb47789 XGBoosterCreate api unified to use const DMatrix[] argument 2016-03-26 19:42:58 +01:00
Nan Zhu
605c23e0dc Merge pull request #1037 from CodingCat/allow_empty_partitions
[jvm-packages] allow empty partitions
2016-03-23 15:04:51 -04:00
Nan Zhu
dfafce4cfd Merge branch 'master' into allow_empty_partitions 2016-03-23 12:30:33 -04:00
CodingCat
d8535313eb allow empty partitions 2016-03-23 12:30:06 -04:00
Tianqi Chen
03dfffca15 Merge pull request #1028 from kilojoules/patch-6
More verbose error message: which fields have impropper data types
2016-03-22 21:02:17 -07:00
Julian Quick
bbb9ce1641 Verbose message: which fields have impropper data types
A more verbose error message letting the user know which fields have impropper data types
2016-03-22 14:13:29 -06:00
Tianqi Chen
1625dab1cb Merge pull request #1025 from andyandy1992/master
Fixed typos.
2016-03-22 08:49:32 -07:00
Andrew Smith
5efc1ee3a4 Fixed typos. 2016-03-22 12:54:18 +00:00
Nan Zhu
c135703655 Merge pull request #1012 from CodingCat/master
update installation doc
2016-03-19 08:58:41 -04:00
Nan Zhu
8842176888 Merge branch 'master' into master 2016-03-19 08:16:18 -04:00
CodingCat
f1114688a7 update installation doc 2016-03-19 08:15:56 -04:00
Tianqi Chen
7c555d5bc6 Update README.md 2016-03-18 15:28:38 -07:00
Nan Zhu
11415f228f Merge pull request #1010 from CodingCat/master
[jvm-packages] adjust numWorkers for test
2016-03-18 11:30:31 -04:00
Nan Zhu
14a031a1ab Merge branch 'master' into master 2016-03-18 10:36:20 -04:00
CodingCat
55ab1c6a22 adjust numWorkers for test 2016-03-18 10:34:36 -04:00
Nan Zhu
a2146708bd Merge pull request #1008 from CodingCat/master
typo fix
2016-03-18 07:12:14 -04:00
Nan Zhu
0b998d5249 Merge branch 'master' into master 2016-03-18 06:56:06 -04:00
Tianqi Chen
0e0f0e75f6 Merge pull request #1009 from Keiku/work
Add a new winning solution to demo/README.md
2016-03-17 20:33:04 -07:00
Keiku
7016bee98f Add a new winning solution to demo/README.md 2016-03-18 12:06:36 +09:00
Nan Zhu
ffe7af572c Merge branch 'master' into master 2016-03-17 23:00:50 -04:00
Tianqi Chen
375a8a97a6 Merge pull request #1006 from kilojoules/patch-4
a more verbose field mismatch error message
2016-03-17 19:56:33 -07:00
CodingCat
cc0722a4aa typo fix 2016-03-17 22:17:08 -04:00
Julian Quick
2cd109fb98 a more verbose field mismatch error message
This error message can be hard to understand when there are several fields, as shown in the example below. This improves the error message, letting the user know which fields were unexpected or missing.

    import xgboost as xgb
    import pandas as pd
    train = pd.DataFrame({'a':[1], 'b':[2], 'c':[3], 'd':[4], 'f':[2], 'g':2, 'etc etc etc':[11]})
    dtrain = xgb.DMatrix(train.drop('d', axis=1), train.d)
    test = pd.DataFrame({'a':[1], 'b':[2], 'c':[1], 'd':[4], 'e':[2], 'f':[2], 'g':2, 'etc etc etc':[11]})
    dtest = xgb.DMatrix(test)
    modl = xgb.train({}, dtrain)
    modl.predict(dtest)
    
    
    # ValueError: feature_names mismatch: [u'a', u'b', u'c', u'etc etc etc', u'f', u'g'] [u'a', u'b', u'c', u'd', u'e', u'etc etc etc', u'f', u'g']
2016-03-17 18:13:30 -06:00
Tianqi Chen
c449dc6874 Merge pull request #1003 from DrAndrey/master
change type of xgbclassifier.classes_ from list to numpy array
2016-03-17 09:51:05 -07:00
DAndrey
311f7c8f47 change type of xgbclassifier.classes_ from list to numpy array 2016-03-17 16:54:33 +03:00
Tianqi Chen
612ccd0bb7 Merge pull request #1000 from CodingCat/installation_doc
[jvm-packages] run native lib building command from maven
2016-03-16 14:06:19 -07:00
CodingCat
6f273a8c21 update docs 2016-03-16 17:00:44 -04:00
CodingCat
a31a978471 run native lib building command from maven 2016-03-16 16:47:08 -04:00
Tianqi Chen
6321bc20ea Merge pull request #996 from CNevd/patch-1
Update README.md
2016-03-15 19:34:36 -07:00
CNevd
73d5965961 Update README.md 2016-03-16 10:28:22 +08:00
Tianqi Chen
c2fa67757a Merge pull request #995 from ohld/year-update
update year in LICENSE, conf.py and README.md files
2016-03-15 09:34:10 -07:00
Okhlopkov Daniil Olegovich
5829eb3cf2 update year in LICENSE, conf.py and README.md files
I found that year in files is not up-to-date
2016-03-15 16:51:34 +03:00
Tianqi Chen
9a5489ee15 Merge pull request #992 from tqchen/master
[FLINK] remove nWorker from API
2016-03-14 16:29:58 -07:00
tqchen
90f7220736 [FLINK] remove nWorker from API 2016-03-14 16:18:35 -07:00
Tianqi Chen
084ed6224d Update README.md 2016-03-14 15:21:39 -07:00
Tianqi Chen
29ad3ab2c3 Merge pull request #991 from CodingCat/master
xgboost4j intro
2016-03-14 14:07:11 -07:00
CodingCat
d1c5280f4b xgboost4j intro 2016-03-14 16:44:03 -04:00
Nan Zhu
00caf2c956 Merge pull request #988 from CodingCat/master
[jvm-packages] getter of XGBoostModel
2016-03-14 07:54:03 -04:00
CodingCat
c3e56017cc Merge branch 'master' of https://github.com/dmlc/xgboost 2016-03-14 07:27:53 -04:00
CodingCat
3a951d0ab8 getter of XGBoostModel 2016-03-14 07:26:51 -04:00
Nan Zhu
362eb4bd02 Merge pull request #983 from CodingCat/master
[jvm-packages] upgrade spark version to 1.6.1
2016-03-13 23:04:16 -04:00
Nan Zhu
e3fa7753f5 Merge branch 'master' into master 2016-03-13 22:46:38 -04:00
CodingCat
6f92f1c117 update spark version to 1.6.1 2016-03-13 22:46:06 -04:00
Tianqi Chen
e1b2ad2e5e Merge pull request #980 from tqchen/master
[METHOD], add tree method option to prefer faster algo
2016-03-13 12:25:03 -07:00
tqchen
a2714fe052 [METHOD], add tree method option to prefer faster algo 2016-03-13 12:24:47 -07:00
Tianqi Chen
4454c7b72a Update README.md 2016-03-13 12:13:41 -07:00
Tianqi Chen
5fb09dc0ab Merge pull request #979 from CodingCat/kryo
[jvm-packages] support kryo serialization
2016-03-13 11:25:01 -07:00
Tianqi Chen
05b692590d Merge pull request #978 from CodingCat/worker_num
[jvm-packages] jvm doc index
2016-03-13 11:24:33 -07:00
Nan Zhu
a382c1698a Merge branch 'master' into worker_num 2016-03-13 11:57:28 -04:00
Nan Zhu
cc1e608a3d Merge branch 'master' into kryo 2016-03-13 11:57:17 -04:00
CodingCat
f2ef958ebb support kryo serialization 2016-03-13 11:55:14 -04:00
CodingCat
9011acf52b jvm doc index 2016-03-13 09:20:51 -04:00
Nan Zhu
3ce33563f2 Merge pull request #975 from CodingCat/worker_num
force the user to set number of workers
2016-03-12 13:47:27 -05:00
CodingCat
16b9e92328 force the user to set number of workers 2016-03-12 13:33:57 -05:00
Nan Zhu
980898f3fb Merge pull request #971 from CodingCat/set_nthread
set nthread to spark.task.cpus by default
2016-03-11 20:19:56 -05:00
CodingCat
5f441a29a8 set nthread to spark.task.cpus by default 2016-03-11 20:07:09 -05:00
Tianqi Chen
cbabaeba0c Merge pull request #969 from tqchen/master
JVM API Update
2016-03-11 12:36:27 -08:00
Tianqi Chen
57987100bc Merge pull request #3 from CodingCat/fix_examples
adjust the API signature as well as the docs
2016-03-11 12:29:33 -08:00
CodingCat
a3b2e76230 update README for jvm-packages 2016-03-11 15:28:55 -05:00
CodingCat
400b1faecc adjust the API signature as well as the docs 2016-03-11 15:22:44 -05:00
CodingCat
97e4dcde98 Merge branch 'master' of https://github.com/tqchen/xgboost into fix_examples 2016-03-11 15:13:54 -05:00
tqchen
2a6ac6fd34 Update JVM Doc 2016-03-11 11:53:24 -08:00
tqchen
79f2d0cf70 Update JVM Doc 2016-03-11 11:50:21 -08:00
Tianqi Chen
2dac506773 Merge pull request #968 from CodingCat/master
XGBoost4J intro
2016-03-11 10:59:42 -08:00
Nan Zhu
61db5aa575 Merge branch 'master' into master 2016-03-11 13:58:24 -05:00
CodingCat
6b9442a7f8 XGBoost4J intro 2016-03-11 13:58:00 -05:00
CodingCat
ab68a0ccc7 fix examples 2016-03-11 13:57:03 -05:00
Nan Zhu
acdd23e789 Merge pull request #967 from CodingCat/master
[jvm-packages] change the API name
2016-03-11 10:59:16 -05:00
CodingCat
aca0096b33 more updates for Flink
more fix
2016-03-11 10:15:49 -05:00
CodingCat
43d7a85bc9 change the API name since we support not only HDFS and local file system 2016-03-11 10:05:32 -05:00
Nan Zhu
8e3ce908fe Merge pull request #965 from shaform/fs
Support the cases when user load dataset and save model to two different file systems
2016-03-11 09:25:02 -05:00
Shaform
6558ef3273 support different types of filesystems 2016-03-11 22:06:40 +08:00
Nan Zhu
00e7e4eef0 Merge pull request #964 from CodingCat/master
fix create_jni.sh
2016-03-11 09:00:20 -05:00
CodingCat
51b0e7010c fix create_jni sh 2016-03-11 08:46:44 -05:00
Tianqi Chen
39359edbd8 Merge pull request #962 from tqchen/master
Fix continue training in CLI
2016-03-10 22:11:45 -08:00
Tianqi Chen
04f7fe9c36 Merge pull request #961 from tqchen/master
Fix multi-class loading
2016-03-10 19:39:28 -08:00
tqchen
59d59a968d Fix continue training in CLI 2016-03-10 19:39:09 -08:00
tqchen
ec2fb5bc48 Fix multi-class loading 2016-03-10 19:22:26 -08:00
Tianqi Chen
d02bd41623 Merge pull request #959 from tqchen/master
Fix continue training in CLI
2016-03-10 18:12:54 -08:00
tqchen
96b17971ac Fix continue training in CLI 2016-03-10 12:43:25 -08:00
Tianqi Chen
845f80ec22 Merge pull request #958 from tqchen/master
fix link
2016-03-10 12:28:46 -08:00
tqchen
d35cab6911 fix link 2016-03-10 12:28:29 -08:00
Tianqi Chen
5b3ece2ca9 Merge pull request #957 from tqchen/master
Add Reference
2016-03-10 12:27:41 -08:00
tqchen
f3e2878784 Add Reference 2016-03-10 12:26:01 -08:00
Tianqi Chen
7b2e128c91 Merge pull request #951 from tcfuji/master
Add tpot to Tools using XGBoost
2016-03-10 07:53:29 -08:00
Tianqi Chen
d913cbbfbc Merge pull request #954 from CodingCat/worker_num
[jvm-packages] allow the user to specify the worker number and avoid unnecessary shuffle
2016-03-10 07:53:20 -08:00
CodingCat
d47df5c1d8 allow the user to specify the worker number and avoid unnecessary shuffle 2016-03-10 06:58:30 -05:00
CodingCat
e0a3f1c000 nthread no larger than spark.task.cpus 2016-03-10 05:51:07 -05:00
Ted Fujimoto
13486cf672 Add tpot to Tools using XGBoost 2016-03-09 23:27:34 -08:00
Tianqi Chen
bbe2b2f0b6 Merge pull request #949 from CodingCat/scala_examples
fix typo in README
2016-03-09 16:00:27 -08:00
Nan Zhu
e0555d2ddc Merge branch 'master' into scala_examples 2016-03-09 17:23:22 -05:00
CodingCat
4e86c8c866 fix typo in README 2016-03-09 17:22:19 -05:00
Tianqi Chen
db7a4e2ada Merge pull request #944 from CodingCat/scala_examples
Scala examples
2016-03-09 10:08:07 -08:00
CodingCat
7e30ada8c1 update README 2016-03-09 13:05:08 -05:00
Nan Zhu
b398c145a9 Merge branch 'master' into scala_examples 2016-03-09 12:57:41 -05:00
Tianqi Chen
a23e091be1 Merge pull request #946 from saiias/modify_makefile
modify Makefile
2016-03-09 09:52:22 -08:00
CodingCat
005b1276d0 remove duplicate in stream close 2016-03-09 12:33:49 -05:00
CodingCat
852c5a4b32 code formatting in XGBoostModel 2016-03-09 12:31:35 -05:00
CodingCat
c9830cd8b1 remove spark/flink examples 2016-03-09 12:31:35 -05:00
CodingCat
8cfa752fa0 add scala examples 2016-03-09 12:31:35 -05:00
Tianqi Chen
f64516c8d0 Merge pull request #942 from CodingCat/revise_java
refactor jvm API
2016-03-09 09:30:12 -08:00
saiias
357c89fa93 modify Makefile 2016-03-09 23:11:48 +09:00
CodingCat
a08cc8aad4 allow the user define how many workers they need 2016-03-08 18:46:53 -05:00
CodingCat
909c6af330 add test resources manually 2016-03-08 18:43:30 -05:00
CodingCat
fa03aaeb63 revise current API 2016-03-08 17:18:55 -05:00
Tianqi Chen
9911771b02 Merge pull request #939 from tqchen/master
update dmlc-core
2016-03-08 08:02:02 -08:00
tqchen
7aafd8f777 update dmlc-core 2016-03-08 08:01:47 -08:00
Tianqi Chen
8a12a78427 Merge pull request #936 from tqchen/master
Fix broken tracker
2016-03-07 21:00:39 -08:00
tqchen
7cbb9da0e6 Fix broken tracker 2016-03-07 21:00:20 -08:00
Tianqi Chen
6f5632dd6e Merge pull request #934 from tqchen/master
[Spark] Refactor train, predict, add save
2016-03-06 21:57:38 -08:00
tqchen
435a0425b9 [Spark] Refactor train, predict, add save 2016-03-06 21:51:08 -08:00
Tianqi Chen
3402953633 Update README.md 2016-03-06 21:15:43 -08:00
Tianqi Chen
0fd433ff0f Update README.md 2016-03-06 21:15:32 -08:00
Tianqi Chen
d4161bdeec Merge pull request #932 from tqchen/master
Add doc badge
2016-03-06 21:09:32 -08:00
tqchen
dda226ab85 Add doc badge 2016-03-06 21:09:13 -08:00
Tianqi Chen
3d8f2fb1b9 Merge pull request #931 from tqchen/master
Add JVM Package
2016-03-06 21:05:35 -08:00
tqchen
8cc8f227c3 Add JVM Package 2016-03-06 21:05:17 -08:00
Tianqi Chen
8c6cbe7608 Merge pull request #930 from tqchen/master
Fix rabit
2016-03-06 20:54:49 -08:00
tqchen
bec7332eea Fix rabit 2016-03-06 20:54:27 -08:00
Tianqi Chen
54f13ab9e7 Merge pull request #929 from tqchen/master
[DOC-JVM] Refactor JVM docs
2016-03-06 20:52:40 -08:00
tqchen
c05c5bc7bc [DOC-JVM] Refactor JVM docs 2016-03-06 20:42:01 -08:00
Tianqi Chen
79f9fceb6b Merge pull request #927 from CodingCat/spark_example
Spark example
2016-03-06 15:46:54 -08:00
CodingCat
c211a80633 log tracker exit value in logger
capture InterruptedException
2016-03-06 17:37:18 -05:00
CodingCat
718a9d8c96 use another thread to control spark job 2016-03-06 15:46:27 -05:00
CodingCat
6499422e90 fix the merge 2016-03-06 15:22:05 -05:00
CodingCat
16008ebfb8 merge with master 2016-03-06 15:16:55 -05:00
CodingCat
50337d1906 fix rabitEnv 2016-03-06 14:56:49 -05:00
Tianqi Chen
cf2a7851eb Merge pull request #926 from tqchen/master
[JVM] Refactor, add filesys API
2016-03-06 11:49:01 -08:00
CodingCat
808e30f9fc example of DistTrainWithSpark and trigger job with foreachPartition 2016-03-06 14:34:23 -05:00
tqchen
56f7a414d1 [JVM] Refactor, add filesys API 2016-03-06 11:33:48 -08:00
CodingCat
f768edfede adjust the return values of RabitTracker.waitFor(), remove typesafe.Config 2016-03-06 08:44:04 -05:00
Tianqi Chen
457ff82e33 Merge pull request #919 from Far0n/master
Complete Guide to Parameter Tuning in XGBoost
2016-03-05 20:18:48 -08:00
Tianqi Chen
300c16d0f6 Merge pull request #923 from tqchen/master
[FLINK] Make runnable flink
2016-03-05 18:04:54 -08:00
tqchen
99dc311f6d [FLINK] Make runnable flink 2016-03-05 17:59:22 -08:00
Tianqi Chen
3ddddfce79 Merge pull request #922 from CodingCat/label
spark with new labeledpoint
2016-03-05 17:04:32 -08:00
CodingCat
130ca7b00c test case for XGBoostSpark 2016-03-05 19:41:26 -05:00
CodingCat
f0647ec76d test resources 2016-03-05 18:18:07 -05:00
CodingCat
5c1af13f84 distributed in RDD 2016-03-05 17:50:40 -05:00
CodingCat
fb41e4e673 spark with new labeledpoint
fix import order
2016-03-05 17:22:34 -05:00
Tianqi Chen
74bda4bfc5 Merge pull request #921 from tqchen/master
[JVM] Add LabeledPoint read support
2016-03-05 14:18:20 -08:00
tqchen
514df14baf [JVM] Add LabeledPoint read support
fix
2016-03-05 13:36:33 -08:00
Far0n
3a34c53f57 Complete Guide to Parameter Tuning in XGBoost 2016-03-05 21:51:47 +01:00
Tianqi Chen
ae032b12b4 Merge pull request #918 from tqchen/master
Add Labeled Point, minor fix build
2016-03-05 12:21:22 -08:00
tqchen
ac8e950227 Add Labeled Point, minor fix build 2016-03-05 12:12:43 -08:00
Tianqi Chen
51d8595372 Merge pull request #911 from CodingCat/spark_xgboost
[WIP]xgboost4j-spark
2016-03-05 11:49:24 -08:00
CodingCat
bb43177eb1 merge 2016-03-05 14:40:30 -05:00
tqchen
e8560c7909 [refactor] move java package to namespace java 2016-03-05 14:04:13 -05:00
tqchen
ae969a0e69 [refactor] move java package to namespace java 2016-03-05 14:00:04 -05:00
tqchen
81dbf564a4 [Flink] Check 2016-03-05 13:57:26 -05:00
CodingCat
2cec10c46f try to get more memory from Travis 2016-03-05 08:44:56 -05:00
CodingCat
b2d705ffb0 framework of xgboost-spark
iterator

return java iterator and recover test
2016-03-05 08:44:55 -05:00
CodingCat
1540773340 sketch of xgboost-spark
chooseBestBooster shall be in Boosters

remove tracker.py

rename XGBoost

remove cross-validation
2016-03-05 08:44:55 -05:00
Tianqi Chen
4568692daf Merge pull request #913 from tqchen/master
update libsvm file to start with 1 index
2016-03-05 00:02:47 -08:00
tqchen
a894ab6898 update libsvm file to start with 1 index 2016-03-05 00:01:42 -08:00
Tianqi Chen
e23a24be8c Merge pull request #912 from tqchen/master
[JVM] Add Iterator loading API
2016-03-04 18:14:30 -08:00
tqchen
86871d4be9 [JVM] Add Iterator loading API 2016-03-04 17:37:46 -08:00
Tianqi Chen
770b3451ca Merge pull request #907 from tqchen/master
[DIST] Enable multiple thread  make rabit and xgboost threadsafe
2016-03-04 08:24:00 -08:00
Tianqi Chen
04bdbca63f Merge pull request #2 from CodingCat/tianqi
revise the RabitTracker Impl & delete FileUtil class
2016-03-04 08:02:58 -08:00
CodingCat
416e1434e7 change initTracker() to static 2016-03-04 10:55:02 -05:00
CodingCat
10a1517502 revise the RabitTracker Impl
delete FileUtil class

fix bugs
2016-03-04 10:08:37 -05:00
tqchen
0df2ed80c8 [JVM] Make JVM Serializable 2016-03-03 21:04:02 -08:00
tqchen
e80d3db64b [DIST] Enable multiple thread and tracker, make rabit and xgboost more thread-safe by using thread local variables. 2016-03-03 20:36:14 -08:00
Tianqi Chen
12dc92f7e0 Merge pull request #906 from CodingCat/style
apply google-java-style indentation and impose import orders
2016-03-03 14:39:05 -08:00
CodingCat
e3dc67c6a0 apply google-java-style indentation and impose import orders.... 2016-03-03 12:59:18 -05:00
Tianqi Chen
0f367a6ade Merge pull request #904 from tqchen/master
[JVM-PKG] Update JNI to include Rabit interface
2016-03-02 22:44:46 -08:00
tqchen
c428a93adc [JVM-PKG] add distributed test simple case 2016-03-02 22:27:55 -08:00
tqchen
5c9e50148a [JVM-PKG] Update JNI to include rabit codes 2016-03-02 22:12:17 -08:00
tqchen
ced6d45e01 Update rabit 2016-03-02 20:53:34 -08:00
Tianqi Chen
0515e4ec28 Merge pull request #903 from CodingCat/jvm_package
add test cases for Scala API
2016-03-02 16:28:36 -08:00
CodingCat
8c220f51fc add default values for Scala API 2016-03-02 17:21:42 -05:00
CodingCat
cbf5eba9c0 add maven-assembly plugins 2016-03-02 17:11:15 -05:00
Nan Zhu
8e0c3b08c7 Merge branch 'master' into jvm_package 2016-03-02 15:26:39 -05:00
CodingCat
5e309f1ce8 add test cases for Scala API 2016-03-02 15:24:13 -05:00
Tianqi Chen
7d9457d72f Merge pull request #890 from CodingCat/jvm_package
[WIP] refactor xgboost4j to create jvm-packages
2016-03-01 21:01:01 -08:00
CodingCat
f8fff6c6fc rename files/packages 2016-03-01 23:48:35 -05:00
CodingCat
55e36893cd add style check for java and scala code 2016-03-01 20:53:50 -05:00
CodingCat
3b246c2420 re-structure Java API, add Scala API and consolidate the names of Java/Scala API 2016-03-01 20:53:41 -05:00
Tianqi Chen
fc4c88fceb Merge pull request #897 from tqchen/master
[PYTHON-DIST] Distributed xgboost python training API.
2016-02-29 17:11:00 -08:00
Tianqi Chen
ec9df13c70 Merge pull request #898 from maximsch2/patch-1
Describe colsample_bylevel
2016-02-29 17:01:59 -08:00
Maxim Grechkin
ba805d0fca Describe colsample_bylevel 2016-02-29 16:59:58 -08:00
tqchen
ecb3a271be [PYTHON-DIST] Distributed xgboost python training API. 2016-02-29 16:54:13 -08:00
Yuan (Terry) Tang
51bb556898 Merge pull request #895 from terrytangyuan/sklearn
Fixed #858: Separate dependencies and lightweight test env for Python
2016-02-29 11:26:11 -06:00
terrytangyuan
ae3962f757 Exclude osx for lightweight python test 2016-02-29 11:01:28 -06:00
Yuan (Terry) Tang
fdd520d774 Merge branch 'master' into sklearn 2016-02-29 10:50:55 -06:00
Tianqi Chen
728b65cec0 Merge pull request #880 from pauloalves86/master
Improve compatibility with sklearn
2016-02-29 08:37:53 -08:00
Paulo Alves
3d56caaab5 dmlc-core updated 2016-02-29 09:32:50 -03:00
Paulo Alves
b7985466a4 Merge remote-tracking branch 'upstream/master' 2016-02-29 08:53:48 -03:00
terrytangyuan
803a6fe474 Separate dependencies and lightweight test env for Python 2016-02-28 20:11:10 -06:00
Tianqi Chen
5f70b4df7a Merge pull request #891 from tqchen/master
[PYTHON] Simplify training logic, update rabit lib
2016-02-28 14:10:21 -08:00
tqchen
4a16b729fc [PYTHON] Simplify training logic, update rabit lib 2016-02-28 13:20:55 -08:00
Tianqi Chen
a868d803d0 Merge pull request #886 from zhengruifeng/mlog
add url for mlogloss
2016-02-28 09:27:26 -08:00
Ruifeng Zheng
07ed143cd6 Merge branch 'master' into mlog 2016-02-28 10:43:41 +08:00
Zheng RuiFeng
c7dc0cb50e update dmlc-core 2016-02-28 10:34:45 +08:00
Tianqi Chen
19f5f027a6 Merge pull request #889 from tqchen/master
[TEST] Fix travis test when reading hdfs
2016-02-27 18:15:52 -08:00
tqchen
90bc7f8f6b [TEST] Fix travis test when reading hdfs 2016-02-27 18:15:32 -08:00
Tianqi Chen
38ba66a5bd Merge pull request #887 from vatsan/patch-1
Plugging in gp_xgboost_gridsearch
2016-02-26 21:08:24 -08:00
Srivatsan Ramanujam
44d5ac7d37 Plugging in gp_xgboost_gridsearch 2016-02-26 19:15:32 -08:00
Tianqi Chen
758a77de9c Fix testcase after update and allow hdfs load 2016-02-26 17:04:51 -08:00
Tianqi Chen
be810e4f16 Merge pull request #885 from ChrisBarker-NOAA/patch-1
fix PyPi Description issue
2016-02-26 16:54:55 -08:00
Chris Barker
ed5781fa55 fix PyPi Description issue
the description field was set to what should be the long_description field -- making a bit of a mess on PyPi
2016-02-26 16:54:13 -08:00
Zheng RuiFeng
edf68b5933 add url for mlogloss 2016-02-26 20:46:40 +08:00
Paulo Alves
592004b38f XGBClassifier.feature_importances_ compatible with sklearn RFECV 2016-02-26 08:56:07 -03:00
Paulo Alves
81257dcfb4 Update upstream 2016-02-26 08:52:57 -03:00
Tianqi Chen
84e9ca000e Update README.md 2016-02-25 22:01:46 -08:00
Tianqi Chen
c15b7aa9cc Update index.md 2016-02-25 22:01:23 -08:00
Tianqi Chen
c50df8f3b5 Merge pull request #878 from tqchen/master
temp compatibility with sklearn
2016-02-25 21:57:45 -08:00
tqchen
ebc802756f temp compatibility with sklearn 2016-02-25 21:57:00 -08:00
Tianqi Chen
7b9cee3cbd Merge pull request #877 from tqchen/master
[DIST] Add Distributed XGBoost on AWS Tutorial
2016-02-25 21:52:13 -08:00
tqchen
a71ba04109 [DIST] Add Distributed XGBoost on AWS Tutorial 2016-02-25 21:51:37 -08:00
Tianqi Chen
61d9edcaa4 Merge pull request #867 from wyj2046/master
cause this code test pickle the booster, so change bst2 -> bst3
2016-02-25 20:25:47 -08:00
Tianqi Chen
1e435ee3ec Update README.md 2016-02-25 17:18:07 -08:00
Tianqi Chen
eae0aa256e Update README.md 2016-02-25 17:17:28 -08:00
Tianqi Chen
1176f9ac1b Merge pull request #876 from tqchen/master
[DOC] reorg docs
2016-02-25 14:08:48 -08:00
tqchen
6b02317ea8 [DOC] reorg docs 2016-02-25 14:08:30 -08:00
Tianqi Chen
76c320e9f0 Merge pull request #875 from tqchen/master
Fix model save problem in YARN
2016-02-25 13:15:52 -08:00
tqchen
02e98e5d45 [CLI] Fix model save problem 2016-02-25 13:15:23 -08:00
tqchen
d66c17881e Update readme 2016-02-25 13:11:51 -08:00
Tianqi Chen
17b5ca7351 Merge pull request #872 from tqchen/master
[TRAVIS] Fix script
2016-02-25 12:39:49 -08:00
tqchen
b69219df05 [doc] update news 2016-02-25 12:38:47 -08:00
tqchen
80239aaf00 [TRAVIS] Fix script 2016-02-25 12:17:40 -08:00
Tianqi Chen
bb0d163d22 Merge pull request #860 from zhengruifeng/mae
Add "mean absolute error" to metrics
2016-02-25 12:17:03 -08:00
Tianqi Chen
4c40fdb73a Merge pull request #864 from phunterlau/master
Awesome-XGBoost page
2016-02-25 12:15:15 -08:00
phunterlau
80595d6cc5 move TOC under title 2016-02-25 11:32:11 -08:00
Yuan (Terry) Tang
319091b3f4 Merge pull request #868 from catena/master
minor fix: in sklearn.py return attribute best_ntree_limit if early stopped
2016-02-25 07:26:43 -06:00
catena
790dc877c3 return best_ntree_limit if early stopped 2016-02-25 13:42:19 +05:30
王煜杰
d52d0ee9ed cause this code test pickle the booster, so change bst2 -> bst3 2016-02-25 14:49:33 +08:00
phunterlau
ef7d26eb07 add TOC, simplied text in the solution section 2016-02-24 21:56:51 -08:00
phunterlau
d9614dfbe8 Awesome-XGBoost, first commit 2016-02-24 17:36:20 -08:00
Tianqi Chen
cdbafafc04 Merge pull request #848 from Kontinuation/master
Minor fix on installation guide and (the probably deprecated) build script
2016-02-24 16:33:32 -08:00
Kontinuation
54a9f30e92 Minor fix on installation guide and (the probably deprecated) build script 2016-02-24 12:46:37 +08:00
Ruifeng Zheng
10af94c77e Merge branch 'master' into mae 2016-02-24 11:28:55 +08:00
Zheng RuiFeng
2c7c27e297 create mae 2016-02-24 11:15:31 +08:00
Tianqi Chen
b3a81a216d Merge pull request #859 from thirdwing/master
[Doc] documents update. close #821
2016-02-23 18:39:36 -08:00
Qiang Kou
1cc0a44264 [Doc] documents update:
(1) install_github is not support due to the usage of submodule

(2) remove part of the markdown which is not displayed correctly, see
https://xgboost.readthedocs.org/en/latest/R-package/discoverYourData.html
2016-02-23 14:49:12 -05:00
Tianqi Chen
d063eaccb1 Delete training.py 2016-02-23 08:48:50 -08:00
Tianqi Chen
49f6b384e3 Merge pull request #849 from ivallesp/master
Request for solving the problem in the tests of my contribution
2016-02-20 19:29:04 -08:00
ivallesp
c17d0ef560 changed the param show_progress by verbose_eval in cv and aggcv functions 2016-02-21 01:28:55 +01:00
Tianqi Chen
532615a32a Merge pull request #827 from ivallesp/master
Muting the remaining messages when show_progress=False
2016-02-19 08:16:25 -08:00
ivallesp
ed5c98f0ee re-using the verbose-eval parameter in the cv and aggcv methods and tests adapted 2016-02-19 17:14:57 +01:00
Yuan (Terry) Tang
c7f2f3f5b7 Merge pull request #845 from thirdwing/master
[Documents] update windows instructions
2016-02-18 18:48:37 -06:00
Qiang Kou
41052f0d6e update windows instructions 2016-02-18 16:36:04 -08:00
Yuan (Terry) Tang
75d23c8bb2 Merge pull request #833 from AlexisMignon/master
Added the possibility to use custom objective function in the sklearn…
2016-02-18 09:36:38 -06:00
Alexis Mignon
a46706c82e Merge branch 'master' into master 2016-02-17 09:35:30 +01:00
Tianqi Chen
2baea12d97 Merge pull request #818 from webgeist/master
Add feature_importances_ property for XGBClassifier
2016-02-16 10:19:04 -08:00
Yuan (Terry) Tang
ba4ec551ed Merge pull request #836 from hetong007/master
fix cran, update R-package version to 0.4-3
2016-02-16 09:28:31 -06:00
hetong007
371ff20a3b fix cran, update version to 0.4-3 2016-02-16 20:37:26 +08:00
Alexis Mignon
52e9085579 Merge branch 'master' of github.com:AlexisMignon/xgboost 2016-02-16 11:00:57 +01:00
Alexis Mignon
6e27d7539f - Added test cases for the use of custom objective functions
- Made the indentation more consistent with pep8
2016-02-16 10:59:25 +01:00
Alexis Mignon
07bd149b68 Created decorator function so that custom objective function passed to the constructor are more consistent with the sklearn conventions. Added comments in the doc string 2016-02-16 10:58:22 +01:00
Alexis Mignon
5c29eeac18 Merge branch 'master' into master 2016-02-16 10:16:58 +01:00
Yuan (Terry) Tang
29c7cfcbbf Merge pull request #823 from Far0n/py_cv
stratified cv for python wrapper
2016-02-15 13:22:55 -06:00
Alexis Mignon
c8714f587a Added the possibility to use custom objective function in the sklearn API 2016-02-15 17:13:13 +01:00
Faron
4b3a053913 stratified cv for python wrapper
finalize docstring
2016-02-15 16:06:17 +01:00
Yuan (Terry) Tang
9b2b81e6a4 Merge pull request #830 from fsimond/patch-1
Fix CV which was monitoring train-metric
2016-02-15 06:09:39 -06:00
Florian
2443cb9ca8 Fix CV which was monitoring train-metric
https://github.com/dmlc/xgboost/issues/807
2016-02-15 12:00:35 +01:00
Tianqi Chen
70d9732765 Merge pull request #816 from tqchen/master
[DISK] Major improvements in external memory, add support to group back
2016-02-10 15:31:20 -08:00
tqchen
413f119c7e Update dmlc-core 2016-02-10 13:11:21 -08:00
Pavel Gladkov
31c0408cb4 add feature_importances_ property for XGBClassifier 2016-02-10 23:01:33 +03:00
tqchen
63c4ad7617 [APPROX] Make global proposal default, add group ptr solution 2016-02-10 11:19:10 -08:00
tqchen
ce4d59ed69 [TREE] Enable global proposal for faster speed 2016-02-10 11:19:10 -08:00
tqchen
2f2080a337 [TREE] Remove gap constraint, make tree construction more robust 2016-02-10 11:17:54 -08:00
Ubuntu
c36195795a increase shard 2016-02-10 11:17:18 -08:00
Ubuntu
724eda2435 remove reserve for more aggressive memory generation 2016-02-10 11:17:18 -08:00
Ubuntu
46be6181b5 [DIST] fix distirbuted setting 2016-02-10 11:17:18 -08:00
tqchen
5218438716 [DMLC] update dmlccore 2016-02-10 11:17:18 -08:00
tqchen
b27b51f60e [PLUGIN] Add densify parser 2016-02-10 11:17:18 -08:00
tqchen
88e362732f [DMLC] Update dmlc 2016-02-10 11:17:17 -08:00
tqchen
a500fbc9b0 [TREE] switch to two pass 2016-02-10 11:17:17 -08:00
tqchen
523afcbcd2 [TREE] Cleanup some functions, add utility function for two pass 2016-02-10 11:17:17 -08:00
tqchen
52227a8920 [TREE] Refactor histmaker 2016-02-10 11:17:17 -08:00
tqchen
468bc7725a [METRIC] change metric accumulator to double 2016-02-10 11:17:17 -08:00
tqchen
88447ca32e [MEM] Add rowset struct to save memory with billion level rows 2016-02-10 11:17:17 -08:00
tqchen
2230f1273f [DISK] Add shard option to disk 2016-02-10 11:17:17 -08:00
Tianqi Chen
72961d914b Merge pull request #812 from samuel-liyi/master
fsplit value
2016-02-08 09:16:40 -08:00
Yuan (Terry) Tang
5345990dae Merge pull request #813 from angadgill/patch-2
Update build.md
2016-02-08 08:18:52 -06:00
Angad Gill
c9e09c9875 Update build.md
Minor typo
2016-02-08 01:20:43 -08:00
samuel-liyi
d3540aacc5 change the formula of fsplit value 2016-02-08 15:00:04 +08:00
Tianqi Chen
eb169e4f73 Merge pull request #788 from maximsch2/fix-missing
Make missing handling consistent with sklearn's portion of the Python package
2016-01-28 21:14:31 -08:00
Maxim Grechkin
f5e96eba72 Make missing handling consistent with sklearn's portion of the python package 2016-01-28 14:16:11 -08:00
Yuan (Terry) Tang
21d5ec7275 Merge pull request #778 from dmlc/terrytangyuan-patch-1
Update installation instructions for R package
2016-01-24 23:44:43 -06:00
Yuan (Terry) Tang
be58d6f9d6 Update installation instructions for R package 2016-01-24 19:38:36 -06:00
Yuan (Terry) Tang
5d9b80cd8b Merge pull request #774 from thirdwing/master
[R] update doc (close #760, close #773)
2016-01-24 12:19:07 -05:00
Qiang Kou
bdeb095a7d [R] update doc; add drat repo 2016-01-24 11:42:24 -05:00
Tianqi Chen
1ab0c3c248 Merge pull request #768 from moutai/patch-1
[docs] Fix typo in release notes
2016-01-21 09:55:42 -08:00
Moussa Taifi
51f0e469cb [docs] Fix typo in release notes
small typo fix
thanks
2016-01-21 10:22:11 -05:00
Yuan (Terry) Tang
015c3e0b45 Merge pull request #767 from jenshaase/patch-1
Python Package Installation Documentation Bug
2016-01-21 09:13:21 -06:00
Jens Haase
3077571976 Python Package Installation Documentation Bug 2016-01-21 15:53:18 +01:00
Tianqi Chen
52c8d09ba8 Update build.md 2016-01-20 11:40:29 -08:00
Tianqi Chen
e5b1bd39a0 Merge pull request #761 from aayush26/patch-1
line 100: path changed updated
2016-01-20 10:01:42 -08:00
Tianqi Chen
6f5b68095b Merge pull request #763 from bzEq/issue751
fix signature of __deepcopy__ method
2016-01-20 10:01:32 -08:00
Kai Luo
d9e50fd7f3 __copy__ calls __deepcopy__ with an argument 2016-01-20 19:57:20 +08:00
Kai Luo
5cd765e935 fix signature of __deepcopy__ method 2016-01-20 17:18:11 +08:00
Aayush Kumar Singha
5af97e5e47 line 100: path changed updated 2016-01-20 07:17:02 +05:30
Tianqi Chen
ef4dcce737 Merge pull request #759 from dmlc/brick
Merge Brick into master
2016-01-19 09:24:58 -08:00
Tianqi Chen
fb0ced2639 Merge pull request #755 from tqchen/brick
Brick
2016-01-16 11:52:59 -08:00
tqchen
8e7f2679d5 [DOC] Update R doc 2016-01-16 11:52:33 -08:00
tqchen
e7d8ed71d6 [DOC] cleanup distributed training 2016-01-16 11:00:40 -08:00
tqchen
df7c7930d0 [WINDOWS] Remove windows 2016-01-16 10:30:07 -08:00
tqchen
219e58d453 Minor wordings to doc 2016-01-16 10:25:12 -08:00
tqchen
1495a43cea [R] make all customizations to meet strict standard of cran 2016-01-16 10:25:12 -08:00
tqchen
634db18a0f [TRAVIS] cleanup travis script 2016-01-16 10:25:12 -08:00
tqchen
fd173e260f [FIX] change evaluation to more precision 2016-01-16 10:25:12 -08:00
tqchen
67fbf8d264 [TEST] add partial load option 2016-01-16 10:25:12 -08:00
tqchen
6de1c86d18 [LZ4] enable 16 bit index 2016-01-16 10:25:11 -08:00
tqchen
c4d389c5df [LZ] Improve lz4 format 2016-01-16 10:25:11 -08:00
tqchen
31d8e93ef3 [FIX] fix plugin system 2016-01-16 10:25:11 -08:00
tqchen
96f4542a67 [PLUGIN] Add plugin system 2016-01-16 10:25:11 -08:00
tqchen
36c389ac46 [DATA] Isolate the format of page file 2016-01-16 10:25:11 -08:00
黄子轩
a662340fda modify java wrapper settings for new refactor 2016-01-16 10:25:11 -08:00
tqchen
263b7befde [LOG] Simplfy README.md add change logs. 2016-01-16 10:25:11 -08:00
tqchen
2dc6c2dc52 [R] enable R compile
[R] Enable R build for windows and linux
2016-01-16 10:24:02 -08:00
tqchen
72347e2d45 [DATA] Make it fully compatible with rank 2016-01-16 10:24:01 -08:00
tqchen
ef1021e759 [IO] Enable external memory 2016-01-16 10:24:01 -08:00
tqchen
5f28617d7d [REFACTOR] completely remove old src 2016-01-16 10:24:01 -08:00
tqchen
d75e3ed05d [LIBXGBOOST] pass demo running. 2016-01-16 10:24:01 -08:00
tqchen
cee148ed64 [CLI] initial refactor of CLI 2016-01-16 10:24:01 -08:00
tqchen
0d95e863c9 [LEARNER] refactor learner 2016-01-16 10:24:01 -08:00
tqchen
4b4b36d047 [GBM] remove need to explicit InitModel, rename save/load 2016-01-16 10:24:01 -08:00
tqchen
82ceb4de0a [LEARNER] Init learner interface 2016-01-16 10:24:01 -08:00
tqchen
084f5f4715 [Make] refactor build script to use config file 2016-01-16 10:24:01 -08:00
tqchen
7e6f00ee11 [MAKE] fix makefile 2016-01-16 10:24:01 -08:00
tqchen
9042b9e2c7 [GBM] Finish migrate all gbms 2016-01-16 10:24:01 -08:00
tqchen
e4567bbc47 [REFACTOR] Add alias, allow missing variables, init gbm interface 2016-01-16 10:24:01 -08:00
tqchen
4f26d98150 [Update] remove rabit subtree, use submodule, move code 2016-01-16 10:24:01 -08:00
tqchen
d4677b6561 [TREE] finish move of updater 2016-01-16 10:24:01 -08:00
tqchen
4adc4cf0b9 [TREE] Move the files to target refactor location 2016-01-16 10:24:01 -08:00
tqchen
3128e1705b [TREE] Refactor colmaker 2016-01-16 10:24:01 -08:00
tqchen
20043f63a6 [TREE] Move colmaker 2016-01-16 10:24:01 -08:00
tqchen
c8ccb61b9e [TREE] Enable updater registry 2016-01-16 10:24:01 -08:00
tqchen
a62a66d545 [TREE] Finalize regression tree refactor 2016-01-16 10:24:01 -08:00
tqchen
844e8a153d [TREE] Refactor to new logging 2016-01-16 10:24:01 -08:00
tqchen
05115adbff [TREE] move tree model 2016-01-16 10:24:01 -08:00
tqchen
b4d0bb5a6d [METRIC] all metric move finished 2016-01-16 10:24:01 -08:00
tqchen
dedd87662b [OBJ] Add basic objective function and registry 2016-01-16 10:24:01 -08:00
tqchen
46bcba7173 [DATA] basic data refactor done, basic version of csr source. 2016-01-16 10:24:00 -08:00
tqchen
3d708e4788 latest data 2016-01-16 10:24:00 -08:00
tqchen
7ff91fe5f9 Data interface ready 2016-01-16 10:24:00 -08:00
tqchen
d530e0c14f [REFACTOR] cleanup structure 2016-01-16 10:24:00 -08:00
tqchen
5ed4dc4f60 fix makefile warning when cc is defined 2016-01-16 10:24:00 -08:00
Tianqi Chen
0dc68b1aef Update CHANGES.md 2016-01-14 15:58:02 -08:00
Yuan (Terry) Tang
98d8a8b871 Added contributor 2016-01-12 09:25:32 -06:00
Yuan (Terry) Tang
50af394272 Merge pull request #733 from damiencarol/javadocfix
[Java] Fix broken javadoc generation
2016-01-12 09:03:50 -06:00
damiencarol
375c106fcc Fix native/Native consistency in comments 2016-01-12 14:46:34 +01:00
Yuan (Terry) Tang
d1439a10a8 Update CONTRIBUTORS.md 2016-01-10 12:16:02 -06:00
Yuan (Terry) Tang
c44eb3ab91 Merge pull request #730 from ganesh-krishnan/master
Fixed off by 1 bug in early.stop.rounds in xgb.cv
2016-01-10 13:14:50 -05:00
damiencarol
fd3baf68f1 Fix warnings when generating javadoc 2016-01-09 15:53:35 +01:00
damiencarol
89216e239f Fix errors when generating javadoc 2016-01-09 15:45:13 +01:00
Ganesh
6ba53329e5 Fixed off by 1 bug in xgb.cv 2016-01-07 22:20:21 -08:00
Yuan (Terry) Tang
0958fb35ae Merge pull request #728 from yenchenlin1994/fix-doc-typo
Remove redundant word
2016-01-07 08:25:31 -06:00
YenChenLin
5a91ded214 Remove redundant word 2016-01-07 22:19:15 +08:00
Yuan (Terry) Tang
7606bf8156 Fixes #725 2016-01-06 18:21:29 -06:00
Yuan (Terry) Tang
1bd0f9eecd Merge pull request #724 from hxd1011/patch-1
Fix typo
2016-01-05 13:11:25 -06:00
hxd1011
8e9b7e2c67 Fix typo
"Until Know" to "Until Now"
2016-01-05 14:07:00 -05:00
Yuan (Terry) Tang
063bebe7d3 Merge pull request #722 from yenchenlin1994/fix-demo-regression-typo
Fix typo in demo/regression/README.md
2016-01-05 09:56:18 -06:00
YenChenLin
7ff704a13f Fix typo in demo/regression/README.md 2016-01-05 23:42:02 +08:00
Yuan (Terry) Tang
b684b5fada Merge pull request #720 from derek-damron/master
Add newline chars to early.stop.round message
2016-01-04 23:51:40 -06:00
Derek Damron
8756d5b160 Add newline char to early.stop.round message 2016-01-04 20:36:32 -08:00
Derek Damron
cd0099f2a1 Add newline char to early.stop.round message 2016-01-04 20:35:57 -08:00
Yuan (Terry) Tang
fa205cdaf8 Merge pull request #718 from kilojoules/patch-2
fix minor typo
2016-01-01 22:07:35 -06:00
Julian Quick
f51e1893fe fix minor typo 2016-01-01 20:03:45 -08:00
Tianqi Chen
da98e84b19 Merge pull request #714 from maarten-keijzer/doc_fix
Updated the documentation for 'gradient' and 'Hessian' (subscript error)
2015-12-30 11:55:14 +08:00
Maarten Keijzer
a6c35a8d74 Updated the documentation for 'gradient' and 'Hessian' (subscript error) 2015-12-29 15:28:43 +01:00
Yuan (Terry) Tang
d747649892 Merge pull request #712 from Far0n/py_cv
python cv bugfixing (eval metrics)
2015-12-29 07:30:26 -06:00
Yuan (Terry) Tang
ee8f189bba Merge pull request #713 from yanqingmen/java_wrapper
java wrapper modification
2015-12-29 07:18:19 -06:00
FrozenFingerz
177259a0a7 unittest for cv bugfixes added 2015-12-29 14:13:40 +01:00
yanqingmen
173ef11681 small change 2015-12-29 20:53:56 +08:00
yanqingmen
47d6d09081 add osx build instruction 2015-12-29 20:47:47 +08:00
yanqingmen
48c461ea85 change java_wrapper vs project name and script create_wrap 2015-12-29 19:50:40 +08:00
FrozenFingerz
2a46918c66 python cv bugfixing
- fixed bug if both eval_metrics xgb-param and
metrics param of cv function have been set
- cv early stopping output looks now like the one of xgb.train
2015-12-29 12:24:38 +01:00
黄子轩
2db1673585 Merge branch 'dmlc-master' into java_wrapper 2015-12-29 01:35:51 -08:00
黄子轩
4a301240bd merge from dmlc/xgboost 2015-12-29 01:34:06 -08:00
黄子轩
91fedd85b0 modify jni code 2015-12-29 01:08:19 -08:00
Tianqi Chen
4f43f1d0ac Merge pull request #711 from yoavz/tree_boosting_doc_fix
minor latex typo fix in "Introduction to Boosted Tree's" documentation
2015-12-29 08:15:32 +08:00
Yoav Zimmerman
d0ecb0cbc7 minor latex typo fix in Introduction to Boosted Tree's documentation 2015-12-28 15:42:43 -08:00
Yuan (Terry) Tang
fcb7eaa555 Merge pull request #710 from Far0n/py_cv
python cv: fixed devision by zero exception
2015-12-27 09:40:09 -06:00
FrozenFingerz
38b773d80b cv: fixed devision by zero exception
- show_progress=False or show_progress=0 led to devision by zero exception
2015-12-27 13:54:52 +01:00
Tianqi Chen
9f62553f23 Merge pull request #705 from elviswind/master
fix windows compile problem
2015-12-23 20:54:32 +08:00
junnan.wang@ef.com
dba782e985 fix windows compile problem 2015-12-23 14:33:00 +08:00
yanqingmen
4a456b2a75 small change for jni wrapper 2015-12-20 22:13:53 +08:00
huangzixuan
7d23ea7e9e add settings for OS X 2015-12-20 20:47:30 +08:00
Yuan (Terry) Tang
b942005931 Merge pull request #696 from Far0n/tc_fix
fixed wrong iter when using training continuation
2015-12-19 11:45:15 -05:00
yanqingmen
1456585249 refactor jni code and rename libxgboostjavawrapper.so to libxgboost4j.so 2015-12-19 22:26:40 +08:00
Faron
b3f3e7d0cb fixed wrong iter when using training continuation 2015-12-19 10:35:16 +01:00
Tianqi Chen
77434964ab Merge pull request #694 from khotilov/warnings_fixes
small fixes for make and gcc warnings
2015-12-19 06:50:40 +08:00
Vadim Khotilovich
f18852376f hopefully, this would make travis happy 2015-12-18 15:49:15 -06:00
Vadim Khotilovich
0c38a916fe make some gcc versions happy by using the fwrite return value 2015-12-18 15:03:39 -06:00
Vadim Khotilovich
f97c4ccb60 make gcc5 check silent when there's no gcc5 2015-12-18 14:34:16 -06:00
Vadim Khotilovich
d867579a69 make it possible to run create_wrap.sh not only from its directory 2015-12-18 14:18:28 -06:00
yanqingmen
f378fac6a1 Merge pull request #6 from dmlc/master
update
2015-12-18 14:24:08 +08:00
Yuan (Terry) Tang
4a15939c13 Merge pull request #690 from rcarneva/master
modifying cv show_progress to allow print-every-n behavior
2015-12-16 17:29:21 -06:00
Randy Carnevale
380e54a753 docstring typo 2015-12-16 17:25:55 -05:00
Randy Carnevale
0825ab36f0 updating docs for cv 2015-12-16 17:21:23 -05:00
Yuan (Terry) Tang
cfbf3595c7 Update CHANGES.md 2015-12-16 15:57:07 -06:00
Yuan (Terry) Tang
39751f8786 Merge pull request #668 from DexGroves/add-metadata
Expose model parameters to R
2015-12-16 15:55:54 -06:00
Randy Carnevale
a3fe14d6c6 modifying cv show_progress to allow print-every-n behavior 2015-12-16 16:33:01 -05:00
Groves
cd57ea2784 Add test that model paramaters are accessible within R 2015-12-16 10:24:16 -06:00
Tianqi Chen
0b17caaa27 Merge pull request #688 from khotilov/cpp_spell_doc_fixes
Spelling, wording, and doc fixes in c++ code
2015-12-12 23:22:14 -05:00
Vadim Khotilovich
b47725a65b add Eclipse stuff to .gitignore 2015-12-12 21:45:41 -06:00
Vadim Khotilovich
c70022e6c4 spelling, wording, and doc fixes in c++ code
I was reading through the code and fixing some things in the comments.
Only a few trivial actual code changes were made to make things more
readable.
2015-12-12 21:40:12 -06:00
Yuan (Terry) Tang
c56c1b9482 Merge pull request #685 from ajkl/patch-16
adding right path to setup.py
2015-12-12 20:02:42 -05:00
Ajinkya Kale
0772b51c2c minor change dir 2015-12-12 16:34:07 -08:00
Ajinkya Kale
4695fa3c2a adding right path to setup.py 2015-12-12 15:08:59 -08:00
Yuan (Terry) Tang
7a74c9523a Merge pull request #683 from terrytangyuan/pylint
Pylint Fixes
2015-12-11 19:04:38 -06:00
terrytangyuan
0eb6240fd0 Fixed all lint errors 2015-12-11 18:46:15 -06:00
terrytangyuan
a7e79e089b fix lint errors in core 2015-12-11 18:37:13 -06:00
terrytangyuan
7be496a051 ignore nested blocks 2015-12-11 18:20:35 -06:00
terrytangyuan
5f2b2a6417 Re-enable py lint test 2015-12-11 18:13:14 -06:00
terrytangyuan
c3ec8ee76f Added pylintrc file 2015-12-11 18:10:15 -06:00
Michaël Benesty
5a49eb06ca Merge pull request #682 from pommedeterresautee/master
Wording #Rstat
2015-12-10 18:54:52 +01:00
Michaël Benesty
1b07f86eb8 wording fix 2015-12-10 11:33:40 +01:00
Michaël Benesty
b2e68b8dc7 New documentation rewording 2015-12-09 18:26:56 +01:00
Michaël Benesty
2d2f92631c Merge pull request #679 from pommedeterresautee/master
Wording of R doc in new functions
2015-12-08 21:45:17 +01:00
Michaël Benesty
f761432c11 Merge remote-tracking branch 'refs/remotes/dmlc/master' 2015-12-08 18:19:25 +01:00
Michaël Benesty
fbf2707561 Wording improvement 2015-12-08 18:18:51 +01:00
Yuan (Terry) Tang
a06410055c Merge pull request #678 from phunterlau/master
update pip building, troubleshooting , and potential sklearn import error
2015-12-08 06:06:05 -06:00
pommedeterresautee
ccd4b4be00 Merge branch 'master' of https://github.com/dmlc/xgboost 2015-12-08 11:22:23 +01:00
pommedeterresautee
855be97011 model dt tree function documentation improvement 2015-12-08 11:21:25 +01:00
phunterlau
a4840b0268 update pip building, troubleshooting with new makefile, plus friendly error message when fail importing sklearn 2015-12-07 22:29:46 -08:00
Michaël Benesty
f3c5d9c1b6 Merge pull request #675 from pommedeterresautee/master
Generate new features based on tree leafs
2015-12-07 12:30:22 +01:00
Michaël Benesty
c1b2d9cb86 Generate new features based on tree leafs 2015-12-07 11:30:19 +01:00
Michaël Benesty
115c63bcde Merge remote-tracking branch 'refs/remotes/dmlc/master' 2015-12-07 11:04:46 +01:00
Yuan (Terry) Tang
162e91c5ca change .md to .rst 2015-12-06 20:25:53 -06:00
Michaël Benesty
14040123e8 Merge pull request #672 from derek-damron/patch-1
Update index.md
2015-12-07 00:08:26 +01:00
Derek Damron
ea883b30a5 Update index.md
Fixing a couple of spelling and grammatical errors.
2015-12-06 14:38:59 -08:00
Yuan (Terry) Tang
e25b2c4968 Remove redundant README 2015-12-06 11:05:44 -05:00
Michaël Benesty
3b67028ad6 remove intersect column in sparse Matrix 2015-12-05 19:02:05 +01:00
Michaël Benesty
4f4a5409d7 Merge remote-tracking branch 'refs/remotes/dmlc/master' 2015-12-05 18:30:09 +01:00
Yuan (Terry) Tang
88112f3d74 Added Apache License badge 2015-12-05 00:54:32 -05:00
Michaël Benesty
375192efa1 Merge pull request #670 from pommedeterresautee/master
Add code im demo to use the pred leaf in R
2015-12-04 16:35:43 +01:00
Michaël Benesty
2936378b76 Merge pull request #669 from dmoliveira/patch-1
Update README.md
2015-12-04 16:35:33 +01:00
pommedeterresautee
39fa45debe Add code to demo of leaf (show imprmt in accuracy) 2015-12-04 15:16:58 +01:00
Diego Marinho de Oliveira
2557d81b3b Update README.md
Link for line 26 was wrong, it pointed out again for the last demo. I was reading the readme and found the subtle inconsistence. Please, accept this minor change. It works correctly now.
2015-12-04 00:50:51 -02:00
Groves
91429bd63d Expose model parameters to R 2015-12-03 06:40:11 -06:00
pommedeterresautee
ff95d6d0ab Merge remote-tracking branch 'refs/remotes/dmlc/master' 2015-12-02 19:12:33 +01:00
Michaël Benesty
5473994a42 Merge pull request #667 from pommedeterresautee/master
change account information (pommedeterresautee)
2015-12-02 18:59:38 +01:00
Michaël Benesty
3c260c545d Merge pull request #666 from pommedeterresautee/master
Code cleaning + doc improvement #Rstat
2015-12-02 16:11:17 +01:00
pommedeterresautee
edca27fa32 Small rewording function xgb.importance 2015-12-02 15:48:22 +01:00
pommedeterresautee
db922e8c88 Small rewording function xgb.importance 2015-12-02 15:48:22 +01:00
pommedeterresautee
6ceb3438be Cleaning in documentation 2015-12-02 15:48:01 +01:00
pommedeterresautee
0abb4338a9 Cleaning in documentation 2015-12-02 15:48:01 +01:00
pommedeterresautee
7479cc68a7 Cleaning of demo 2015-12-02 15:47:45 +01:00
pommedeterresautee
e384f549f4 Cleaning of demo 2015-12-02 15:47:45 +01:00
pommedeterresautee
e57043ce62 Improve predict function documentation 2015-12-02 15:47:12 +01:00
pommedeterresautee
8233d589b6 Improve predict function documentation 2015-12-02 15:47:12 +01:00
Michaël Benesty
88e7c6012b Merge pull request #664 from pommedeterresautee/master
Support GLM in importance plot + increase tests #Rstat
2015-12-02 11:10:00 +01:00
Michaël Benesty
b708543309 Merge pull request #664 from pommedeterresautee/master
Support GLM in importance plot + increase tests #Rstat
2015-12-02 11:10:00 +01:00
pommedeterresautee
1678a6fbdb Increase cover of tests #Rstat 2015-12-02 10:40:15 +01:00
pommedeterresautee
45e6a6bbad Increase cover of tests #Rstat 2015-12-02 10:40:15 +01:00
pommedeterresautee
d04f7005de add support of GLM model in importance plot function 2015-12-02 10:39:57 +01:00
pommedeterresautee
43c860b6cc add support of GLM model in importance plot function 2015-12-02 10:39:57 +01:00
Bing Xu
5575257b08 Update README.md 2015-12-02 01:28:23 -07:00
Bing Xu
9a75daa388 Update README.md 2015-12-02 01:28:23 -07:00
Yuan (Terry) Tang
a1c0ee0e66 Merge pull request #644 from Far0n/verbose_eval_patch
small verbose_eval fixes
2015-12-01 14:58:58 -06:00
Yuan (Terry) Tang
811faa7bda Merge pull request #644 from Far0n/verbose_eval_patch
small verbose_eval fixes
2015-12-01 14:58:58 -06:00
Michaël Benesty
c870ef49da Merge pull request #662 from pommedeterresautee/master
Improve feature importance on GLM model
2015-12-01 19:02:18 +01:00
Michaël Benesty
bd2a4db26c Merge pull request #662 from pommedeterresautee/master
Improve feature importance on GLM model
2015-12-01 19:02:18 +01:00
pommedeterresautee
b05d5d3f24 Improve feature importance on GLM model 2015-12-01 18:44:25 +01:00
pommedeterresautee
28807733c3 Improve feature importance on GLM model 2015-12-01 18:44:25 +01:00
Michaël Benesty
423764ca2e Merge pull request #660 from pommedeterresautee/master
Polishing API + wording in function description #Rstat
2015-12-01 16:07:45 +01:00
Michaël Benesty
49ef81edb6 Merge pull request #660 from pommedeterresautee/master
Polishing API + wording in function description #Rstat
2015-12-01 16:07:45 +01:00
pommedeterresautee
6ce57d9cf8 Add new tests for helper functions 2015-12-01 15:44:27 +01:00
pommedeterresautee
29b73897f8 Add new tests for helper functions 2015-12-01 15:44:27 +01:00
Yuan (Terry) Tang
0ab719b59b Disable Python lint test temporarily 2015-12-01 08:39:25 -06:00
Yuan (Terry) Tang
de60db863b Disable Python lint test temporarily 2015-12-01 08:39:25 -06:00
pommedeterresautee
5d169afd7e Merge branch 'master' of https://github.com/dmlc/xgboost 2015-11-30 22:36:18 +01:00
pommedeterresautee
13a341b88d Merge branch 'master' of https://github.com/dmlc/xgboost 2015-11-30 22:36:18 +01:00
pommedeterresautee
8252d0d9f5 fix example 2015-11-30 16:33:33 +01:00
pommedeterresautee
b67902ebdd fix example 2015-11-30 16:33:33 +01:00
pommedeterresautee
2ca4016a1f fix relative to examples #Rstat 2015-11-30 16:21:43 +01:00
pommedeterresautee
425a5dd094 fix relative to examples #Rstat 2015-11-30 16:21:43 +01:00
pommedeterresautee
730bd72056 some fixes for Travis #Rstat 2015-11-30 15:47:10 +01:00
pommedeterresautee
6e370b90fd some fixes for Travis #Rstat 2015-11-30 15:47:10 +01:00
pommedeterresautee
c09c02300a Add new tests for new functions 2015-11-30 15:04:17 +01:00
pommedeterresautee
96c43cf197 Add new tests for new functions 2015-11-30 15:04:17 +01:00
pommedeterresautee
376ba6912e Update test to take care of API change 2015-11-30 14:08:27 +01:00
pommedeterresautee
ad8766dfa4 Update test to take care of API change 2015-11-30 14:08:27 +01:00
pommedeterresautee
476a6842ea Fix Rstat 2015-11-30 10:26:23 +01:00
pommedeterresautee
c5dedeb318 Fix Rstat 2015-11-30 10:26:23 +01:00
pommedeterresautee
07d62a4b89 Polishing API + wording in function description #Rstat 2015-11-30 10:22:14 +01:00
pommedeterresautee
84ab71dd7e Polishing API + wording in function description #Rstat 2015-11-30 10:22:14 +01:00
Michaël Benesty
bf19d821e0 Merge pull request #655 from pommedeterresautee/master
Add new multi tree plot function to R package
2015-11-28 18:08:27 +01:00
Michaël Benesty
09ed3f10cc Merge pull request #655 from pommedeterresautee/master
Add new multi tree plot function to R package
2015-11-28 18:08:27 +01:00
pommedeterresautee
28060d5595 Fix missing dependencies 2015-11-27 18:19:51 +01:00
pommedeterresautee
5e9f4dc973 Fix missing dependencies 2015-11-27 18:19:51 +01:00
pommedeterresautee
92e904dec9 add exclusion of global variables + generate Roxygen doc 2015-11-27 17:58:50 +01:00
pommedeterresautee
68b666d7e5 add exclusion of global variables + generate Roxygen doc 2015-11-27 17:58:50 +01:00
pommedeterresautee
2fc9dcc549 Improve description wording 2015-11-27 17:34:26 +01:00
pommedeterresautee
3d50a6a425 Improve description wording 2015-11-27 17:34:26 +01:00
pommedeterresautee
5169d08735 Add new multi.tree function to R package 2015-11-27 14:49:06 +01:00
pommedeterresautee
98ec6df168 Add new multi.tree function to R package 2015-11-27 14:49:06 +01:00
pommedeterresautee
e43830955f parameter names change in R function 2015-11-27 14:48:54 +01:00
pommedeterresautee
f28b7ed0cd parameter names change in R function 2015-11-27 14:48:54 +01:00
Michaël Benesty
9bc3d16599 Merge pull request #648 from pommedeterresautee/master
New function to plot model deepness
2015-11-24 13:52:40 +01:00
Michaël Benesty
1c4ed67779 Merge pull request #648 from pommedeterresautee/master
New function to plot model deepness
2015-11-24 13:52:40 +01:00
pommedeterresautee
6e9017c474 fix for Travis 2015-11-24 13:12:35 +01:00
pommedeterresautee
470ac2b46f fix for Travis 2015-11-24 13:12:35 +01:00
pommedeterresautee
485b30027f Plot model deepness
New function to explore the model by ploting the way splits are done.
2015-11-24 11:45:32 +01:00
pommedeterresautee
d9fe9c5d8a Plot model deepness
New function to explore the model by ploting the way splits are done.
2015-11-24 11:45:32 +01:00
Far0n
af166bf0a0 small verbose_eval fixes
- ensures same behavior for verbose_eval=0 and verbose_eval=False
- fix printing last eval message if early_stopping_rounds is set, but xgb
  runs to the end
2015-11-24 09:22:25 +01:00
tqchen
3a18b68f5f Merge commit '8ddffb36e1094e0fe3984e0eab132c23c58079a7' 2015-11-23 14:32:25 -08:00
tqchen
1b346d7041 Merge commit '8ddffb36e1094e0fe3984e0eab132c23c58079a7' 2015-11-23 14:32:25 -08:00
tqchen
8ddffb36e1 Squashed 'subtree/rabit/' changes from e81a11d..bed6320
bed6320 Merge pull request #26 from DrAndrey/master
291ab05 Remove redundant whitespace again
de25163 Remove redundant whitespace
3a6be65 Fix bug with name of sleep function

git-subtree-dir: subtree/rabit
git-subtree-split: bed63208af
2015-11-23 14:32:25 -08:00
Michaël Benesty
9cfe4bc6fe Merge pull request #647 from pommedeterresautee/master
Implement #431 PR
2015-11-23 19:47:08 +01:00
Michaël Benesty
311b1761c9 Merge pull request #647 from pommedeterresautee/master
Implement #431 PR
2015-11-23 19:47:08 +01:00
pommedeterresautee
60dd75745f Implement #431 PR 2015-11-23 18:19:59 +01:00
pommedeterresautee
fe7cdcefb4 Implement #431 PR 2015-11-23 18:19:59 +01:00
Yuan (Terry) Tang
13829329bd Merge pull request #639 from terrytangyuan/typo
Frequence to Frequency
2015-11-20 21:58:46 -06:00
terrytangyuan
51ee382517 Frequence to Frequency 2015-11-20 20:25:29 -06:00
Tianqi Chen
77fab79d83 Merge pull request #630 from sammthomson/docfix
grammar/style fixes for "Introduction to Boosted Trees" docs
2015-11-17 13:33:24 -08:00
Sam Thomson
2e9e6c82f9 grammar/style fixes for "Introduction to Boosted Trees" docs 2015-11-17 13:26:33 -08:00
Yuan (Terry) Tang
7e839c5c9e Merge pull request #627 from lenguyenthedat/patch-1
Updated build instructions for OS X.
2015-11-16 23:04:46 -06:00
Dat Le
bf50d25ea1 Updated build.md for OS X
OS X EI Capitan does not seem to stably support the clang build version anymore.
2015-11-16 10:28:12 +08:00
Yuan (Terry) Tang
83e61bf99e Merge pull request #621 from JohanManders/python-verbose-eval-extension
Python verbose_eval extension
2015-11-13 04:07:21 -06:00
Johan Manders
e68e9659ab Python verbose_eval extension
This is an extension of the verbose_eval abilities.

Removed some trailing-whitespaces
2015-11-13 08:19:44 +01:00
Yuan (Terry) Tang
cb5171914e Merge pull request #623 from sinhrks/pandas_label
Cleanup pandas support
2015-11-12 18:04:29 -06:00
sinhrks
25c4fbd0cb Cleanup pandas support 2015-11-13 06:55:04 +09:00
Yuan (Terry) Tang
4fb6153eed Fixed minor lint issue 2015-11-12 09:01:05 -06:00
Yuan (Terry) Tang
a2216c12a0 Added recent changes 2015-11-12 08:57:38 -06:00
Yuan (Terry) Tang
0a0951ba12 Clarification for best_ntree_limit 2015-11-12 08:53:45 -06:00
Yuan (Terry) Tang
42e1fd8fff Merge pull request #598 from Far0n/py_train
best_ntree_limit attribute & training continuation bugfix
2015-11-12 06:16:19 -06:00
Yuan (Terry) Tang
309fb90a5d Merge pull request #618 from phunterlau/master
fix pushd problem of pip building, convert README to rst for PyPI
2015-11-12 06:11:07 -06:00
Faron
7f2628acd7 unittest for 'num_class > 2' added 2015-11-12 08:23:11 +01:00
phunterlau
ee4096d23e fix pushd problem of pip building, convert README to rst for PyPI 2015-11-11 23:03:07 -08:00
Yuan (Terry) Tang
7b3fd92015 Added PyPI badges 2015-11-10 18:23:39 -06:00
Far0n
ce5930c365 best_ntree_limit attribute added
- best_ntree_limit as new booster atrribute added
- usage of bst.best_ntree_limit in python doc added
- fixed wrong 'best_iteration' after training continuation
2015-11-10 15:37:22 +01:00
Yuan (Terry) Tang
f91ce704f3 Merge pull request #615 from antonymayi/master
python 2.6 compatibility tweak
2015-11-10 08:26:12 -06:00
antonymayi
8c7b18daed python 2.6 compatibility tweak
replacing set literal {} with set() for python 2.6 compatibility (plus reformatting the line)
2015-11-10 14:50:54 +01:00
Yuan (Terry) Tang
d1969b4c03 Update CHANGES.md 2015-11-09 18:13:44 -06:00
Yuan (Terry) Tang
1dd96b6cdc Merge pull request #597 from JohanManders/python-pandas-dtypes
Python pandas dtypes
2015-11-09 18:08:41 -06:00
Yuan (Terry) Tang
7491413de5 Merge pull request #611 from antonymayi/master
python 2.6 compatibility
2015-11-09 08:45:26 -06:00
antonymayi
7114d6681a Update training.py
pylint compliancy
2015-11-09 15:09:14 +01:00
antonymayi
34e01642ca Update training.py
avoid dict comprehension for python 2.6 compatibility
2015-11-09 14:26:16 +01:00
Yuan (Terry) Tang
b8bc85b534 Clarification for learning_rates 2015-11-08 21:10:04 -06:00
Tong He
4db3dfee7d Update utils.R 2015-11-08 18:08:51 -08:00
Yuan (Terry) Tang
ae31bc21bc Merge pull request #610 from Far0n/master
grammar correction
2015-11-08 15:06:20 -05:00
Faron
b2f98db74e grammar correction 2015-11-08 21:00:16 +01:00
Yuan (Terry) Tang
bde25d6694 Added recent changes 2015-11-08 14:57:36 -05:00
Yuan (Terry) Tang
e837b339cc Reformat CHANGES.md 2015-11-08 14:54:52 -05:00
Yuan (Terry) Tang
01053f8f2f Merge pull request #594 from Far0n/feval
python: multiple eval_metrics changes
2015-11-08 10:10:28 -05:00
Yuan (Terry) Tang
8fc5693ef6 Merge pull request #609 from Far0n/cv_early_stopping_unittest
python: unittest for early stopping of cv
2015-11-08 09:59:18 -05:00
FrozenFingerz
3d36fa8f4e python: unittest for early stopping of cv 2015-11-08 11:42:57 +01:00
FrozenFingerz
b59018aa05 python: multiple eval_metrics changes
- allows feval to return a list of tuples (name, error/score value)
- changed behavior for multiple eval_metrics in conjunction with
early_stopping: Instead of raising an error, the last passed evel_metric
(or last entry in return value of feval) is used for early stopping
- allows list of eval_metrics in dict-typed params
- unittest for new features / behavior

documentation updated

- example for assigning a list to 'eval_metric'
- note about early stopping on last passed eval metric

- info msg for used eval metric added
2015-11-08 11:23:54 +01:00
Michaël Benesty
282a64c252 Merge pull request #608 from ClimbsRocks/patch-8
minor formatting update
2015-11-08 08:42:27 +01:00
Michaël Benesty
5268c19b6b Merge pull request #607 from ClimbsRocks/patch-7
punctuation update
2015-11-08 08:41:03 +01:00
Michaël Benesty
f5659e17d5 Merge pull request #605 from pommedeterresautee/master
Rewrite Viz function
2015-11-08 08:40:22 +01:00
Preston Parry
af047e9f8c minor formatting update 2015-11-07 22:32:18 -08:00
Preston Parry
d25efb6468 punctuation update 2015-11-07 22:27:39 -08:00
Yuan (Terry) Tang
ebbde5c343 Merge pull request #606 from cauldnz/patch-1
Fixing broken link for R sample.
2015-11-08 00:21:54 -05:00
Chris Auld
e74628f5d4 Update README.md
Fixed broken link for R 'First N Trees' sample.
2015-11-07 20:26:32 -08:00
unknown
7cb34e3ad6 Fix some bug + improve display + code clean 2015-11-07 22:24:37 +01:00
unknown
996645dc17 Change the way functions are called 2015-11-07 22:04:54 +01:00
unknown
77ae180d3d Remove DiagrammeR dependency to make travis happy... 2015-11-07 21:46:08 +01:00
unknown
0052b193cf Update lib version dependencies (for DiagrammeR mainly)
Fix @export tag in each R file (for Roxygen 5, otherwise it doesn't work anymore)
Regerate Roxygen doc
2015-11-07 21:01:28 +01:00
unknown
635645c650 Rewrite tree plot function
Replace Mermaid by GraphViz
2015-11-07 21:00:02 +01:00
unknown
231a6e7aea Merge branch 'master' of https://github.com/pommedeterresautee/xgboost
# Conflicts:
#	R-package/R/xgb.model.dt.tree.R
2015-11-07 19:13:14 +01:00
Yuan (Terry) Tang
562fe8078b Added CV early stopping to CHANGES 2015-11-07 09:45:13 -05:00
Yuan (Terry) Tang
a3a4439dec Merge pull request #602 from Far0n/cv
early stopping for CV (python) issue #529
2015-11-07 09:42:54 -05:00
Faron
95cc900b1f early stopping for CV (python) 2015-11-07 09:52:36 +01:00
Yuan (Terry) Tang
190e58a8c6 Added test for maximize parameter 2015-11-04 22:25:10 -06:00
Johan Manders
5f0f8749d9 Cleaned up some code 2015-11-04 18:05:47 +01:00
Yuan (Terry) Tang
8bf6525394 Added PyPI badge to README 2015-11-04 09:19:40 -06:00
Dat Le
117f26f865 Updated build.md for OS X
Ref: https://github.com/dmlc/xgboost/issues/596
2015-11-04 13:54:56 +08:00
Johan Manders
b0f38e9352 Changed 4 tests
Changed symbol test to give error on < sign, not on = sign
Changed 3 other functions, so that float is used instead of q
2015-11-03 21:32:47 +01:00
Johan Manders
f9e1b2b7b7 Added back feature names 2015-11-03 21:26:11 +01:00
Johan Manders
96f221e0d0 Merge pull request #5 from dmlc/master
Update to latest version
2015-11-03 20:37:20 +01:00
Yuan (Terry) Tang
e436c94419 Create CHANGES.md 2015-11-03 08:32:52 -06:00
Yuan (Terry) Tang
deb802b2be Merge pull request #587 from Far0n/py_train
python training continuation & maximize parameter
2015-11-03 08:16:12 -06:00
Far0n
8e1adddc2b added unittest for training continuation 2015-11-03 14:44:17 +01:00
Far0n
b894f7c9d6 bugfix type-check xgb_model param 2015-11-03 14:43:08 +01:00
Yuan (Terry) Tang
a71ccd8372 Merge pull request #591 from terrytangyuan/test
More test coverage for Python package
2015-11-02 21:00:52 -06:00
terrytangyuan
7d297b418f Added more thorough test for early stopping (+1 squashed commit)
Squashed commits:
[4f78cc0] Added test for early stopping (+1 squashed commit)
2015-11-02 20:37:27 -06:00
terrytangyuan
166e878830 Added tests for additional params in sklearn wrapper (+1 squashed commit)
Squashed commits:
[43892b9] Added tests for additional params in sklearn wrapper
2015-11-02 19:54:36 -06:00
Yuan (Terry) Tang
430be8d4bd Merge pull request #589 from Far0n/patch-1
Update CONTRIBUTORS.md
2015-11-02 14:52:25 -06:00
Far0n
8676a1bf56 Update CONTRIBUTORS.md 2015-11-02 21:27:05 +01:00
Faron
4fe2f2fb09 python train additions
+ training continuation of existing model
+ maximize parameter just like in R package (whether  to maximize feval)
2015-11-02 21:21:05 +01:00
Yuan (Terry) Tang
7f559235be Merge pull request #586 from Far0n/sklearn_wrapper
sklearn_wrapper additions fixed #420
2015-11-02 12:07:12 -06:00
Faron
79813097b5 sklearn_wrapper additions
added output_margin & ntree_limit to predict and predict_proba
2015-11-02 17:41:30 +01:00
Yuan (Terry) Tang
e49d06c6bd Merge pull request #585 from phunterlau/master
separate setup.py from pip installation, add trouble shooting page
2015-11-02 09:45:20 -06:00
phunterlau
739b3f2c5f separate setup.py with pip installation, add trouble shooting page 2015-11-01 22:11:11 -08:00
Yuan (Terry) Tang
9e1690defe Merge pull request #582 from terrytangyuan/test
Test (eta decay) and bug fix
2015-10-31 13:07:33 -04:00
terrytangyuan
610b70b79e Suppress more evaluation verbose during training 2015-10-31 13:05:52 -04:00
terrytangyuan
15a0d27eed Fixed bug in eta decay (+2 squashed commits)
Squashed commits:
[b67caf2] Fix build
[365ceaa] Fixed bug in eta decay
2015-10-31 12:54:27 -04:00
terrytangyuan
888edba03f Added test for eta decay (+3 squashed commits)
Squashed commits:
[9109887] Added test for eta decay(+1 squashed commit)
Squashed commits:
[1336bd4] Added tests for eta decay (+2 squashed commit)
Squashed commits:
[91aac2d] Added tests for eta decay (+1 squashed commit)
Squashed commits:
[3ff48e7] Added test for eta decay
[6bb1eed] Rewrote Rd files
[bf0dec4] Added learning_rates for diff eta in each boosting round
2015-10-31 12:36:29 -04:00
terrytangyuan
c817efbd8a Fix Travis build 2015-10-30 23:41:24 -04:00
terrytangyuan
c11d6d5929 Merge branch 'master' of https://github.com/dmlc/xgboost 2015-10-30 23:01:44 -04:00
Yuan (Terry) Tang
243fd46df9 Merge pull request #581 from ThunderShiviah/patch-1
Fix minor spelling and grammar
2015-10-30 21:55:29 -04:00
Thunder Shiviah
a0c9ecd289 Fix minor spelling errors and awkward grammar. 2015-10-30 18:43:31 -07:00
terrytangyuan
e23f4ec3db Minor addition to R unit tests 2015-10-30 19:48:00 -05:00
Yuan (Terry) Tang
9cdcc8303b Update CHANGES.md 2015-10-30 10:54:29 -05:00
Yuan (Terry) Tang
c16a6222f3 Merge pull request #563 from Far0n/eta_decay
learning_rates per boosting round
2015-10-30 10:21:33 -05:00
Tianqi Chen
3e648fd1e9 Merge pull request #572 from ghosthugger/master
install xgboost so it can be imported
2015-10-29 10:59:28 -07:00
Yuan (Terry) Tang
b9a9cd9db8 Merge pull request #580 from terrytangyuan/test
Fixed most of the lint issues
2015-10-29 00:54:16 -04:00
terrytangyuan
5b9e071c18 Fix travis build (+1 squashed commit)
Squashed commits:
[9240d5f] Fix Travis build
2015-10-29 00:28:53 -04:00
Yuan (Terry) Tang
99157ae56a Merge pull request #579 from ClimbsRocks/patch-4
minor wording update
2015-10-28 23:25:17 -04:00
terrytangyuan
6024480400 Fixed most of the lint issues 2015-10-28 23:24:17 -04:00
Preston Parry
6d35bd2421 minor wording update
just clarifying some of the language describing the parameters
2015-10-28 20:10:21 -07:00
terrytangyuan
8bae715994 Lint fix on infix operators 2015-10-28 23:04:45 -04:00
Yuan (Terry) Tang
1dcedb23ec Update CONTRIBUTORS.md 2015-10-28 22:57:41 -04:00
terrytangyuan
d7fce99564 Lint fix on consistent assignment 2015-10-28 22:22:51 -04:00
Michaël Benesty
ce9d7045f9 Merge pull request #575 from ClimbsRocks/patch-2
Clarifies explanations around Data Interface code
2015-10-28 10:02:27 +01:00
Michaël Benesty
1924e16f45 Merge pull request #576 from ClimbsRocks/patch-3
fixes typo in error message
2015-10-28 10:00:54 +01:00
Preston Parry
b3bb54da73 fixes typo in error message 2015-10-27 23:34:50 -07:00
Tianqi Chen
88b4c64c0d Merge pull request #573 from ClimbsRocks/patch-1
Clarifies wording on Data Interface intro list
2015-10-27 23:01:10 -07:00
Preston Parry
89eafa1b97 Clarifies explanations around Data Interface code 2015-10-27 22:41:29 -07:00
Preston Parry
8ddb7b0152 Clarifies wording on Data Interface intro list 2015-10-27 22:35:35 -07:00
Gösta Forsum
111b04e18e Update setup.py 2015-10-27 13:47:58 +01:00
Tong He
2e31e97e54 Merge pull request #568 from terrytangyuan/test
Added test_lint.R to test code quality
2015-10-26 22:19:48 -07:00
terrytangyuan
56da375165 Added test_lint.R to test code quality 2015-10-25 20:45:04 -04:00
Tianqi Chen
3534147905 Merge pull request #564 from Far0n/sklearn_wrapper
added missing params to sklearn python wrapper
2015-10-25 12:42:08 -07:00
Faron
738e420128 correcting wrong default values 2015-10-25 11:26:33 +01:00
Faron
b80d5d6b33 fixed too long lines 2015-10-25 11:17:35 +01:00
Faron
422febd18e added missing params 2015-10-25 10:58:07 +01:00
Faron
68c9252ff7 fixed "Exactly one space required after comma" 2015-10-25 10:20:00 +01:00
Faron
a1ba608641 learning_rates per boosting round 2015-10-25 10:00:20 +01:00
Tong He
224f574420 Merge pull request #561 from terrytangyuan/test
Added test for code quality check
2015-10-24 22:27:19 -07:00
Tianqi Chen
06f502a1aa Merge pull request #549 from phunterlau/master
Fix data file shipping confusions on pip install for #463
2015-10-24 22:08:59 -07:00
Tianqi Chen
d60ee84137 Merge pull request #560 from sinhrks/plot_importance
Python: adjusts plot_importance ylim
2015-10-24 22:08:40 -07:00
terrytangyuan
139feaf97a Code: Lint fixes on trailing spaces 2015-10-24 16:50:03 -04:00
terrytangyuan
537b34dc6f Code: Some Lint fixes 2015-10-24 16:43:44 -04:00
terrytangyuan
3abbd7b4c7 Added test_lint to test code quality 2015-10-24 16:39:58 -04:00
sinhrks
1f19b78287 Python: adjusts plot_importance ylim 2015-10-25 03:16:53 +09:00
Tianqi Chen
36927632c5 Merge pull request #557 from shimo-t/patch
fix training.py and sklearn.py for evals_result in python3
2015-10-23 09:55:50 -07:00
Takahisa Shimoda
607599f2a1 fix sklearn.py for evals_result in python3 2015-10-23 05:40:31 +09:00
Takahisa Shimoda
b587dd2704 fix training.py for evals_result in python3 2015-10-23 05:37:13 +09:00
Tianqi Chen
4b4ade8342 Update CONTRIBUTORS.md 2015-10-22 08:40:36 -07:00
Tianqi Chen
d4d36eed45 Merge pull request #528 from terrytangyuan/test
More Unit Tests for Python Package
2015-10-22 08:39:32 -07:00
Tianqi Chen
cb7f331ebc Merge pull request #555 from sinhrks/plot_sklearn
Allow plot function to handle XGBModel
2015-10-22 08:39:25 -07:00
Tianqi Chen
c4181e5f2e Merge pull request #552 from yoori/perf
GBTree::Predict performance fix: removed excess thread_temp initializ…
2015-10-22 08:39:05 -07:00
terrytangyuan
ec2cdafec5 Added fixed random seed for tests (+1 squashed commit)
Squashed commits:
[76e3664] Added fixed random seed for tests
2015-10-21 23:38:41 -05:00
terrytangyuan
755072e378 Fix failed tests (+2 squashed commits)
Squashed commits:
[962e1e4] Fix failed tests
[21ca3fb] Removed one unnecessary line
2015-10-21 23:15:34 -05:00
terrytangyuan
652ff07668 Added scikit-learn from Conda 2015-10-21 21:30:11 -05:00
phunterlau
24a92808db correct print for python 3 2015-10-21 14:32:35 -07:00
sinhrks
6f046327ac Allow plot function to handle XGBModel 2015-10-22 01:00:54 +09:00
tqchen
eee3046624 [DOC] Add contributor 2015-10-20 19:44:06 -07:00
tqchen
a16289b204 Squashed 'subtree/rabit/' changes from fa99857..e81a11d
e81a11d Merge pull request #25 from daiyl0320/master
35c3b37 add retry mechanism to ConnectTracker and modify Listen backlog to 128 in rabit_traker.py
c71ed6f try deply doxygen
62e5647 try deply doxygen
732f1c6 try
2fa6e02 ok
0537665 minor
7b59dcb minor
5934950 new doc
f538187 ok
44b6049 new doc
387339b add more
9d4397a chg
2879a48 chg
30e3110 ok
9ff0301 add link translation
6b629c2 k
32e1955 ok
8f4839d fix
93137b2 ok
7eeeb79 reload recommonmark
a8f00cc minor
19b0f01 ok
dd01184 minor
c1cdc19 minor
fcf0f43 try rst
cbc21ae try
62ddfa7 tiny
aefc05c final change
2aee9b4 minor
fe4e7c2 ok
8001983 change to subtitle
5ca33e4 ok
88f7d24 update guide
29d43ab add code
fe8bb3b minor hack for readthedocs
229c71d Merge branch 'master' of ssh://github.com/dmlc/rabit
7424218 ok
d1d45bb Update README.md
1e8813f Update README.md
1ccc990 Update README.md
0323e06 remove readme
679a835 remove theme
7ea5b7c remove numpydoc to napoleon
b73e2be Merge branch 'master' of ssh://github.com/dmlc/rabit
1742283 ok
1838e25 Update python-requirements.txt
bc4e957 ok
fba6fc2 ok
0251101 ok
d50b905 ok
d4f2509 ok
cdf401a ok
fef0ef2 new doc
cef360d ok
c125d2a ok
270a49e add requirments
744f901 get the basic doc
1cb5cad Merge branch 'master' of ssh://github.com/dmlc/rabit
8cc07ba minor
d74f126 Update .travis.yml
52b3dcd Update .travis.yml
099581b Update .travis.yml
1258046 Update .travis.yml
7addac9 Update Makefile
0ea7adf Update .travis.yml
f858856 Update travis_script.sh
d8eac4a Update README.md
3cc49ad lint and travis
ceedf4e fix
fd8920c fix win32
8bbed35 modify
9520b90 Merge pull request #14 from dmlc/hjk41
df14bb1 fix type
f441dc7 replace tab with blankspace
2467942 remove unnecessary include
181ef47 defined long long and ulonglong
1582180 use int32_t to define int and int64_t to define long. in VC long is 32bit
e0b7da0 fix

git-subtree-dir: subtree/rabit
git-subtree-split: e81a11dd7e
2015-10-20 19:37:47 -07:00
tqchen
a4ac750eb1 Merge commit 'a16289b2047a7c2ec36667f6031dbb648e4d2caa' 2015-10-20 19:37:47 -07:00
yoori
981f06b9d1 style fix 2015-10-20 00:58:11 +04:00
yoori
49c1cb6990 GBTree::Predict performance fix: removed excess thread_temp initialization 2015-10-20 00:52:37 +04:00
yoori
c0853967d5 GBTree::Predict performance fix: removed excess thread_temp initialization 2015-10-20 00:06:00 +04:00
Tianqi Chen
fd8439ffbc Update param.h
enforce parallel option to 0 for now for stable result
2015-10-19 08:59:06 -07:00
Johan Manders
7c79c9ac3a Bool gets mapped to i instead of int 2015-10-19 17:36:57 +02:00
phunterlau
8ad58139cd fix pylint warnings 2015-10-18 18:55:15 -07:00
phunterlau
7b25834667 fix data file shipping confusions, force system compiling, correct libpath for pip 2015-10-18 17:28:07 -07:00
Johan Manders
66b9a72d5a Merge pull request #4 from JohanManders/JohanManders-Pandas
More Pandas dtypes and more flexible variable naming
2015-10-17 15:17:16 +02:00
Johan Manders
9bbc3901ee More Pandas dtypes and more flexible variable naming
- Pandas DataFrame supports more dtypes than 'int64', 'float64' and 'bool', therefor added a bunch of extra dtypes for the data variable.
- From now on the label variable can be a Pandas DataFrame with the same dtypes as the data variable.
- If label is a Pandas DataFrame will be converted to float.
- If no feature_types is set, the data dtypes will be converted to 'int' or 'float'.
- The feature_names may contain every character except [, ] or <
2015-10-17 15:13:42 +02:00
Johan Manders
f116722e68 Merge pull request #3 from dmlc/master
Getting latest version from dmlc
2015-10-17 14:41:13 +02:00
Tianqi Chen
8e4dc43368 Merge pull request #540 from JohanManders/quansie-python-training-patch-1
Update training.py and sklearn.py for evals_result
2015-10-16 20:42:29 -07:00
Johan Manders
00387cb645 Removed th last few trailing whitespaces 2015-10-14 14:26:18 +02:00
Johan Manders
0f8f8e05b2 One line was too long 2015-10-14 14:18:31 +02:00
Johan Manders
82c2ba4c44 Removed trailing whitespaces and Change Error to XGBoostError 2015-10-14 14:17:57 +02:00
Johan Manders
edf4595bc1 Added evals result demos 2015-10-14 13:45:59 +02:00
Johan Manders
f1e1cc28ff Access xgboost eval metrics by using sklearn 2015-10-14 13:43:14 +02:00
Johan Manders
122ec48a89 Update evals_result.py 2015-10-14 13:40:20 +02:00
Johan Manders
6e2bdcbbbc Demo for accessing eval metrics in xgboost 2015-10-14 13:22:39 +02:00
Johan Manders
67f3c687b8 Added Johan Manders to the list, asked by Tianqi Chen 2015-10-14 13:06:14 +02:00
Johan Manders
9c8420a4dc Updated the documentation a bit
Will upload some demos for guide-python later.
2015-10-14 12:53:42 +02:00
Johan Manders
e960a09ff4 Made eval_results for sklearn output the same structure as in the new training.py
Changed the name of eval_results to evals_result, so that the naming is the same in training.py and sklearn.py

Made the structure of evals_result the same as in training.py, the names of the keys are different:

In sklearn.py you cannot name your evals_result, but they are automatically called 'validation_0', 'validation_1' etc.
The dict evals_result will output something like: {'validation_0': {'logloss': ['0.674800', '0.657121']}, 'validation_1': {'logloss': ['0.63776', '0.58372']}}

In training.py you can name your multiple evals_result with a watchlist like: watchlist  = [(dtest,'eval'), (dtrain,'train')]
The dict evals_result will output something like: {'train': {'logloss': ['0.68495', '0.67691']}, 'eval': {'logloss': ['0.684877', '0.676767']}}

You can access the evals_result using the evals_result() function.
2015-10-14 12:51:46 +02:00
Johan Manders
e339cdec52 Too many branches and unused key 2015-10-12 16:47:24 +02:00
Johan Manders
40566cdbba update sklearn.py because evals_result in training.py changed
Because I changed the training.py, the sklearn.py had to be changed also to be able to read all the data form evals_result.
2015-10-12 16:31:23 +02:00
quansie
30d0d5fb96 Merge pull request #2 from quansie/quansie-python-training-patch-1
Removed extra spaces
2015-10-12 14:28:50 +02:00
quansie
b758a13813 Removed extra spaces 2015-10-12 14:26:23 +02:00
quansie
541580d157 Update training.py 2015-10-12 14:19:25 +02:00
quansie
8a484e990e Merge pull request #1 from quansie/quansie-python-training-patch-1
training.py - pass all eval_metric information to evals_result
2015-10-12 14:11:34 +02:00
quansie
1ca737ed55 Update training.py
Made changes to training.py to make sure all eval_metric information get passed to evals_result. Previous version lost and mislabeled data in evals_result when using more than one eval_metric.

Structure of eval_metric is now:
eval_metric[evals][eval_metric] = list of metrics

Example:

>>> dtrain = xgb.DMatrix('agaricus.txt.train', silent=True)
>>> dtest = xgb.DMatrix('agaricus.txt.test', silent=True)

>>> param = [('max_depth', 2), ('objective', 'binary:logistic'), ('bst:eta', 0.01), ('eval_metric', 'logloss'), ('eval_metric', 'error')]

>>> watchlist  = [(dtest,'eval'), (dtrain,'train')]
>>> num_round = 3
>>> evals_result = {}
>>> bst = xgb.train(param, dtrain, num_round, watchlist, evals_result=evals_result)

>>> print(evals_result['eval']['logloss'])
>>> print(evals_result)

Prints:

['0.684877', '0.676767', '0.668817']

{'train': {'logloss': ['0.684954', '0.676917', '0.669036'], 'error': ['0.04652', '0.04652', '0.04652']}, 'eval': {'logloss': ['0.684877', '0.676767', '0.668817'], 'error': ['0.042831', '0.042831', '0.042831']}}
2015-10-11 01:09:05 +02:00
Tong He
e9edb03eff Merge pull request #533 from kferris10/master
Switch default missing values from 0 to NA in R package
2015-10-08 10:47:28 -07:00
kferris
d5a34339e5 Updated Changes 2015-10-08 13:22:23 -04:00
kferris
32ca060094 Fix merge conflicts 2015-10-08 08:58:27 -04:00
Tong He
81d4d4d2c1 Update utils.R 2015-10-07 18:26:33 -07:00
kferris
7a94bdb60c Switch missing values from 0 to NA in R package 2015-10-07 18:51:47 -04:00
yanqingmen
3453b6e715 Merge pull request #5 from dmlc/master
update from dmlc/xgboost
2015-10-07 13:55:57 +08:00
terrytangyuan
1080dc256a Fix Travis build 2015-10-05 00:46:56 -05:00
terrytangyuan
fc5036a630 Deleted redundant blank lines 2015-10-04 23:29:40 -05:00
terrytangyuan
9d627e2567 DOC: Updated contributors.md 2015-10-04 23:26:46 -05:00
terrytangyuan
5dd23a2195 TST: Added test for parameter tuning using GridSearchCV 2015-10-04 23:16:00 -05:00
terrytangyuan
956e50686e TST: Added test for early stopping 2015-10-04 23:15:25 -05:00
terrytangyuan
412310ed04 Added test for regression ysing Boston Housing dataset 2015-10-04 23:04:23 -05:00
terrytangyuan
d20bfb12e4 Added assertions for classification tests 2015-10-04 23:01:07 -05:00
terrytangyuan
3dbd4af263 TST: Added tests for multi-class classification 2015-10-04 22:57:13 -05:00
terrytangyuan
7b9b4f821b TST: Added tests for binary classification 2015-10-04 22:53:31 -05:00
terrytangyuan
1411d3f37f TST: Added test for custom_objective function in cv 2015-10-04 22:45:10 -05:00
terrytangyuan
dfb89e3442 TST: Added test for show_stdv when using cv 2015-10-04 22:42:39 -05:00
terrytangyuan
0c360fe55f TST: Added test for fpreproc 2015-10-04 22:30:45 -05:00
Tianqi Chen
3109069019 Merge pull request #525 from sinhrks/df_columns
Python supports pd.DataFrame with non-str columns
2015-10-04 10:01:09 -07:00
sinhrks
dbcb4c8729 Support non-str column names 2015-10-04 13:30:01 +09:00
Tianqi Chen
2859c190cd Merge pull request #522 from sinhrks/pandas
python DMatrix now accepts pandas DataFrame
2015-10-02 10:19:14 -07:00
Tianqi Chen
9c39f69559 Merge pull request #524 from sinhrks/cv_pandas
Python CV returns pd.DataFrame or np.ndarray
2015-10-02 10:18:13 -07:00
sinhrks
b958c55ac6 CV returns ndarray or DataFrame 2015-10-02 22:38:03 +09:00
sinhrks
b943becc61 python DMatrix now accepts pandas DataFrame 2015-10-01 22:52:32 +09:00
Tianqi Chen
db490d1c75 Merge pull request #503 from sinhrks/feature_types
Python: Add feature_types to DMatrix
2015-09-29 14:14:48 -07:00
sinhrks
f6f3473d17 Change to properties 2015-09-28 22:36:39 +09:00
sinhrks
db692a30e5 Add feature_types 2015-09-28 22:25:35 +09:00
Tianqi Chen
b0591c8042 Merge pull request #514 from nerdcha/master
Fix makefile typo
2015-09-21 15:05:20 -07:00
Jamie Hall
f5920f8cbd Fix makefile typo 2015-09-22 07:18:15 +10:00
Tianqi Chen
05b242d542 Merge pull request #511 from nerdcha/master
Use homebrew gcc if available
2015-09-20 17:18:38 -07:00
Jamie Hall
6c3e4d7d0d Use homebrew gcc if available 2015-09-21 08:55:42 +10:00
Tianqi Chen
f28459497d fix pylint in setup 2015-09-18 20:22:54 -07:00
Tianqi Chen
e558d45208 Update .travis.yml 2015-09-18 18:45:18 -07:00
Tianqi Chen
788741bbcb Merge pull request #507 from nerdcha/master
Restore Python3 compatibility
2015-09-18 18:32:29 -07:00
Jamie Hall
0bca4c8c3b Restore Python3 compatibility 2015-09-19 10:46:57 +10:00
Tianqi Chen
5ff0fcc693 Merge pull request #504 from irachex/contributor
Add contributor
2015-09-17 19:38:22 -07:00
Huayi Zhang
c49c6565e5 Add contributor 2015-09-18 10:35:41 +08:00
Tianqi Chen
a92d21ce24 Merge pull request #502 from irachex/fix_setup
Fix python setup: avoid import numpy in setup.py
2015-09-17 09:35:46 -07:00
Tianqi Chen
808c0a6dff Merge pull request #497 from sinhrks/numpy_check
Bug: Fix numpy array check logic
2015-09-17 09:19:58 -07:00
sinhrks
f7d434aec2 Fix numpy array check logic 2015-09-17 22:51:44 +09:00
Huayi Zhang
6af98bec16 Fix python setup: avoid import numpy in setup.py
Currently `pip install xgboost` will raise traceback like this

```
Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "/tmp/pip-build-IAdqYE/xgboost/setup.py", line 20, in <module>
    import xgboost
  File "./xgboost/__init__.py", line 8, in <module>
    from .core import DMatrix, Booster
  File "./xgboost/core.py", line 12, in <module>
    import numpy as np
ImportError: No module named numpy
```

We should avoid importing numpy in setup.py and let pip install numpy and scipy automatically.
That's what `install_requires` for.
2015-09-17 14:49:19 +08:00
Tianqi Chen
cf2ec238a4 Merge pull request #496 from sinhrks/str_cln
Cleanup str roundtrip using ctypes
2015-09-16 16:01:42 -07:00
sinhrks
bb6b7ded55 Cleanup str roundtrip using ctypes 2015-09-17 04:10:19 +09:00
Tianqi Chen
bad4a27b9f Merge pull request #495 from aeeilllmrx/master
minor spelling and grammar changes
2015-09-16 08:40:51 -07:00
Tianqi Chen
f5eb345c8a Merge pull request #498 from sinhrks/check_binary
BUG: incorrect model_file results in segfault
2015-09-16 08:40:11 -07:00
sinhrks
db0c9e1c2d BUG: incorrect model_file results in segfault 2015-09-16 22:02:30 +09:00
Alex Miller
0b143e6d22 spelling changes 2015-09-16 01:39:01 -07:00
Alex Miller
7f3bc03990 spelling and grammar 2015-09-16 01:33:28 -07:00
Alex Miller
1f624a8005 Merge pull request #2 from aeeilllmrx/aeeilllmrx-spelling-and-grammar
spelling and grammar changes
2015-09-16 01:32:43 -07:00
Alex Miller
030a4e4e25 spelling and grammar changes 2015-09-16 01:23:31 -07:00
Alex Miller
16781ac8f9 Merge pull request #1 from dmlc/master
update from original
2015-09-16 01:16:31 -07:00
Tianqi Chen
ae43fd7c7a Merge pull request #488 from sinhrks/pyfeaturenames
Support feature names in Python package
2015-09-15 09:56:55 -07:00
sinhrks
6063d243eb Mac build fix 2015-09-15 18:39:06 +09:00
Tianqi Chen
bda3282f6d Merge pull request #492 from Far0n/patch-1
bugfix evals_result regex
2015-09-14 08:46:58 -07:00
sinhrks
48ac946d9f Use ctypes 2015-09-14 22:12:19 +09:00
Far0n
0406c64a5d bugfix evals_result regex 2015-09-14 11:25:41 +02:00
Tianqi Chen
b1c94c7d86 Merge pull request #490 from phunterlau/master
add static link to gcc + openmp for MAC
2015-09-13 18:06:28 -07:00
phunterlau
529b80406c switch back to dynamic build by default 2015-09-13 17:36:49 -07:00
phunterlau
13c8d2ba74 add multi-thread static link for MAC 2015-09-13 17:34:37 -07:00
Hongliang Liu
cbb52b1d5d Merge pull request #2 from dmlc/master
rebase to current dmlc official version
2015-09-13 15:01:22 -07:00
sinhrks
6506a1c490 ENH: allow python to handle feature names 2015-09-12 12:37:33 +09:00
Tong He
dd3126735b Merge pull request #482 from terrytangyuan/patch-1
Added xgboost demo using caret into README and added more explanation in the demo
2015-09-11 11:20:37 -07:00
terrytangyuan
424bcc05fa ENH: More comments and explanation on demo using xgboost from caret 2015-09-10 23:41:36 -04:00
Yuan Tang (Terry)
62e95dcc60 DOC: Added caret_wrapper.R link into demo/README.md 2015-09-10 23:23:30 -04:00
Tong He
0fe182d3c3 Merge pull request #479 from terrytangyuan/caretwrapper
ENH/DOC: Added R package demo using caret library to train xgbTree model
2015-09-10 12:26:03 -07:00
Tianqi Chen
0c0e26effa Update README.md 2015-09-08 19:45:39 -07:00
Tianqi Chen
2a8c1c677e Merge pull request #476 from terrytangyuan/patch-1
DOC: Typo in README.md in tests folder
2015-09-08 19:38:43 -07:00
Tianqi Chen
4380641714 Merge pull request #478 from terrytangyuan/tests
TST: Added some unit tests for Python
2015-09-08 19:38:30 -07:00
terrytangyuan
9ead44531e DOC: Added new demo to index 2015-09-08 10:54:07 -04:00
terrytangyuan
d3bb466026 ENH/DOC: Added R package demo using caret library to train xgbTree model 2015-09-08 10:51:20 -04:00
terrytangyuan
8196d5d680 TST: More thorough checks for Python tests 2015-09-08 10:14:28 -04:00
terrytangyuan
82a43f448e TST: Added Python test for custom objective functions 2015-09-08 09:54:38 -04:00
terrytangyuan
eb1b185d70 TST: Added glm test for Python 2015-09-08 09:47:48 -04:00
Tong He
67f40b2629 Merge pull request #475 from terrytangyuan/master
More thorough unit testing for R package
2015-09-07 20:30:10 -07:00
terrytangyuan
33f1ab3ae1 TST: Added one minor check for xgb.importance 2015-09-07 22:51:14 -04:00
terrytangyuan
fbf2a5feed DOC: Updated CONTRIBUTORS.md 2015-09-07 22:49:10 -04:00
Yuan Tang (Terry)
cb3afeec53 DOC: Typo in README.md in tests folder 2015-09-07 22:23:47 -04:00
terrytangyuan
c50cf6d7ff TST: Added test for poisson regression 2015-09-07 22:03:28 -04:00
terrytangyuan
3a49e1bdb1 TST: Added more checks for testing custom objective 2015-09-07 21:56:50 -04:00
terrytangyuan
886955148d TST: Added test for models with custom objective 2015-09-07 21:55:17 -04:00
terrytangyuan
408c3a62a8 TST: Added test for xgb.plot.tree 2015-09-07 21:49:27 -04:00
terrytangyuan
d833038ba1 TST: Added test for xgb.importance 2015-09-07 21:48:57 -04:00
terrytangyuan
78afd6c772 TST: Added test for dump 2015-09-07 21:36:52 -04:00
Tianqi Chen
f025488294 Merge pull request #473 from evilmucedin/master
make XGBClassifier.score compatible with arrays
2015-09-06 21:18:12 -07:00
Den Raskovalov
35944a13b4 make XGBClassifier.score compatible with arrays 2015-09-06 20:41:55 -07:00
Tong He
6109a70a16 Merge pull request #471 from terrytangyuan/master
TST: Added R unit test for glm
2015-09-06 20:29:37 -07:00
Yuan Tang (Terry)
339a53d9d4 fixed unit test in R 2015-09-06 20:00:25 -04:00
Tianqi Chen
b3a3228a02 Merge pull request #469 from Far0n/patch-1
alpha & lambda for gbtree
2015-09-06 12:37:56 -07:00
terrytangyuan
92b996513e TST: Added R unit test for glm 2015-09-05 22:50:27 -04:00
Far0n
cfcb1fc491 default values for gbtree: lambda=1, alpha=0 2015-09-05 21:53:37 +02:00
Far0n
a9f884bd47 alpha = 1 as default value for gbtree 2015-09-05 21:50:53 +02:00
Far0n
dbc5c9b82d alpha & lambda for gbtree
alpha & lambda descriptions to "Parameters for Tree Booster" added (issue #466)
2015-09-05 12:36:42 +02:00
unknown
3d6c831e8a add error for data.frame, add weight to xgboost 2015-09-02 21:43:23 -07:00
Tianqi Chen
baa3145817 Merge pull request #461 from okaoka/fix-parameter-typo
Fix a typo in parameter.md
2015-08-29 10:02:40 -07:00
okaoka
632fdc3e19 Fix a typo 2015-08-29 19:45:11 +09:00
hetong007
57a43e9da7 Merge branch 'master' of github.com:dmlc/xgboost 2015-08-27 16:06:36 -07:00
hetong007
5773d4d3c4 fix test 2015-08-27 16:02:41 -07:00
hetong007
4554da0537 add test module in R 2015-08-27 15:56:35 -07:00
Tong He
635c39c4c3 Update README.md 2015-08-27 15:35:53 -07:00
hetong007
b0be833c75 add save_period 2015-08-27 14:30:23 -07:00
yanqingmen
34f0b313af Merge pull request #4 from dmlc/master
update
2015-08-26 16:32:05 +08:00
Tianqi Chen
c4fa2f6110 Update model.md 2015-08-23 22:46:50 -07:00
Tong He
f305cdbf75 align formula 2015-08-23 22:31:00 -07:00
tqchen
6bcf35f2e1 minor 2015-08-23 22:06:38 -07:00
tqchen
3c114262aa Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-08-23 22:04:24 -07:00
Tianqi Chen
b8330fc58a Merge pull request #456 from phunterlau/master
add platform if statement in setup.py for pip for pull #450 issue
2015-08-23 22:04:19 -07:00
tqchen
483a7d05e9 Merge branch 'master' of ssh://github.com/dmlc/xgboost
Conflicts:
	doc/index.md
	doc/model.md
2015-08-23 22:03:50 -07:00
tqchen
8c4c754a72 update 2015-08-23 22:00:41 -07:00
phunterlau
f4a5a8b6cd switch back to the original version info 2015-08-23 21:28:13 -07:00
phunterlau
bc6e2af374 add back setup.py after conflict resolving 2015-08-23 21:25:38 -07:00
phunterlau
6231e153e6 Merge branch 'dmlc-master' 2015-08-23 21:22:08 -07:00
phunterlau
2dcf263536 Merge branch 'master' of git://github.com/dmlc/xgboost into dmlc-master
Conflicts:
	python-package/setup.py
2015-08-23 21:20:31 -07:00
phunterlau
f258a68029 add platform if statement in setup.py for pip for pull #450 issuecomment-133795287 2015-08-23 20:38:26 -07:00
hetong007
7294ac4fc9 refine model doc 2015-08-23 17:04:08 -07:00
hetong007
cc3c98d9b7 fix formula 2015-08-23 16:59:29 -07:00
hetong007
30c30d3696 modify model doc 2015-08-23 16:56:57 -07:00
hetong007
5196458305 add plot 2015-08-23 16:28:24 -07:00
hetong007
d5d48560a7 add model description 2015-08-23 16:25:28 -07:00
Tianqi Chen
32009942fd Merge pull request #455 from sinhrks/py3
Python Visualization Fix for python 3
2015-08-23 14:29:33 -07:00
sinhrks
00702dc39b Fix for python 3 2015-08-24 05:09:27 +09:00
Tianqi Chen
8e06726f6b Merge pull request #454 from VGuette/master
Missing parentheses in call to 'print'  Thanks for the contribution!
2015-08-23 09:16:16 -07:00
VGuette
10273a0288 Update setup.py 2015-08-23 11:01:43 +02:00
Tianqi Chen
19eef1d0da Merge pull request #450 from phunterlau/master
add necessary configrations for pip installation
2015-08-20 18:45:30 -07:00
Tong He
07182444d2 Update README.md 2015-08-20 13:53:20 -07:00
phunterlau
5e81a210ce polish README.md with more information for PR #450 2015-08-20 12:33:28 -07:00
phunterlau
db444c4a08 update with comments on PR #450, fixed styles and updated CHANGES and CONTRIBUTORS 2015-08-20 10:10:34 -07:00
phunterlau
70e230815b add necessary configrations for pip installation 2015-08-20 01:26:17 -07:00
Tianqi Chen
4af680c3b6 Merge pull request #439 from sinhrks/pyviz
Add visualization to python package! great job
2015-08-15 09:48:49 -07:00
sinhrks
d24b36adf9 ENH: Add visualization to python package 2015-08-16 00:57:21 +09:00
Tianqi Chen
a13a3d1552 Merge pull request #443 from jdwittenauer/master
Cleaned up guide-python directory.
2015-08-13 18:07:42 -07:00
John Wittenauer
7a3676851d Cleaned up guide-python directory. 2015-08-13 20:32:47 -04:00
Tianqi Chen
a7202ee804 Merge pull request #438 from terrytangyuan/patch-1
fixed typos in basic_walkthrough demo
2015-08-10 22:45:24 -07:00
Yuan Tang
3dd40b9f37 fixed typos in basic_walkthrough demo 2015-08-10 20:35:10 -04:00
Tianqi Chen
18e1ddec3c Merge pull request #435 from terrytangyuan/typos
fixed some typos in demos comments
2015-08-09 19:51:32 -07:00
terrytangyuan
b3bffcef34 fixed some typos in demos comments 2015-08-09 22:15:02 -04:00
El Potaeto
740db8ff02 Merge remote-tracking branch 'dmlc/master' 2015-08-05 12:07:41 +02:00
Tianqi Chen
752cf4c95d Update xgboost_R.cpp 2015-08-04 22:56:16 -07:00
Tianqi Chen
b30aa96a88 Update xgboost_R.cpp 2015-08-04 20:14:58 -07:00
tqchen
0f6ad749f5 remove debug messages fix lint 2015-08-04 19:40:30 -07:00
Tianqi Chen
f42e4932fa Merge pull request #430 from EricChenDM/master
fix SetCombine and SetPrune bug
2015-08-04 19:36:42 -07:00
EricChanBD
3d38ebbef5 fix SetCombine and SetPrune bug 2015-08-05 06:19:54 +08:00
Tianqi Chen
889887c2f1 Update README.md 2015-08-03 19:37:33 -07:00
Tianqi Chen
7fe8b95833 Update README.md 2015-08-03 19:36:29 -07:00
Tianqi Chen
bd1eaa25f2 Merge pull request #424 from ajkl/patch-14
Adding dmlc stamp
2015-08-03 19:25:30 -07:00
Ajinkya Kale
81b1befd10 Adding dmlc stamp 2015-08-03 15:46:22 -07:00
muli
64dd1973b9 align logo with title 2015-08-03 12:59:28 -04:00
Tong He
bf94add992 Update faq.md 2015-08-02 19:09:33 -07:00
Tong He
f7bb8fc10f Update README.md 2015-08-02 19:04:32 -07:00
Tong He
014fa02c6a Update README.md 2015-08-02 19:03:44 -07:00
tqchen
e8de5da3a5 Document refactor
change badge
2015-08-02 19:01:38 -07:00
tqchen
c43fee541d enable basic sphinx doc 2015-08-01 11:27:13 -07:00
tqchen
8083c30e7b quick fix of solaris problem in cranc check 2015-08-01 09:18:34 -07:00
hetong007
3a091fa302 modify desc 2015-07-31 21:33:54 +00:00
Tianqi Chen
2a01c5c865 Update CONTRIBUTORS.md 2015-07-30 22:26:10 -07:00
Tianqi Chen
362fe4e4fa Update .travis.yml 2015-07-30 22:11:27 -07:00
tqchen
60217a2c02 checkin all python 2015-07-30 22:08:48 -07:00
tqchen
c2fec29bfa python package refactor into python-package 2015-07-30 22:04:45 -07:00
Tianqi Chen
f6fed76e7e not working 2015-07-29 23:24:54 -07:00
Tianqi Chen
7560518eec sleep 2015-07-29 23:23:40 -07:00
Tianqi Chen
53107995bf give up for now 2015-07-29 22:54:21 -07:00
Tianqi Chen
264c636adf add dep 2015-07-29 22:50:23 -07:00
Tianqi Chen
f9c02aa40f final attempt 2015-07-29 22:45:28 -07:00
Tianqi Chen
11f27beccd checkin debug 2015-07-29 22:41:06 -07:00
Tianqi Chen
ebdcd94bf5 Merge pull request #418 from dmlc/travis
Travis OSX support and unfinished appveyor
2015-07-29 22:36:24 -07:00
tqchen
4a6f4eaac9 giveup for now, appveyor do not support openmp for msvc yet allow openmp to switch on 2015-07-29 22:31:35 -07:00
tqchen
ebefb78fd4 use debug 2015-07-29 22:26:21 -07:00
tqchen
73ec467dd3 final 2015-07-29 22:22:43 -07:00
tqchen
0a9c8acd6d final 2015-07-29 22:17:25 -07:00
tqchen
6f01fa50ce try disable omp 2015-07-29 22:14:38 -07:00
tqchen
67d332e0f5 ok 2015-07-29 22:01:42 -07:00
tqchen
5dab410537 ok 2015-07-29 22:00:38 -07:00
tqchen
259dea0777 incomplete appveyor 2015-07-29 21:46:41 -07:00
tqchen
e30c724bd4 ok 2015-07-29 21:39:34 -07:00
tqchen
6f4148faab ok 2015-07-29 21:37:16 -07:00
tqchen
7e16606618 ok 2015-07-29 21:36:28 -07:00
tqchen
c2c5ad2d47 finl 2015-07-29 21:35:15 -07:00
tqchen
1a91b15a6e ok 2015-07-29 21:27:40 -07:00
tqchen
bb13c2cd15 ok 2015-07-29 21:25:52 -07:00
tqchen
033a0c139e ok 2015-07-29 21:21:58 -07:00
tqchen
0d5741bc74 rest 2015-07-29 21:21:15 -07:00
tqchen
899bfbfbae rest 2015-07-29 21:19:49 -07:00
tqchen
2bf0eeb82d update appvegor 2015-07-29 21:15:25 -07:00
tqchen
c870c08b7e disable openmp in dmlc 2015-07-29 21:11:44 -07:00
tqchen
fa41fe3f13 rename 2015-07-29 21:09:42 -07:00
tqchen
8f6e5e197b ok 2015-07-29 21:07:18 -07:00
tqchen
15286523cf ok 2015-07-29 21:06:29 -07:00
tqchen
d9599f816f add appvegor 2015-07-29 21:01:53 -07:00
tqchen
6062f4dd58 update 2015-07-29 20:18:54 -07:00
tqchen
24a188588a ok 2015-07-29 20:10:29 -07:00
tqchen
2ab6907fe2 add os lrt 2015-07-29 18:45:42 -07:00
tqchen
f44511e94d fix mac build 2015-07-29 18:29:06 -07:00
tqchen
26675e6dcd Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-07-29 18:24:27 -07:00
tqchen
75c8bdf962 add osx matrix 2015-07-29 18:24:19 -07:00
Tong He
efde0eb171 enable travis on os x 2015-07-29 18:16:59 -07:00
Tong He
f4a47fa78e Merge pull request #414 from ajkl/patch-12
Fixing duplicate params in demo
2015-07-29 17:58:21 -07:00
tqchen
5f9f42292c fix sklearn best score 2015-07-29 17:49:55 -07:00
Tianqi Chen
c261b3d1f5 Merge pull request #416 from ajkl/patch-13
add setuptools info
2015-07-29 17:38:58 -07:00
Ajinkya Kale
cca955fc94 add setuptools info 2015-07-29 16:20:55 -07:00
Ajinkya Kale
0c8c231949 Fixing duplicate params in demo
Issue in "demo(package="xgboost", custom_objective)"

> bst <- xgb.train(param, dtrain, num_round, watchlist, 
+                  objective=logregobj, eval_metric=evalerror)
Error in xgb.train(param, dtrain, num_round, watchlist, objective = logregobj,  : 
  Duplicated term in parameters. Please check your list of params.
2015-07-29 14:28:34 -07:00
Tianqi Chen
d485d1849f Merge pull request #409 from ajkl/patch-11
fixing broken basic_walkthrough links
2015-07-26 21:23:12 -07:00
Ajinkya Kale
74055cc15e fixing broken basic_walkthrough links 2015-07-26 21:22:35 -07:00
Tianqi Chen
195f90159d Merge pull request #408 from ajkl/patch-10
restructuring the README with an index
2015-07-26 21:14:48 -07:00
Ajinkya Kale
fc27e2f32d adding DMLC back to the title 2015-07-26 20:31:51 -07:00
Ajinkya Kale
f2eb55683c some more links and restructuring 2015-07-26 20:30:59 -07:00
Ajinkya Kale
9a936721d8 dropping raw graphlab url 2015-07-26 20:12:51 -07:00
Tianqi Chen
eee0d5b065 Merge pull request #327 from jseabold/sklearn-eval-set
ENH: Allow early stopping through scikit-learn API
2015-07-26 11:58:45 -07:00
Tianqi Chen
b1dec917c7 Update page_fmatrix-inl.hpp 2015-07-25 21:29:46 -07:00
tqchen
0dbac3d11e fix travis 2015-07-25 21:23:40 -07:00
tqchen
f6c82d52ec make solaris happy 2015-07-25 21:17:28 -07:00
tqchen
af042f6a24 make things cxx98 compatible 2015-07-25 21:14:50 -07:00
Ajinkya Kale
cbdcbfc49c some more changes to remove redundant information 2015-07-25 12:46:28 -07:00
Ajinkya Kale
e353a2e51c restructuring the README with an index 2015-07-24 17:00:02 -07:00
hetong007
a1c7104d7f fix crash 2015-07-24 19:11:08 +00:00
unknown
198c5bb55e fix namespace and desc 2015-07-24 11:58:02 -07:00
Tianqi Chen
141f9ebf4b Update CHANGES.md 2015-07-24 08:51:05 -07:00
Michaël Benesty
f29c2f8796 Merge pull request #404 from ajkl/patch-8
moving gitter chat up
2015-07-23 15:06:55 +02:00
Michaël Benesty
5e07367979 Merge pull request #405 from ajkl/patch-9
Add license to readme
2015-07-23 10:34:45 +02:00
Ajinkya Kale
0ea5b14bd8 Update README.md 2015-07-23 01:12:33 -07:00
Ajinkya Kale
9eca9bccf4 moving gitter chat up 2015-07-22 23:18:34 -07:00
pommedeterresautee
951ba267cf move plot file 2015-07-22 23:50:54 +02:00
Michaël Benesty
1fb5c127b5 Merge pull request #399 from orenov/master
issue #368, data.table problems
2015-07-22 21:21:34 +02:00
Michaël Benesty
4a71b0ec19 Merge pull request #402 from wgstanton/patch-2
Fixed a few typos in README
2015-07-22 18:44:30 +02:00
Will Stanton
ba63b2886f Check out vs. checkout
Made it consistent across the README
2015-07-22 10:37:49 -06:00
Will Stanton
d120167725 Fixed a few typos in README 2015-07-22 09:19:22 -06:00
El Potaeto
031b34b121 Merge remote-tracking branch 'dmlc/master' 2015-07-22 13:30:38 +02:00
orenov
d8fc16538e issue #368, data.table problems 2015-07-22 12:03:01 +03:00
Tianqi Chen
80b6ec4478 update more contributor names 2015-07-21 21:31:39 -07:00
Tianqi Chen
9203d26a2f Update CONTRIBUTORS.md 2015-07-21 08:13:07 -07:00
Tianqi Chen
4cf116ceb6 Update CONTRIBUTORS.md 2015-07-20 22:58:10 -07:00
Tianqi Chen
41f30c288e Update CONTRIBUTORS.md 2015-07-20 22:56:29 -07:00
tqchen
b18c7f9466 ok 2015-07-20 22:50:59 -07:00
tqchen
d18492e751 add list of contributors 2015-07-20 22:48:45 -07:00
El Potaeto
86f9f707d8 Merge remote-tracking branch 'dmlc/master' 2015-07-15 16:00:21 +02:00
El Potaeto
0dfc443252 New projection of all trees on one 2015-07-15 15:59:36 +02:00
Tianqi Chen
71cd9b9000 Merge pull request #393 from jpata/wrapper-dict-fix
fix wrapper dict issue #392 thanks! merged
2015-07-14 08:53:37 -07:00
Joosep
be95c80aa2 fix wrapper dict 2015-07-14 11:38:38 +02:00
Tianqi Chen
b7f355fdd2 Update travis_after_failure.sh 2015-07-12 11:00:52 -07:00
Tianqi Chen
4a746be43a Update build.md 2015-07-12 10:36:16 -07:00
Tianqi Chen
44f839b896 Update README.md 2015-07-12 10:31:55 -07:00
Tianqi Chen
35638f6146 Update README.md 2015-07-12 10:27:58 -07:00
Tianqi Chen
e402d20876 Update README.md 2015-07-10 20:41:20 -07:00
Tianqi Chen
dabb36c006 Update README.md 2015-07-10 20:41:00 -07:00
Skipper Seabold
b76db01c66 STY: Fix lint errors 2015-07-08 14:29:52 -05:00
Skipper Seabold
4a37b852a0 DOC: Add early stopping example 2015-07-08 13:55:47 -05:00
Skipper Seabold
b0f7ddaa2e REF: Combine eval_metric and feval to one parameter 2015-07-08 13:55:47 -05:00
Skipper Seabold
113285e1dc DOC: Point to parameter.md for eval_metric 2015-07-08 13:55:47 -05:00
Skipper Seabold
46e9520a28 DOC: Document verbose_eval 2015-07-08 13:55:47 -05:00
Skipper Seabold
cf89ae64e2 ENH: Allow for silent evaluation 2015-07-08 13:55:47 -05:00
Skipper Seabold
3952b525b8 ENH: Allow possibly negative evaluation metrics. 2015-07-08 11:10:36 -05:00
Skipper Seabold
0f5f9c0385 ENH: Allow early stopping in sklearn API. 2015-07-08 11:10:36 -05:00
Tianqi Chen
167544d792 Merge pull request #382 from ajkl/patch-6
refs and formatting changes
2015-07-07 19:32:52 -07:00
Tianqi Chen
1fee7da16f Merge pull request #384 from ajkl/patch-7
need to load vcd if it was freshly installed
2015-07-07 19:32:28 -07:00
Tianqi Chen
048d6929f4 Merge pull request #375 from yanqingmen/java_wrapper
good job! merged
2015-07-07 19:31:54 -07:00
Ajinkya Kale
57e4f4d426 need to load vcd if it was freshly installed 2015-07-07 17:36:18 -07:00
yanqingmen
969ea57159 Update travis_java_script.sh
add "set -e"
2015-07-07 17:28:45 -07:00
Ajinkya Kale
c489ce62b2 refs and formatting changes 2015-07-07 16:36:45 -07:00
yanqingmen
fc75885e9e add travis-ci script for java wrapper 2015-07-07 19:22:51 +08:00
Tianqi Chen
28f8267563 Update README.md 2015-07-06 22:45:27 -07:00
Tianqi Chen
9ec4c43dd2 Update README.md 2015-07-06 22:44:59 -07:00
Tianqi Chen
46342d4633 checkin 2015-07-06 20:07:04 -07:00
Tianqi Chen
fd26f45208 Merge pull request #377 from ajkl/patch-3
Adding some details on nthread parameter
2015-07-06 19:58:44 -07:00
Tianqi Chen
13aff0d8cd Merge pull request #378 from ajkl/patch-4
Adding workaround for install the R-package
2015-07-06 19:55:25 -07:00
Tianqi Chen
af76bbb3f3 Merge pull request #379 from ajkl/patch-5
Adding examples on xgb.importance, xgb.plot.importance and xgb.plot tree
2015-07-06 19:55:06 -07:00
yanqingmen
0fc47f5abb add testcases 2015-07-06 18:50:46 -07:00
yanqingmen
4d382a8cc1 rename xgboosterror 2015-07-06 17:55:13 -07:00
Ajinkya Kale
364abdd6d1 Adding examples on xgb.importance, xgb.plot.importance and xgb.plot tree 2015-07-06 16:45:30 -07:00
Ajinkya Kale
761ab7c834 Adding workaround for install the R-package
I was facing this issue and this workaround worked for me. Maybe this should be moved to know issues section.
2015-07-06 14:52:38 -07:00
Ajinkya Kale
b1bcb7183b Adding some details on nthread parameter
I got this information about nthread='real cpu count' from 7cb449c4a7/java/xgboost4j-demo/src/main/java/org/dmlc/xgboost4j/demo/ExternalMemory.java (L50)
Please confirm if this note is still valid before merging this change!
2015-07-06 11:02:19 -07:00
yanqingmen
e99ab0d1dd minor fix 2015-07-06 20:56:17 +08:00
yanqingmen
f73bcd427d update java wrapper for new fault handle API 2015-07-06 02:32:58 -07:00
yanqingmen
7755c00721 Merge pull request #2 from dmlc/master
pr from origin:master
2015-07-06 09:00:42 +08:00
tqchen
a735f8cb76 quick patch threadlocal 2015-07-04 18:29:42 -07:00
tqchen
cc767add88 API refactor to make fault handling easy 2015-07-04 18:12:44 -07:00
Tianqi Chen
4d436a3cb0 Update README.md 2015-07-03 21:59:40 -07:00
Tianqi Chen
53a18635ee Merge pull request #371 from ajkl/patch-2
fixing some typos
2015-07-03 21:42:54 -07:00
tqchen
f0421e9455 last check 2015-07-03 21:27:29 -07:00
tqchen
93319841ed ok 2015-07-03 21:20:56 -07:00
tqchen
ccf21ec061 add scipy dep 2015-07-03 21:15:10 -07:00
tqchen
39913d6ee8 add scipy dep 2015-07-03 21:14:49 -07:00
tqchen
fe3464b763 update script 2015-07-03 21:11:01 -07:00
tqchen
af0a451dc4 refactor and ci 2015-07-03 21:08:36 -07:00
tqchen
59b91cf205 make python lint 2015-07-03 20:36:41 -07:00
tqchen
57ec922214 fix all cpp lint 2015-07-03 19:42:44 -07:00
tqchen
1123253f79 lint all 2015-07-03 19:35:23 -07:00
tqchen
aba41d07cd lint learner finish 2015-07-03 19:20:45 -07:00
tqchen
1581de08da fix all utils 2015-07-03 18:44:01 -07:00
tqchen
0162bb7034 lint half way 2015-07-03 18:31:52 -07:00
Ajinkya Kale
c70a73f38d fixing some typos 2015-07-01 22:35:41 -07:00
Tong He
2ed40523ab Merge pull request #369 from ajkl/patch-1
Some typo and formatting fixes
2015-07-01 13:05:31 -07:00
Ajinkya Kale
009f692f49 Some typo and formatting fixes 2015-07-01 12:12:47 -07:00
Tong He
48e19c1964 Update xgb.cv.R 2015-06-22 12:42:12 -07:00
Tong He
704d9e0a13 fix early stopping and prediction 2015-06-21 19:46:31 -07:00
Tong He
6b254ec495 Update Makefile 2015-06-21 19:25:09 -07:00
tqchen
561e51871e ok 2015-06-17 21:00:34 -07:00
Tong He
777c5ce992 temporarily do not compile vignette 2015-06-16 15:08:01 -07:00
Tong He
70c5c12067 update knitr dependency 2015-06-16 14:39:04 -07:00
Tong He
1595d36721 ask travis to compile vignette 2015-06-16 14:22:51 -07:00
pommedeterresautee
37714eb331 Merge branch 'master' of https://github.com/pommedeterresautee/xgboost 2015-06-16 21:40:09 +02:00
pommedeterresautee
ad2e93f6c5 multi tree update 2015-06-16 21:39:31 +02:00
pommedeterresautee
936190c17c slight update in documentation 2015-06-16 21:38:14 +02:00
hetong007
9987fb24f8 update makefile 2015-06-16 11:43:04 -07:00
hetong007
67f0b69a4c change makefile to be compatible with r-travis 2015-06-16 11:30:11 -07:00
Tong He
5568f83a6c Update .travis.yml 2015-06-15 22:40:15 -07:00
Tong He
b08c3c5baa Update .travis.yml 2015-06-15 22:16:11 -07:00
Tong He
7d9ac3f97d Update .travis.yml 2015-06-15 19:15:34 -07:00
hetong007
0bbb4a07b2 add travis conf, waiting for setting on travis-ci.org 2015-06-15 15:25:40 -07:00
tqchen
7a92d4008e fix col from dense 2015-06-15 09:24:10 -07:00
hetong007
c51d71b033 check duplicated params 2015-06-12 16:48:01 -07:00
Tong He
7cb449c4a7 Update xgb.cv.R 2015-06-11 14:16:20 -07:00
Tong He
61142f203b check whether objective is character 2015-06-11 14:04:43 -07:00
Tianqi Chen
fbaa3821a4 Merge pull request #351 from yanqingmen/java_wrapper
Java wrapper for xgboost
2015-06-11 09:02:32 -07:00
yanqingmen
4e8a1c6516 rm WatchList class, take Iterable<Entry<String, DMatrix>> as eval param, change Params to Iterable<Entry<String, Object>> 2015-06-10 23:34:52 -07:00
yanqingmen
8c5d3ac130 Merge branch 'java_wrapper' of https://github.com/yanqingmen/xgboost into java_wrapper 2015-06-10 20:11:11 -07:00
yanqingmen
c110111f52 make some fix 2015-06-10 20:09:49 -07:00
yanqingmen
1e03be4e08 Update Makefile 2015-06-09 23:30:00 -07:00
yanqingmen
f91a098770 add java wrapper 2015-06-09 23:14:50 -07:00
yanqingmen
fcca359774 Merge pull request #1 from dmlc/master
pull from dmlc
2015-06-10 09:09:42 +08:00
Tianqi Chen
00a8076deb Merge pull request #350 from jeremyatia/patch-1
Update understandingXGBoostModel.Rmd
2015-06-08 16:36:40 -07:00
Jeremy ATIA
a6abdccf01 Update understandingXGBoostModel.Rmd
a typo for the dimension of the test set
2015-06-08 23:31:12 +02:00
El Potaeto
ab219d3331 Merge remote-tracking branch 'dmlc/master' 2015-06-03 11:18:45 +02:00
tqchen
2937f5eebc io part refactor 2015-06-02 23:18:31 -07:00
tqchen
e5dd894960 add a indicator opt 2015-06-02 11:38:06 -07:00
Tong He
bc7f6b37b0 Update README.md 2015-05-30 17:39:19 -07:00
hetong007
36031d9a36 modify script to use objective and eval_metric 2015-05-30 15:48:57 -07:00
Tong He
27e4cbb215 Merge pull request #337 from jonrobinson2/patch-1
Update xgboostPresentation.Rmd
2015-05-28 09:32:32 -07:00
Tong He
f9ae83e951 Update xgb.cv.R 2015-05-28 09:30:23 -07:00
Jonathan Robinson
a55f4d3416 Update xgboostPresentation.Rmd
Edited to note unavailability of stable version of this package on CRAN.

http://cran.r-project.org/web/packages/xgboost/index.html
2015-05-28 09:45:46 -04:00
hetong007
733d23aef8 rename arguments to be dot-seperated 2015-05-25 11:51:01 -07:00
hetong007
8d3a7e1688 change doc and demo for new obj feval interface 2015-05-25 11:30:04 -07:00
hetong007
19b24cf978 customized obj and feval interface 2015-05-25 11:19:38 -07:00
Tong He
458585b5fd Update xgb.train.R 2015-05-25 10:24:59 -07:00
Tianqi Chen
1d57cfb7bd Update xgboost.py 2015-05-22 13:27:08 -07:00
Tianqi Chen
bc7241b2a4 Update README.md 2015-05-21 13:44:21 -07:00
Tianqi Chen
7d132aefa9 Update LICENSE 2015-05-21 13:01:15 -07:00
Tianqi Chen
a31aaa410c Update parameter.md 2015-05-20 17:27:15 -07:00
Tianqi Chen
da5e62773d Merge pull request #328 from drsaltiel/patch-1
Update parameter.md to include parameter ranges
2015-05-20 17:26:00 -07:00
Daniel Saltiel
b1c79323af Update parameter.md to include parameter ranges
only updated for tree booster parameters
2015-05-20 17:13:20 -07:00
Tianqi Chen
c82101ef16 Merge pull request #324 from jseabold/allow-zero-as-missing
ENH: Allow missing = 0
2015-05-18 18:54:17 +02:00
Skipper Seabold
978216d350 ENH: Allow missing = 0 2015-05-18 11:43:58 -05:00
Tianqi Chen
0c6bfa74b5 Merge pull request #315 from jseabold/sklearn-handle-missing
ENH: Allow settable missing value in sklearn api.
2015-05-18 17:00:53 +02:00
Tianqi Chen
01175a415a Merge pull request #323 from jseabold/fix-errors
BUG: XGBError -> XGBoostError
2015-05-18 17:00:08 +02:00
Skipper Seabold
a17cb2339e BUG: XGBError -> XGBoostError 2015-05-18 09:09:22 -05:00
Skipper Seabold
0a0a80ec72 ENH: Allow settable missing value in sklearn api. 2015-05-18 09:06:09 -05:00
tqchen
91a5390929 checkin copy 2015-05-17 21:29:51 -07:00
pommedeterresautee
1ea7f6f033 fix bug 2015-05-17 20:37:15 +02:00
pommedeterresautee
947afd7eac multi trees 2015-05-17 15:16:28 +02:00
tqchen
e6b8b23a2c allow booster to be pickable, add copy function 2015-05-16 12:59:55 -07:00
tqchen
39f1da08d2 Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-05-15 23:54:40 -07:00
tqchen
09a841f810 auto turn on optimization 2015-05-15 23:54:34 -07:00
tqchen
792cff5abc checkin some micro optimization 2015-05-15 23:54:03 -07:00
Tianqi Chen
f49525ee95 Merge pull request #319 from jdwittenauer/master
Add classes_ attribute to scikit-learn wrapper
2015-05-15 22:03:18 -07:00
John Wittenauer
4e080928a8 Added classes_ attribute to scikit-learn wrapper. 2015-05-15 21:19:39 -04:00
Tianqi Chen
9c52fc8e22 Merge pull request #314 from enizhibitsky/wrapper_stopping_fix
Fix early stopping in python wrapper
2015-05-14 16:16:47 -07:00
Tianqi Chen
019ab50994 Merge pull request #313 from alexchao56/master
Updated grammar for the README.md
2015-05-14 16:16:13 -07:00
Eugene Nizhibitsky
b63868327f Fix early stopping in python wrapper 2015-05-14 22:55:49 +03:00
Alex Chao
e080c663a8 Updated grammar for the README.md 2015-05-14 11:57:50 -07:00
tqchen
3a7808dc7d remove print 2015-05-13 23:34:09 -07:00
Tianqi Chen
49ad633530 Update xgboost.py 2015-05-13 23:15:19 -07:00
Tong He
e03ef41829 Merge pull request #312 from by321/master
xgb.cv( printEveryN ) parameter to print every n-th progress message
2015-05-13 22:18:47 -07:00
by321
a4341f22a2 xgb.csv(printEveryN) parameter to print every n-th progress message 2015-05-13 21:51:05 -07:00
tqchen
b8b0243d95 Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-05-12 20:21:00 -07:00
tqchen
62801f5343 allow fpic 2015-05-12 20:20:30 -07:00
Tianqi Chen
cb4d7f821f Update README.md 2015-05-11 23:44:02 -07:00
tqchen
42bf52f462 0.4 2015-05-11 23:42:49 -07:00
hetong
755eab8949 update date 2015-05-11 20:58:41 -07:00
hetong
c05cc48dfa delete abundant file 2015-05-11 20:55:09 -07:00
hetong007
cfdd6029a8 rename demo of early stopping 2015-05-11 16:59:18 -07:00
Tong He
d7da4189dc Merge pull request #296 from by321/master
new parameter in xgboost() and xgb.train() to print every N-th progress message
2015-05-11 16:55:14 -07:00
hetong007
90096e718c fix early stopping 2015-05-11 16:53:51 -07:00
hetong007
83ace55f51 add early stopping to xgb.cv 2015-05-11 16:03:40 -07:00
hetong007
60d307c445 add poisson demo 2015-05-11 15:21:54 -07:00
by321
5dacab0e22 new parameter in xgboost() and xgb.train() to print every N-th progress message 2015-05-11 14:18:24 -07:00
Tianqi Chen
9c0ba67088 Update README.md 2015-05-11 08:45:59 -07:00
Tianqi Chen
8b9e87790a Merge pull request #299 from jseabold/pickle-xgbooster
ENH: Pickle xgbooster enhancments. Thanks!
2015-05-11 08:44:36 -07:00
Skipper Seabold
15ea00540a EX: Make separate example for fork issue. 2015-05-11 09:30:51 -05:00
Skipper Seabold
fa8c6e2f0b DOC: Add warning about fork + openmp 2015-05-11 09:09:08 -05:00
Skipper Seabold
99c2df9913 EX: Show example of pickling and parallel use. 2015-05-11 09:09:08 -05:00
Skipper Seabold
932af821c5 CLN: Remove unused import. Fix comment. 2015-05-11 09:09:05 -05:00
Tianqi Chen
08848ab3ee Update README.md 2015-05-10 17:45:20 -07:00
Tianqi Chen
6f56e0f4ef Merge pull request #307 from pommedeterresautee/master
cleaning Rmarkdown
2015-05-10 08:51:42 -07:00
El Potaeto
3104f1f806 wording + presentation Otto rmarkdown 2015-05-10 09:39:21 +02:00
El Potaeto
cebca6846d ref in README 2015-05-10 09:38:48 +02:00
hetong007
d3564f34d5 Merge branch 'master' of github.com:dmlc/xgboost 2015-05-09 18:09:05 -07:00
hetong007
3f9921762a support both early stop name 2015-05-09 18:08:47 -07:00
tqchen
3a534d264d fix wrapper gc bug 2015-05-09 17:39:45 -07:00
tqchen
9a85c108e2 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2015-05-09 17:39:11 -07:00
Tong He
f6fc38f7af Merge pull request #298 from pommedeterresautee/master
Documentation improvement
2015-05-08 15:15:56 -07:00
pommedeterresautee
11ba651a07 Regularization parameters documentation improvement 2015-05-08 16:59:29 +02:00
pommedeterresautee
e92d384a6a small change in the wording of Otto R markdown 2015-05-08 16:29:29 +02:00
tqchen
a4de0ebcd4 change numpy to bytearray as buffer 2015-05-07 18:21:15 -07:00
tqchen
6942980ebb Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-05-07 18:13:29 -07:00
tqchen
68444a0626 fix pkl problem 2015-05-07 18:11:40 -07:00
Tianqi Chen
0af5cfbac3 Merge pull request #291 from pommedeterresautee/master
Rmarkdown improvement
2015-05-07 10:28:40 -07:00
Tianqi Chen
c6c7dc0a93 Update CHANGES.md 2015-05-06 17:11:39 -07:00
Tianqi Chen
2d748fb6fa Update xgboost.py 2015-05-06 16:46:27 -07:00
tqchen
60bf389825 update version to be consistent with python 2015-05-06 16:45:05 -07:00
tqchen
594bed34e4 fix saveraw 2015-05-06 16:42:27 -07:00
tqchen
382dcf6c34 Merge branch 'jseabold-xgb-pickleable' 2015-05-06 16:08:51 -07:00
tqchen
62f938d2b4 Merge branch 'xgb-pickleable' of https://github.com/jseabold/xgboost into jseabold-xgb-pickleable 2015-05-06 16:08:48 -07:00
tqchen
3244f1e9ae Merge branch 'jseabold-xgb-pickleable' 2015-05-06 16:03:36 -07:00
tqchen
76bad1c4cc Merge branch 'xgb-pickleable' of https://github.com/jseabold/xgboost into jseabold-xgb-pickleable 2015-05-06 16:03:24 -07:00
Tong He
ba49f82ace update to 0.4 2015-05-06 15:46:15 -07:00
tqchen
ab6a3b1ee8 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2015-05-06 15:43:22 -07:00
tqchen
7f7947f31c add with pbuffer info to model, allow xgb model to be saved in a more memory compact way 2015-05-06 15:43:15 -07:00
hetong007
993d7b9da3 update roxygen2 2015-05-06 15:23:37 -07:00
hetong007
419e4dbda6 add demo for early_stopping in R 2015-05-06 15:14:29 -07:00
El Potaeto
fd983dfb97 wording 2015-05-07 00:08:45 +02:00
El Potaeto
a985d7dd2b add CSS 2015-05-06 23:31:00 +02:00
Skipper Seabold
13837060f1 ENH: Don't use tempfiles for save/load 2015-05-06 15:02:26 -05:00
Skipper Seabold
11fa419720 ENH: Make XGBModel pickleable. 2015-05-06 12:37:07 -05:00
hetong007
0f182b0b66 fix logic 2015-05-05 16:44:36 -07:00
hetong007
54fb49ee5c add early stopping to R 2015-05-05 16:31:49 -07:00
Tong He
3b4697786e Merge pull request #288 from pommedeterresautee/master
small changes in RMarkdown
2015-05-05 14:58:56 -07:00
El Potaeto
8aa739d374 fix 2015-05-05 23:49:12 +02:00
El Potaeto
5eeec6a33f small changes in RMarkdown 2015-05-05 23:45:43 +02:00
Tong He
937a75bcb1 fix typo 2015-05-05 11:00:49 -07:00
Tong He
c242f9bb66 improve tree graph 2015-05-04 15:25:12 -07:00
Tianqi Chen
a3ad9df0b4 Update understandingXGBoostModel.Rmd 2015-05-04 14:27:44 -07:00
Tong He
2157146cea minor changes 2015-05-04 13:56:45 -07:00
Tianqi Chen
206f3cdbe0 msvc 2015-05-04 11:13:19 -07:00
Tianqi Chen
37d704826a Update parameter.md 2015-05-04 10:51:51 -07:00
tqchen
667a752e04 add poisson regression 2015-05-04 10:48:25 -07:00
tqchen
a310db86a1 new rmarkdown 2015-05-03 14:02:15 -07:00
tqchen
32b1d9d6b0 some minor fix 2015-05-03 13:59:38 -07:00
Tianqi Chen
a8d059902d Merge pull request #283 from pommedeterresautee/master
OTTO Rmarkdown
2015-05-03 09:09:49 -07:00
El Potaeto
1b95df4e54 parameter change in OTTO ramarkdown 2015-05-03 12:57:18 +02:00
El Potaeto
5fa2abee6e wording 2015-05-03 12:55:13 +02:00
El Potaeto
feac425851 trees 2015-05-03 12:52:43 +02:00
El Potaeto
514c5fd447 upgrade DiagrammeR to fix a bug in v 0.5 2015-05-03 12:18:44 +02:00
Tianqi Chen
5b430ee019 Update xgboost.py 2015-05-02 19:29:17 -07:00
Tianqi Chen
8c59c82d92 Merge pull request #282 from ujwlkarn/patch-1
Fixed typos and sentence structure
2015-05-02 09:07:14 -07:00
Ujjwal Karn
897180b2c6 fixed typos and sentence structure 2015-05-02 14:23:33 +05:30
Tianqi Chen
b1f489fd8b Merge pull request #281 from fyears/patch-2
update build instruction in OS X
2015-05-01 23:00:00 -07:00
fyears
5e89943ed0 update build instruction in OS X
`bash xgboost/build.sh` does not work as expected, so `cd` then `build.sh`. And remove the outdated information.
2015-05-01 22:58:53 -07:00
tqchen
5466b36ddb Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-05-01 22:46:22 -07:00
tqchen
7258f3353c Squashed 'subtree/rabit/' changes from 24f17df..fa99857
fa99857 try fix warning on some platforms

git-subtree-dir: subtree/rabit
git-subtree-split: fa99857467
2015-05-01 22:46:14 -07:00
tqchen
7297c2352f Merge commit '7258f3353c8cc3ee3dd3c00c987fa0b189e58723' 2015-05-01 22:46:14 -07:00
tqchen
869c68f149 minor 2015-05-01 22:46:06 -07:00
Tianqi Chen
90b2c0946e Merge pull request #280 from fyears/patch-1
The complete ways to install XGBoost in OS X.
2015-05-01 20:41:58 -07:00
fyears
99eaf771c4 The complete ways to install XGBoost in OS X. 2015-05-01 20:33:38 -07:00
Tianqi Chen
fe32725fa0 Update README.md 2015-05-01 15:58:51 -07:00
Tong He
4ff6697d83 Merge pull request #278 from khotilov/custom_loss_cv_fix
Improved logic in stratified CV
2015-05-01 14:46:05 -07:00
Vadim Khotilovich
c18e081f48 cleanup 2015-05-01 16:16:50 -05:00
Vadim Khotilovich
f05c7d87cb Merge remote branch 'src/master' into custom_loss_cv_fix 2015-05-01 15:42:50 -05:00
Vadim Khotilovich
0a3e7722fd a safeguard against someone using automatic folds creation with ranking 2015-05-01 15:16:30 -05:00
Vadim Khotilovich
f325930bd9 Improved logic in stratified CV to guess class/regr
Somewhat more robust and clear logic in stratified CV to guess classification/regression settings. Allows to accomodate custom objectives (classification is assumed when number of unique values in labels <= 5).
2015-05-01 15:08:08 -05:00
tqchen
2b3b55554f add parameter tunning 2015-05-01 11:41:18 -07:00
tqchen
6f0cbcaf2b add build instruction to doc 2015-05-01 11:12:43 -07:00
Tianqi Chen
8a411150ea Update sparse_batch_page.h 2015-05-01 10:55:42 -07:00
El Potaeto
d74d199a1e small change in the documentation 2015-05-01 13:03:15 +02:00
El Potaeto
962837bab7 OTTO markdown improvement 2015-05-01 13:02:43 +02:00
El Potaeto
52afe1cd7e OTTO markdown 2015-05-01 09:49:04 +02:00
El Potaeto
9f3b02cc3e multiclass documentation 2015-05-01 09:48:07 +02:00
El Potaeto
d860469030 Roxygen update 2015-05-01 09:47:18 +02:00
Tianqi Chen
654aa0b3b5 Update README.md 2015-04-30 15:45:41 -07:00
Tianqi Chen
68d9e7d673 Update README.md 2015-04-30 15:44:27 -07:00
Tong He
bab7b58d94 Merge pull request #227 from khotilov/master
add stratified cross validation for classification
2015-04-30 11:39:52 -07:00
tqchen
188d81d64a Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-04-29 20:25:06 -07:00
tqchen
c77fa7a670 Squashed 'subtree/rabit/' changes from 4fe8d1d..24f17df
24f17df ok

git-subtree-dir: subtree/rabit
git-subtree-split: 24f17df782
2015-04-29 20:23:56 -07:00
tqchen
b2bd79bc76 Merge commit 'c77fa7a670133ac40d6387cc2e958d5fc7cae8c4' 2015-04-29 20:23:56 -07:00
tqchen
18164e677a Squashed 'subtree/rabit/' changes from d1d2ab4..4fe8d1d
4fe8d1d ok io
a5d77ca checkin new dmlc interface

git-subtree-dir: subtree/rabit
git-subtree-split: 4fe8d1d66b
2015-04-29 20:22:11 -07:00
tqchen
32a7c906b4 Merge commit '18164e677af11f8d8be49c3cfb8c3960b9e800fa' 2015-04-29 20:22:11 -07:00
Tianqi Chen
d7846d0ef9 Update README.md 2015-04-28 19:14:32 -07:00
Tianqi Chen
0c7e6327fb Update README.md 2015-04-28 19:13:13 -07:00
Tianqi Chen
d4fcebf8c5 Merge pull request #274 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
2015-04-28 19:12:20 -07:00
The Gitter Badger
7b730093a0 Added Gitter badge 2015-04-29 02:11:32 +00:00
Tong He
0de862cdbc Merge pull request #271 from pommedeterresautee/master
Suppress a Note in Cran check
2015-04-28 15:36:33 -07:00
tqchen
afe0a552e0 Squashed 'subtree/rabit/' changes from e1ddcc2..d1d2ab4
d1d2ab4 remove at end

git-subtree-dir: subtree/rabit
git-subtree-split: d1d2ab4599
2015-04-28 10:50:54 -07:00
tqchen
55fe810232 Merge commit 'afe0a552e0689c14c875a0da445e6e417f4ac449' 2015-04-28 10:50:54 -07:00
El Potaeto
0c8b6e2008 Suppress a Note in Cran check 2015-04-28 15:23:23 +02:00
tqchen
e63faf0e85 minor shadow fix 2015-04-27 22:52:19 -07:00
tqchen
2eccdda3c5 strict cstyle pthread 2015-04-27 22:42:01 -07:00
tqchen
279758a92e some strict cxx98 check 2015-04-27 17:37:07 -07:00
hetong007
48bcc021f7 add Rbuildignore to avoid compile .o files 2015-04-27 17:09:47 -07:00
Tianqi Chen
856a18e457 Update README.md 2015-04-27 17:07:58 -07:00
Tianqi Chen
ed901ddbb8 Update README.md 2015-04-27 17:07:28 -07:00
tqchen
69627567da adapt new dmlc io interface 2015-04-27 16:04:14 -07:00
tqchen
1e56ba86d9 Squashed 'subtree/rabit/' changes from fed1683..e1ddcc2
e1ddcc2 Merge branch 'master' of ssh://github.com/dmlc/rabit
6745667 new dmlc io
c5b4610 sge scheduler change

git-subtree-dir: subtree/rabit
git-subtree-split: e1ddcc2eb7
2015-04-27 15:58:57 -07:00
tqchen
59b96cdda5 Merge commit '1e56ba86d9d3e44b14c0a8f5ff71369307dbe86c' 2015-04-27 15:58:57 -07:00
Tianqi Chen
6783b66b9f Merge pull request #269 from jseabold/decode-string-py3
Good, python3 compatibility is indeed something we need to be careful about
2015-04-27 10:45:39 -07:00
Skipper Seabold
ee7e8b6e8a COMPAT: Decode bytes object for Python 3. 2015-04-27 12:41:24 -05:00
Tianqi Chen
f271af488b Merge pull request #267 from jseabold/add-n-classes
Add n_classes_ to fitted XGBClassifier
2015-04-27 09:10:17 -07:00
Skipper Seabold
c1a24c0fb1 ENH: Add n_classes_ to fitted classifier. 2015-04-27 11:09:55 -05:00
Tianqi Chen
8ac89b290e Merge pull request #268 from jseabold/docstrings
DOC: Add docstrings to user-facing classes.
2015-04-27 09:08:56 -07:00
Skipper Seabold
efdbec4d4c DOC: Add docstrings to user-facing classes. 2015-04-27 11:01:46 -05:00
Tianqi Chen
abcc09286c Merge pull request #265 from yzliao/master
add doc for Python wrapper
2015-04-26 22:14:05 -07:00
Yizheng Liao
bb91bdea84 add doc for Python wrapper 2015-04-26 22:08:06 -07:00
Tianqi Chen
94fac1076a bugfix setup 2015-04-26 00:17:58 -07:00
tqchen
d16b2c9670 Squashed 'subtree/rabit/' changes from 27340f9..fed1683
fed1683 minor
c01520f change

git-subtree-dir: subtree/rabit
git-subtree-split: fed1683b9b
2015-04-25 21:24:54 -07:00
tqchen
2eb30e732d Merge commit 'd16b2c9670d1849a360b94d581250aa1796d4abd' 2015-04-25 21:24:54 -07:00
tqchen
b5690e618e Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-04-25 21:20:06 -07:00
tqchen
4abd76386b Merge commit 'c0e0fc0c91dabdb86f68eed78e4a8f2b94fd1c2d' 2015-04-25 21:19:59 -07:00
tqchen
c0e0fc0c91 Squashed 'subtree/rabit/' changes from 82ca10a..27340f9
27340f9 final minor
e03eabc allow win32

git-subtree-dir: subtree/rabit
git-subtree-split: 27340f95e4
2015-04-25 21:19:58 -07:00
Tianqi Chen
6c83a94204 enable msvc win32 project 2015-04-25 21:14:07 -07:00
tqchen
5e63b5d469 Merge commit 'be1c530a0c92701841fa6a427d4f6a53d299cdeb' 2015-04-25 20:52:51 -07:00
tqchen
be1c530a0c Squashed 'subtree/rabit/' changes from c679671..82ca10a
82ca10a better handling at msvc
6601939 Merge pull request #12 from zjf/patch-2
df8f917 Update rabit-inl.h
c60b284 resize during tracker print

git-subtree-dir: subtree/rabit
git-subtree-split: 82ca10acb6
2015-04-25 20:52:51 -07:00
Tianqi Chen
afdebe8d8f fix platform dependent thing 2015-04-25 20:40:43 -07:00
Tianqi Chen
84515cd2a8 fix python windows installation problem, enable mingw compile, but seems mingw dll was not fast in loading 2015-04-25 15:30:42 -07:00
Tianqi Chen
4275434ec5 Merge pull request #260 from dmlc/colopt
Colopt
2015-04-25 10:15:33 -07:00
tqchen
5870b47d76 faster external memory 2015-04-25 10:14:56 -07:00
tqchen
b31d1c4ad9 check in colopt 2015-04-25 09:37:07 -07:00
Tianqi Chen
f28a7a0f8d Merge pull request #254 from lihang00/master
Python: add more params in sklearn wrapper.
2015-04-24 14:17:28 -07:00
HangLi
c6d2e16b61 remove eval_metric 2015-04-24 10:37:20 -07:00
HangLi
0058ebac9a add more params 2015-04-24 08:50:22 -07:00
Tianqi Chen
1d5b4e19a5 Merge pull request #258 from yzliao/master
remove print in Python function get_fscore()
2015-04-24 08:49:47 -07:00
Yizheng Liao
b5c8085638 remove print in Python get_fscore() 2015-04-23 23:40:10 -07:00
Yizheng Liao
84b82ab55f add flag variable in Python get_fscore() to control printing 2015-04-23 22:28:32 -07:00
Tianqi Chen
b94f7b0849 Merge pull request #257 from yzliao/master
Python: record evaluation results in train()
2015-04-23 21:51:09 -07:00
Yizheng Liao
1d8fc6280c correct format 2015-04-23 21:27:12 -07:00
Yizheng Liao
44d1043031 record training progress 2015-04-23 21:24:24 -07:00
HangLi
fcb833373b reorder parameters 2015-04-23 16:25:31 -07:00
Tianqi Chen
4aa1ea2d44 Merge pull request #252 from zjf/master
Fix a typo in comment
2015-04-23 14:37:26 -07:00
Tianqi Chen
dcb7ac81c1 Merge pull request #253 from tcfuji/master
Update README.md
2015-04-23 14:37:13 -07:00
HangLi
29e76c7ac0 add more params in sklearn wrapper. 2015-04-23 11:34:59 -07:00
Ted
7d3b51b873 Update README.md
Ensures OpenMP support
2015-04-23 14:08:39 -04:00
Jianfeng Zhu
11c45e5c60 Merge pull request #1 from zjf/zjf-patch-1
Update data.h
2015-04-23 14:22:10 +08:00
Jianfeng Zhu
f8ce8899bd Update data.h
Fix a minor typo, which may cause unnecessary confusion.
2015-04-23 14:21:05 +08:00
Tianqi Chen
e2c0ecbc92 Merge pull request #251 from zjf/patch-1
Update updater.h
2015-04-22 20:50:00 -07:00
Jianfeng Zhu
78907ca08d Update updater.h
Fix minor type
2015-04-23 11:44:47 +08:00
Tianqi Chen
d3af4e138f Merge pull request #249 from yzliao/master
add default value of gamma in parameter.md
2015-04-22 17:07:15 -07:00
Yizheng Liao
1b22ab7a7e add default value of gamma in parameter.md 2015-04-22 16:52:02 -07:00
Tianqi Chen
263d9bf84f Update README.md 2015-04-21 20:59:03 -07:00
tqchen
3e03c66e8a add note about distributed version 2015-04-20 12:37:23 -07:00
tqchen
0461231d3d more capacity for base 2015-04-20 16:21:55 +00:00
tqchen
dfec406afd half ram support 2015-04-19 21:29:13 -07:00
tqchen
5ad1555daf fix links to wiki 2015-04-19 14:23:47 -07:00
Tianqi Chen
a68928579b Update README.md 2015-04-19 14:21:12 -07:00
tqchen
50c1ce950f final chg 2015-04-19 14:07:39 -07:00
tqchen
315299aea8 add highlights 2015-04-19 14:07:08 -07:00
tqchen
6f14405b09 fix doc 2015-04-19 14:05:33 -07:00
tqchen
0220a22ca4 chg docs 2015-04-19 13:58:46 -07:00
tqchen
a1fdff0522 ok 2015-04-19 13:52:22 -07:00
tqchen
c6c868449c move documentation to repo 2015-04-19 13:48:19 -07:00
tqchen
5b042691b0 chg docs 2015-04-19 01:00:37 -07:00
Tianqi Chen
54a78b87dc Merge pull request #245 from dmlc/lite
Lite
2015-04-19 00:56:10 -07:00
tqchen
5123b07d73 add more docs 2015-04-19 00:55:11 -07:00
tqchen
44fd329b02 Squashed 'subtree/rabit/' changes from f52daf9..c679671
c679671 fix io style

git-subtree-dir: subtree/rabit
git-subtree-split: c67967161e
2015-04-19 00:23:02 -07:00
tqchen
ee112353cb Merge commit '44fd329b021bfd46a6b033a64467cda7d40310db' into lite 2015-04-19 00:23:02 -07:00
Tianqi Chen
18277086d9 fix windows warnings 2015-04-19 00:20:52 -07:00
tqchen
9527b55f35 fix makefile 2015-04-19 00:05:56 -07:00
tqchen
20da8bbe50 Squashed 'subtree/rabit/' changes from 7568f75..f52daf9
f52daf9 make timer cross platform

git-subtree-dir: subtree/rabit
git-subtree-split: f52daf9be1
2015-04-19 00:05:15 -07:00
tqchen
eb7cccffa4 Merge commit '20da8bbe504c0b81f6f3aff5b23f5bc3ee97d3f4' into lite 2015-04-19 00:05:15 -07:00
Bing Xu
47ee5e7c14 Update README.md 2015-04-18 14:46:00 -06:00
tqchen
5dfab4ba70 fast loader 2015-04-17 23:02:30 -07:00
tqchen
6d9cb3a2fa Merge branch 'lite' of ssh://github.com/tqchen/xgboost into lite
Conflicts:
	src/io/page_dmatrix-inl.hpp
2015-04-17 22:10:56 -07:00
tqchen
0a7d233c5d add 2015-04-17 22:09:26 -07:00
tqchen
788785f164 faster libsvm parser 2015-04-17 22:07:59 -07:00
tqchen
6bc5d6f0b4 Squashed 'subtree/rabit/' changes from 3bf8661..7568f75
7568f75 new io interface

git-subtree-dir: subtree/rabit
git-subtree-split: 7568f75f45
2015-04-17 21:07:33 -07:00
tqchen
c528c1e8e6 Merge commit '6bc5d6f0b44b957cc9f0d0b1fe5d420b0b59b8e2' into lite 2015-04-17 21:07:33 -07:00
tqchen
ddb7e538df OK 2015-04-16 17:03:18 -07:00
tqchen
22abf4e295 need more check 2015-04-16 12:34:39 -07:00
tqchen
a514340c96 current progress 2015-04-15 22:28:43 -07:00
tqchen
e8f6f3b541 some initial try of cachefiles 2015-04-15 15:15:23 -07:00
tqchen
3d8431fc5c simplify and parallelize data builder 2015-04-15 13:42:03 -07:00
Tianqi Chen
a596d11ed1 Merge pull request #241 from pommedeterresautee/master
Add experimental RF parameter documentation
2015-04-15 10:15:41 -07:00
El Potaeto
a49150a6d2 Redo readme modification 2015-04-15 18:49:52 +02:00
El Potaeto
de3f74f755 Merge remote-tracking branch 'dmlc/master' 2015-04-15 18:48:26 +02:00
El Potaeto
e4c8d9d2e1 clean 2015-04-15 18:47:31 +02:00
El Potaeto
511d74c631 clean 2015-04-15 18:46:28 +02:00
El Potaeto
ab8cf14fb9 cleaning 2015-04-15 18:44:06 +02:00
El Potaeto
0ae6d470c7 test 2015-04-15 18:36:53 +02:00
El Potaeto
925fa30316 Cancel readme modif 2015-04-15 18:32:04 +02:00
El Potaeto
2034b91b7d commit emtpy 2015-04-15 18:30:46 +02:00
pommedeterresautee
20dfcd7cec Add slides to readme + group documentation together 2015-04-14 00:48:11 +02:00
pommedeterresautee
12047056ae Update vignette 2015-04-14 00:39:51 +02:00
pommedeterresautee
4e1002a52c Experimental parameter 2015-04-14 00:30:55 +02:00
pommedeterresautee
aa0f612ac9 git ignore RProject files 2015-04-14 00:26:11 +02:00
tqchen
2b7c35870f Squashed 'subtree/rabit/' changes from 18f4d6c..3bf8661
3bf8661 add std before basic

git-subtree-dir: subtree/rabit
git-subtree-split: 3bf8661ec1
2015-04-13 13:44:41 -07:00
tqchen
6370b38c14 Merge commit '2b7c35870f7bf0ca7e28f53b322829007c91317e' 2015-04-13 13:44:41 -07:00
tqchen
24207d96fe new dmlc interface 2015-04-11 20:28:50 -07:00
tqchen
a30045c7cc Squashed 'subtree/rabit/' changes from 50a66b3..18f4d6c
18f4d6c remove rabit learn
bcfbe51 fix dmlc io
ad383b0 ok
3b8c04a Merge branch 'master' of ssh://github.com/dmlc/rabit
9dd97cc keepup with dmlc core
ef13aaf ch

git-subtree-dir: subtree/rabit
git-subtree-split: 18f4d6c0ba
2015-04-11 20:26:57 -07:00
tqchen
f55f8f023f Merge commit 'a30045c7cc54344e2084fb1fa3e01bfafc737188' 2015-04-11 20:26:57 -07:00
tqchen
bf7b750b86 add ignore 2015-04-11 09:25:19 -07:00
tqchen
91a7a5f2e2 add small boundary checking 2015-04-10 10:55:42 -07:00
Tianqi Chen
0ea28c35c4 Merge pull request #225 from chrissly31415/master
Fixing parsing of model dump text file in R
2015-04-09 09:53:38 -07:00
Tianqi Chen
7975dd03a9 Merge pull request #229 from nagadomi/fix_group_check_in_r
Fix length check in utils.R
2015-04-09 09:02:31 -07:00
tqchen
f4dbee5523 Squashed 'subtree/rabit/' changes from e08542c..50a66b3
50a66b3 fix empty engine

git-subtree-dir: subtree/rabit
git-subtree-split: 50a66b3855
2015-04-09 08:45:13 -07:00
tqchen
73ab391309 Merge commit 'f4dbee5523dc5816480f3c97cdb7192ceaec9dfc' 2015-04-09 08:45:13 -07:00
tqchen
c8c1dc6a3b xgboost update for dmlc changes 2015-04-08 17:42:54 -07:00
tqchen
3d11f56880 Squashed 'subtree/rabit/' changes from b15f6cd..e08542c
e08542c fix doc
e95c962 remove I prefix from interface, serializable now takes in pointer

git-subtree-dir: subtree/rabit
git-subtree-split: e08542c635
2015-04-08 17:39:45 -07:00
tqchen
9a6adb0f33 Merge commit '3d11f56880521c1d45504c965ae12886e9b72ace' 2015-04-08 17:39:45 -07:00
Tianqi Chen
23c273173f Merge pull request #230 from jseabold/python-install
Make the Python wrappers installable without path munging
2015-04-08 15:02:37 -07:00
Tong He
2c9631a254 Merge pull request #228 from khotilov/dep_reduction__mv2suggest
dependencies trim: moved external graphing packages to Suggests
2015-04-08 13:26:53 -07:00
Skipper Seabold
a0e07f16c4 Update demo scripts to use installed python library 2015-04-08 14:22:54 -05:00
Skipper Seabold
ceb62e9231 Update docs about python module install 2015-04-08 14:20:52 -05:00
Skipper Seabold
c972feb4b5 Make Python package installable. 2015-04-08 14:07:37 -05:00
nagadomi
87b4332cc1 Fix length check in utils.R 2015-04-09 02:25:47 +09:00
Vadim Khotilovich
76cef701ab moved the external graphing packages to Suggested in order to trim the dependencies 2015-04-07 18:02:29 -05:00
Vadim Khotilovich
aefd234da3 moved the external graphing packages to Suggested in order to trim the dependencies 2015-04-07 17:43:53 -05:00
Vadim Khotilovich
0405676734 Merge remote branch 'src/master' 2015-04-07 17:16:19 -05:00
Tianqi Chen
e91bacd378 Merge pull request #226 from white1033/master 2015-04-07 09:23:11 -07:00
white1033
b4545df0e3 *Fix Sklearn.grid_search error 2015-04-07 23:57:01 +08:00
chrissly31415
34cbbab84c fixing parsing of any numbers 2015-04-07 11:45:08 +02:00
chrissly31415
b39c16ea02 fixed parsing of negative reals, integers and scientific notation which
can occur in model dump
2015-04-07 10:57:54 +02:00
tqchen
01771c813d safe fix 2015-04-06 14:53:40 -07:00
tqchen
99f8dd280e push backward compatible fix 2015-04-06 14:50:21 -07:00
tqchen
36dcb061a8 larger boundary in edge case 2015-04-06 13:42:43 -07:00
tqchen
dc37023226 fix 2015-04-06 09:59:18 -07:00
tqchen
65abc26797 move distributed xgboost to wormhole 2015-04-06 09:56:45 -07:00
tqchen
421f5c6570 fix 2015-04-06 09:00:27 -07:00
tqchen
3cc48d6707 fix crash in error 2015-04-06 08:58:33 -07:00
tqchen
b6d85b9d9b fix label crash 2015-04-06 08:48:06 -07:00
tqchen
529a732737 add label error 2015-04-06 08:45:54 -07:00
tqchen
30e61084eb Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-04-05 20:42:27 -07:00
tqchen
0ffaeb8c64 add xgboost 2015-04-05 20:42:09 -07:00
Tianqi Chen
84957c3f84 update windows project for latest change 2015-04-05 20:13:20 -07:00
tqchen
8a3c0f1ae4 simple chg 2015-04-05 12:16:55 -07:00
tqchen
b8fd7c3c7c add instruction to build with s3 2015-04-05 12:10:59 -07:00
tqchen
fba9e5c714 quick fix 2015-04-05 12:01:19 -07:00
tqchen
5f902982f2 compile with dmlc 2015-04-05 11:26:06 -07:00
tqchen
89244b4aec Squashed 'subtree/rabit/' changes from 16975b4..b15f6cd
b15f6cd rabit unifires with dmlc
5634ec3 ok
2dd6c2f Merge branch 'master' of ssh://github.com/dmlc/rabit
38d7f99 checkin wormhole spliter
8acb96a Merge pull request #10 from ryanzz/master
911a1f0 fixed a mistake
732d8c3 inteface changing
684ea0a inteface changing
8cb4c02 add dmlc support
be2ff70 allow adapting wormhole

git-subtree-dir: subtree/rabit
git-subtree-split: b15f6cd2ac
2015-04-05 09:56:53 -07:00
tqchen
9b7907eda3 Merge commit '89244b4aec1f229b9ba1378389d4dea697389666' 2015-04-05 09:56:53 -07:00
Tianqi Chen
e626b62daa Merge pull request #220 from white1033/master
*Fix XGBClassifier super()
2015-04-05 09:05:08 -07:00
white1033
18cb8d7de2 fix indent warning by flake8 2015-04-05 23:22:40 +08:00
white1033
402e832ce5 *Fix XGBClassifier super() 2015-04-05 21:15:09 +08:00
Vadim Khotilovich
31b0e53cd4 make it possible to use a list of pre-defined CV folds in xgb.cv 2015-04-03 13:24:04 -05:00
Vadim Khotilovich
c03b42054f Merge remote branch 'src/master' 2015-04-03 13:18:40 -05:00
Vadim Khotilovich
271e8202a7 force xgb.cv to return numeric performance values instead of character; update its docs 2015-04-03 12:20:34 -05:00
Vadim Khotilovich
b04920d8e7 update documentation for xgb.cv 2015-04-03 11:14:09 -05:00
Tianqi Chen
93d3f4fe61 Merge pull request #217 from nerdcha/master
Bugfix for multiclass sklearn wrapper
2015-04-02 21:14:21 -07:00
Jamie Hall
d17cdd639f bugfix 2015-04-02 20:33:07 -07:00
Vadim Khotilovich
611d69c771 fix some wording 2015-04-02 19:59:06 -05:00
Vadim Khotilovich
b8711226e2 added an option for stratified CV to xgb.cv 2015-04-02 19:48:23 -05:00
Tianqi Chen
9b0dee986f Merge pull request #212 from zygmuntz/master
Early stopping for Python wrapper
2015-04-02 17:31:44 -07:00
Tianqi Chen
e9c95645a3 Merge pull request #215 from nerdcha/master
Scikit-Learn Wrapper For XGBoost
2015-04-02 12:25:55 -07:00
Zygmunt Zając
d7f9499f88 early_stopping_rounds for train() in Python wrapper 🔥 2015-04-02 19:43:30 +02:00
Jamie Hall
a1a427af37 Fix some stuff 2015-04-02 00:05:14 -07:00
Jamie Hall
136e902fb2 Initial commit 2015-04-01 23:29:05 -07:00
tqchen
8d1f4a40a5 Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-03-30 16:06:18 -07:00
tqchen
49e641012f add objective 2015-03-30 16:05:51 -07:00
Zygmunt Zając
39093bc432 early stopping for Python wrapper 2015-03-30 19:59:09 +02:00
Zygmunt Zając
7994858697 early stopping for Python wrapper 2015-03-30 19:58:25 +02:00
Zygmunt Zając
f9e157011f early stopping for Python wrapper 2015-03-30 19:56:03 +02:00
unknown
431277d5ca fix multi cv pred 2015-03-29 00:02:29 -07:00
unknown
37567e440c optim pred in cv 2015-03-28 23:41:19 -07:00
unknown
930497e271 fix matrix form prediction 2015-03-28 23:03:16 -07:00
El Potaeto
be6bd3859d Add Random Forest parameter (num_parallel_tree) in function doc + example in Vignette. 2015-03-29 01:52:26 +01:00
Tianqi Chen
b04591cbfc Update README.md 2015-03-28 08:58:30 -07:00
tqchen
68c2aaa7fe Squashed 'subtree/rabit/' changes from eb1f4a4..16975b4
16975b4 try pass on tokens during application submission

git-subtree-dir: subtree/rabit
git-subtree-split: 16975b447c
2015-03-27 11:09:38 -07:00
tqchen
135d461c40 Merge commit '68c2aaa7fe8c1f4688cef2ace67642e85fd1c9d2' 2015-03-27 11:09:38 -07:00
tqchen
0c349d6101 Squashed 'subtree/rabit/' changes from 59e63bc..eb1f4a4
eb1f4a4 change auto to ip

git-subtree-dir: subtree/rabit
git-subtree-split: eb1f4a4003
2015-03-26 23:33:41 -07:00
tqchen
38911fe2b2 Merge commit '0c349d6101652836f2ec23e48f94b4137aac6108' 2015-03-26 23:33:41 -07:00
tqchen
4eae8e8676 allow xgb.load re-use raw information if necessary 2015-03-26 16:54:29 -07:00
tqchen
98618646f6 bugfix booster.check 2015-03-26 16:43:01 -07:00
tqchen
23e46b7fa5 add max_delta_step 2015-03-26 09:47:16 -07:00
tqchen
149b43a0a8 Merge branch 'master' of ssh://github.com/dmlc/xgboost 2015-03-25 21:08:29 -07:00
tqchen
a84d6c55b3 more detailed explaination on windows build 2015-03-25 21:08:21 -07:00
Tong He
db0b06d19c add another solution to os x 2015-03-25 17:14:14 -07:00
hetong007
047c4b20de remove additional files 2015-03-25 16:06:51 -07:00
tqchen
08fb205102 cap second order gradient 2015-03-25 12:08:53 -07:00
tqchen
53c9a7b66b fix quantile for edge case, make logloss evaluation capped for extreme values 2015-03-24 23:52:42 -07:00
tqchen
d53e642b5d add debuglog for quantile 2015-03-23 21:17:50 -07:00
Tianqi Chen
da3a376384 Merge pull request #203 from pommedeterresautee/master
update links dmlc
2015-03-22 09:34:09 -07:00
El Potaeto
7d0ac3a3dd update links dmlc 2015-03-22 16:41:05 +01:00
tqchen
70045c41f9 change links 2015-03-21 23:12:55 -07:00
Tong He
03911cf748 Update README.md 2015-03-21 22:34:19 -07:00
Tianqi Chen
1a9a3a2fd0 Update README.md 2015-03-21 22:26:59 -07:00
Tianqi Chen
87741bded6 Update README.md 2015-03-21 22:26:24 -07:00
Tianqi Chen
25266796e9 Merge pull request #201 from pommedeterresautee/master
add video tuto to the README
2015-03-21 22:23:52 -07:00
tqchen
9ccbeaa8f0 Merge commit '75bf97b57539e5572e7ae8eba72bac6562c63c07'
Conflicts:
	subtree/rabit/rabit-learn/io/line_split-inl.h
	subtree/rabit/yarn/build.sh
2015-03-21 00:48:34 -07:00
tqchen
75bf97b575 Squashed 'subtree/rabit/' changes from 091634b..59e63bc
59e63bc minor
6233050 ok
14477f9 add namenode
75a6d34 add libhdfs opts
e3c76bf minmum fix
8b3c435 chg
2035799 test code
7751b2b add debug
7690313 ok
bd346b4 ok
faba1dc add testload
6f7783e add testload
e5f0340 ok
3ed9ec8 chg
e552ac4 ask for more ram in am
b2505e3 only stop nm when sucess
bc696c9 add queue info
f3e867e add option queue
5dc843c refactor fileio
cd9c81b quick fix
1e23af2 add virtual destructor to iseekstream
f165ffb fix hdfs
8cc6508 allow demo to pass in env
fad4d69 ok
0fd6197 fix more
7423837 fix more
d25de54 add temporal solution, run_yarn_prog.py
e5a9e31 final attempt
ed3bee8 add command back
0774000 add hdfs to resource
9b66e7e fix hadoop
6812f14 ok
08e1c16 change hadoop prefix back to hadoop home
d6b6828 Update build.sh
146e069 bugfix: logical boundary for ring buffer
19cb685 ok
4cf3c13 Merge branch 'master' of ssh://github.com/tqchen/rabit
20daddb add tracker
c57dad8 add ringbased passing and batch schedule
295d8a1 update
994cb02 add sge
014c866 OK

git-subtree-dir: subtree/rabit
git-subtree-split: 59e63bc135
2015-03-21 00:44:31 -07:00
Tong He
5648bec8a3 Update utils.R 2015-03-20 22:41:47 -07:00
hetong007
7ced224722 change name 2015-03-20 18:46:52 -07:00
Tong He
2e71d2dfe4 Update readme.md 2015-03-20 16:05:36 -07:00
hetong007
4bcc73f0c9 add kaggle otto folder 2015-03-20 13:34:20 -07:00
Tong He
f6722ba628 Update utils.R 2015-03-20 11:06:01 -07:00
El Potaeto
3777ad8f17 Merge remote-tracking branch 'upstream/master' 2015-03-20 10:16:48 +01:00
El Potaeto
2b24697d79 add tuto to the README 2015-03-20 10:14:38 +01:00
tqchen
360cc7118d fix cxx11 2015-03-19 11:53:55 -07:00
tqchen
e1538ae615 add new evaluation metric mlogloss for multi-class classification logloss 2015-03-19 11:34:38 -07:00
Tong He
8025b338a8 Merge pull request #199 from pommedeterresautee/master
Cross validation documentation improvement
2015-03-18 11:14:36 -07:00
pommedeterresautee
4094039ce5 README 2015-03-17 23:32:52 +01:00
pommedeterresautee
33205d1fbd Cross validation documentation improvement 2015-03-17 23:18:00 +01:00
Tong He
adfa023822 Merge pull request #198 from pommedeterresautee/master
Add new nrow function for xgb.DMatrix + small function doc changes
2015-03-17 12:29:00 -07:00
Tong He
a146f0c5e1 Update utils.R 2015-03-16 23:23:22 -07:00
Tong He
1e001f7cf3 add length check 2015-03-16 23:20:31 -07:00
pommedeterresautee
240c314ac0 doc 2015-03-16 00:12:23 +01:00
pommedeterresautee
9d1d76532d documentation 2015-03-16 00:10:18 +01:00
pommedeterresautee
6ca76fe784 doc 2015-03-15 23:59:28 +01:00
pommedeterresautee
81caba5dce new nrow function for xgb.DMatrix 2015-03-15 23:52:00 +01:00
pommedeterresautee
cdfa78a3b9 small changes in doc 2015-03-15 23:51:26 +01:00
tqchen
8386c2b7fa check r 2015-03-13 23:49:56 -07:00
Tianqi Chen
2159d18f0b Update param.h 2015-03-13 23:23:23 -07:00
Tianqi Chen
90ade3bb84 Merge pull request #193 from pommedeterresautee/master
Vignette text (very biiiiig change)
2015-03-13 14:50:49 -07:00
El Potaeto
93a019d174 code simplification 2015-03-12 23:44:08 +01:00
El Potaeto
09091884be Merge remote-tracking branch 'upstream/master' 2015-03-11 22:14:35 +01:00
tqchen
e52de85e59 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2015-03-11 11:22:56 -07:00
tqchen
12528c535a fix 2015-03-11 11:22:51 -07:00
tqchen
03f34824b4 some potential fix 2015-03-11 09:43:42 -07:00
tqchen
8437e43afc pass solaris compile 2015-03-11 09:15:34 -07:00
tqchen
52fe528615 fix rpack 2015-03-11 08:53:57 -07:00
Tong He
8f24f3cd5a Update speedtest.R 2015-03-10 22:55:48 -07:00
Tianqi Chen
d5303af068 fix vs warnings 2015-03-09 22:37:08 -07:00
tqchen
13a319ca01 Squashed 'subtree/rabit/' changes from d558f6f..091634b
091634b fix

git-subtree-dir: subtree/rabit
git-subtree-split: 091634b259
2015-03-09 14:58:23 -07:00
tqchen
5c389ed89a Merge commit '13a319ca01e6fadd0ec7592cff8e7b545af0994e' 2015-03-09 14:58:23 -07:00
tqchen
deceec3e10 update 2015-03-09 14:57:49 -07:00
tqchen
8f7e9abf89 Merge commit '4c060df2f17405dc26dc65a77e412d5c2a23525a'
Conflicts:
	subtree/rabit/tracker/rabit_yarn.py
2015-03-09 14:45:23 -07:00
tqchen
4c060df2f1 Squashed 'subtree/rabit/' changes from 28ca7be..d558f6f
d558f6f redefine distributed means
c8efc01 more complicated yarn script

git-subtree-dir: subtree/rabit
git-subtree-split: d558f6f550
2015-03-09 14:44:42 -07:00
tqchen
a8d5af39fd move stream to rabit part, support rabit on yarn 2015-03-09 14:43:46 -07:00
tqchen
57b5d7873f Squashed 'subtree/rabit/' changes from d4ec037..28ca7be
28ca7be add linear readme
ca4b20f add linear readme
1133628 add linear readme
6a11676 update docs
a607047 Update build.sh
2c1cfd8 complete yarn
4f28e32 change formater
2fbda81 fix stdin input
3258bcf checkin yarn master
67ebf81 allow setup from env variables
9b6bf57 fix hdfs
395d5c2 add make system
88ce767 refactor io, initial hdfs file access need test
19be870 chgs
a1bd3c6 Merge branch 'master' of ssh://github.com/tqchen/rabit
1a573f9 introduce input split
29476f1 fix timer issue

git-subtree-dir: subtree/rabit
git-subtree-split: 28ca7becbd
2015-03-09 13:28:38 -07:00
tqchen
9f7c6fe271 Merge commit '57b5d7873f4f0953357e9d98e9c60cff8373d7ec' 2015-03-09 13:28:38 -07:00
El Potaeto
21a4a32655 Vignette text 2015-03-08 21:57:31 +01:00
Tong He
66cf88f7b0 Merge pull request #192 from pommedeterresautee/master
Vignette improvement
2015-03-08 10:08:33 -07:00
tqchen
99ef34ca8c Merge branch 'master' of ssh://github.com/tqchen/xgboost 2015-03-08 09:55:40 -07:00
tqchen
e79840e620 fix wrapper checkNAN 2015-03-08 09:52:59 -07:00
El Potaeto
09e466764e Vignette text 2015-03-08 00:38:22 +01:00
El Potaeto
05dbc40186 space 2015-03-08 00:03:40 +01:00
El Potaeto
5a59c0b26c df spell 2015-03-08 00:02:14 +01:00
Tianqi Chen
2ec27679eb Merge pull request #190 from pommedeterresautee/master
trademark RF
2015-03-07 08:58:50 -08:00
tqchen
d202d8b977 more robust config parser 2015-03-07 08:52:56 -08:00
tqchen
bae1a08c9b remove mock from default build 2015-03-06 21:02:22 -08:00
El Potaeto
5bc9642d31 trademark RF 2015-03-04 12:09:50 +01:00
tqchen
39cb9d2c5e fix nan 2015-03-03 22:33:03 -08:00
hetong
841d076f20 change version of the package 2015-03-03 18:14:25 -08:00
tqchen
e50fa9e78f fix solaris 2015-03-03 13:16:20 -08:00
tqchen
ef2de29f06 Squashed 'subtree/rabit/' changes from 4db0a62..d4ec037
d4ec037 fix rabit
6612fcf Merge branch 'master' of ssh://github.com/tqchen/rabit
d29892c add mock option statis
4fa054e new tracker
75c647c update tracker for host IP
e4ce8ef add hadoop linear example
76ecb4a add hadoop linear example
2e1c4c9 add hadoop linear example

git-subtree-dir: subtree/rabit
git-subtree-split: d4ec037f2e
2015-03-03 13:13:21 -08:00
tqchen
3897b7bf99 Merge commit 'ef2de29f068c0b22a4fb85ca556b7b77950073d6' 2015-03-03 13:13:21 -08:00
tqchen
9fd8612700 fix cranchecks 2015-03-03 12:37:29 -08:00
hetong
ee6e8279eb add vcd back 2015-03-03 00:25:30 -08:00
hetong
41b080e35f To submit to CRAN we cannot use more than 2 threads in our examples/vignettes 2015-03-03 00:21:24 -08:00
Tong He
87ec48c1d3 change order of sentences
Dear Prof. Ripley said that "The Description field should not start with the package name, 'This package' or similar."
2015-03-02 22:45:49 -08:00
Tong He
aa60c44b25 Merge pull request #186 from pommedeterresautee/master
Presentation (CSS) : more space + more structure
2015-03-02 09:55:23 -08:00
El Potaeto
0c77726b55 CSS: Add slight line after Header 1 2015-03-02 14:47:00 +01:00
El Potaeto
a6a707f23c Add ref. 2015-03-02 14:37:25 +01:00
El Potaeto
4ee43f2167 CSS improvement, more space, change in style titles 2015-03-02 14:36:19 +01:00
Tong He
c62583bb0f Update discoverYourData.Rmd 2015-03-01 22:15:47 -08:00
Tong He
48deb49ba1 possible polishments 2015-03-01 22:02:23 -08:00
Tong He
57972ef2c2 Update xgboost.Rnw 2015-03-01 21:32:59 -08:00
tqchen
4210f9cf51 add conf 2015-03-01 20:41:26 -08:00
Tong He
576b8acfae Update xgboostPresentation.Rmd 2015-03-01 18:30:49 -08:00
Tong He
b8c0d8ba72 Merge pull request #185 from pommedeterresautee/master
Vignette improvement: more structure, more serious, less spell/grammar issues, better organization
2015-03-01 18:28:58 -08:00
El Potaeto
de6bedc7cb Vignette text 2015-03-01 21:35:36 +01:00
El Potaeto
711fb128cd Vignette text 2015-03-01 21:31:42 +01:00
El Potaeto
d88cf20c23 Vignette text 2015-03-01 21:25:14 +01:00
El Potaeto
a749cf3133 Vignette text 2015-03-01 21:22:26 +01:00
pommedeterresautee
46082a54c9 Vignette text 2015-03-01 13:01:42 +01:00
pommedeterresautee
8e52c4b45a Fix Vignette bug! 2015-03-01 12:13:38 +01:00
pommedeterresautee
4559477d63 text vignette 2015-03-01 11:01:03 +01:00
pommedeterresautee
2986d913ed Vignette text 2015-03-01 10:20:41 +01:00
hetong
8f0e99c3ce import vcd to eliminate note 2015-02-28 10:11:44 -08:00
Tong He
a96ac937f8 Merge pull request #184 from pommedeterresautee/master
fix warning
2015-02-26 16:01:58 -08:00
pommedeterresautee
8abd9c747a fix warning 2015-02-27 00:49:20 +01:00
Tianqi Chen
9784c471d5 Update README.md 2015-02-25 10:05:50 -08:00
Tianqi Chen
2c69a17e77 Update README.md 2015-02-25 10:00:52 -08:00
Tong He
8e93b18555 Merge pull request #182 from pommedeterresautee/master
Memory optimization in co occurence comp feature importance (use sparse Matrix if required) + Vignette text (spell, grammar...) + CSS
2015-02-23 13:19:34 -08:00
El Potaeto
56068b5453 text vignette 2015-02-22 00:17:37 +01:00
El Potaeto
56e9bff11f Vignette txt 2015-02-21 23:49:41 +01:00
El Potaeto
48390bdd6a text 2015-02-19 19:26:39 +01:00
El Potaeto
56877338b7 memory optimization 2015-02-19 13:48:39 +01:00
Tong He
dce522d7a1 Merge pull request #179 from pommedeterresautee/master
Generalize co-occurence count to not categorical feature only + Perf + Vignette + CSS + Function documentation
2015-02-18 16:55:40 -08:00
El Potaeto
815789bed6 fix 2015-02-19 00:16:50 +01:00
El Potaeto
d982f2746c small fixes 2015-02-18 19:41:13 +01:00
El Potaeto
83ddbbf03b splell 2015-02-18 17:14:08 +01:00
El Potaeto
8523fb9f49 avoid error message 2015-02-18 13:44:21 +01:00
El Potaeto
dabb0fd4c0 Merge remote-tracking branch 'upstream/master' 2015-02-18 13:25:15 +01:00
El Potaeto
f57f0f2543 Documentation feature importance 2015-02-18 13:19:39 +01:00
El Potaeto
8fd546ab3c vignette text 2015-02-18 13:13:27 +01:00
El Potaeto
1cfa810edb refix 2015-02-17 23:37:56 +01:00
El Potaeto
fe4f73920b Merge remote-tracking branch 'origin/master'
Conflicts:
	R-package/vignettes/discoverYourData.Rmd
	R-package/vignettes/vignette.css
2015-02-17 23:35:52 +01:00
El Potaeto
412a6e1085 Add comments 2015-02-17 23:30:36 +01:00
El Potaeto
08493c2b3d missing feature management 2015-02-17 23:27:02 +01:00
El Potaeto
d4731e7b29 vignette text 2015-02-17 23:06:09 +01:00
El Potaeto
2ea6fd9931 better CSS 2015-02-17 23:01:48 +01:00
El Potaeto
e2b2c21aef better co occurence function 2015-02-17 22:39:38 +01:00
pommedeterresautee
2e391ed0ee text refactor 2015-02-16 22:43:12 +01:00
pommedeterresautee
8e3c25ed33 css improvement 2015-02-16 22:35:01 +01:00
Tianqi Chen
15562126a6 Merge pull request #178 from aldanor/master
[python] Fixed the dll import for relative paths + various cleanup.
2015-02-16 09:51:40 -08:00
Ivan Smirnov
8660ea91b5 Fixed the dll import for relative paths + various cleanup.
- DLL import now works when __file__ is a relative path
- Various PEP8 and whitespace fixes + whitespace cleanup
- Docstring fixes (conform to numpydoc)
- Added __all__ to the module
- Fixed mutable default values
- Removed print statements
- py2/py3-compatible string-type checks
- Replace asserts with proper exceptions
- Make classes new-style (derive from object)
2015-02-16 16:03:47 +00:00
Tong He
1b92d9eadf Merge pull request #177 from pommedeterresautee/master
New co occurence computation (for importance feature function)
2015-02-15 16:48:33 -08:00
El Potaeto
f0eaac2174 Bug + documentation 2015-02-15 17:46:12 +01:00
El Potaeto
f84cc0843f fixed bug 2015-02-15 17:30:39 +01:00
El Potaeto
def2674dd1 Add new co-occurence computation capacity to importance feature function + related documentation 2015-02-15 17:15:47 +01:00
El Potaeto
d75194303b CSS improvement 2015-02-15 10:26:32 +01:00
Tong He
fe7651fe53 Merge pull request #175 from pommedeterresautee/master
markdown Vignette can be compiled as package Vignette (use devtools) + improve Vignette text
2015-02-14 14:38:45 -08:00
hetong007
3adfe4eeda not build the vignette 2015-02-13 13:13:29 -08:00
El Potaeto
3da261b6e7 add linear boosting part 2015-02-13 18:49:53 +01:00
Tianqi Chen
a718a43d92 Update mushroom.hadoop.conf 2015-02-13 09:04:05 -08:00
El Potaeto
9a4bf40e5e clean temp 2015-02-13 13:34:24 +01:00
El Potaeto
8a7d803e52 justified text in CSS 2015-02-13 13:28:04 +01:00
pommedeterresautee
ae9f7e9307 vignette text 2015-02-12 22:44:57 +01:00
pommedeterresautee
276b68b984 Vignette text 2015-02-12 22:22:00 +01:00
El Potaeto
7421f35136 vignette text 2015-02-12 20:05:38 +01:00
El Potaeto
ba36c495be text vignette 2015-02-12 17:36:10 +01:00
El Potaeto
7f71cc12f4 add bibliography 2015-02-12 17:19:11 +01:00
El Potaeto
8a8eb33114 fix temp file created by PDF 2015-02-12 15:47:53 +01:00
El Potaeto
df63c86afa git ignore update -> exclude generated vignette 2015-02-12 14:05:19 +01:00
El Potaeto
09a6522704 Vignette text 2015-02-12 13:59:45 +01:00
El Potaeto
234cf49e35 fix some CSS 2015-02-12 13:59:23 +01:00
El Potaeto
7bb2926414 add introduction paragraph from PDF file 2015-02-12 10:19:42 +01:00
El Potaeto
16ffd7c9b2 Comment wording 2015-02-12 09:56:27 +01:00
El Potaeto
f1f346713a Merge remote-tracking branch 'upstream/master' 2015-02-12 09:51:42 +01:00
Tianqi Chen
f8a314e2e4 Merge pull request #176 from tqchen/unity
pull rabit updates
2015-02-11 20:37:54 -08:00
tqchen
13776a006a Squashed 'subtree/rabit/' changes from 1bb8fe9..4db0a62
4db0a62 bugfix of lazy prepare
87017bd license
dc703e1 license
c171440 change license to bsd
7db2070 Update README.md
581fe06 add mocktest
d2f252f ok
4a5b9e5 add all
12ee049 init version of lbfgs
37a2837 complete lbfgs solver
6ade7cb complete lbfgs

git-subtree-dir: subtree/rabit
git-subtree-split: 4db0a62a06
2015-02-11 20:33:35 -08:00
tqchen
e923bdb12f Merge commit '13776a006a4e572720ec4c5b029b54771cf2b35c' into unity 2015-02-11 20:33:35 -08:00
pommedeterresautee
97cb8bf637 refactor vignette 2015-02-12 00:06:13 +01:00
tqchen
c40afa2023 fix sklearner 2015-02-11 11:37:14 -08:00
tqchen
c639efc71b Merge branch 'master' into unity 2015-02-11 10:58:19 -08:00
tqchen
2ec113b1be Merge branch 'unity'
Conflicts:
	R-package/R/predict.xgb.Booster.R
2015-02-11 10:58:09 -08:00
El Potaeto
adf8b6553d Vignettes 2015-02-11 18:01:36 +01:00
El Potaeto
d70f52d4b1 Vignette text 2015-02-11 15:25:25 +01:00
El Potaeto
e457b5ea58 Simplified my name :-) 2015-02-11 15:25:12 +01:00
El Potaeto
9d11936790 improve function documentation.
Switch xgboost detailed parameters with xgb.tain function.
2015-02-11 10:12:18 +01:00
tqchen
a16cbedfab try fix memleak when test data have more features than training 2015-02-10 21:49:29 -08:00
Tong He
292f4f0e0d Merge pull request #171 from pommedeterresautee/master
Vignette (1 updated, 1 new)
2015-02-10 16:19:54 -08:00
pommedeterresautee
dc9e4905e4 Vignette text 2015-02-10 22:48:16 +01:00
El Potaeto
d7ba5c1511 text vignette 2015-02-10 19:46:39 +01:00
El Potaeto
cefd55ef00 Vignettes improvement 2015-02-10 17:09:21 +01:00
El Potaeto
c0d8ae3781 text change 2015-02-10 13:59:13 +01:00
El Potaeto
423c3e6a8d improved vignette text 2015-02-10 13:54:30 +01:00
tqchen
a30635e0b4 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2015-02-09 21:08:07 -08:00
tqchen
e889da4cc1 new Rpack 2015-02-09 21:07:57 -08:00
hetong007
7f3dc7cf7e fix warnings 2015-02-09 18:38:23 -08:00
hetong007
25f508e43e update doc, resolve warnings 2015-02-09 17:48:52 -08:00
hetong007
47b5cf5148 fix save.raw 2015-02-09 17:35:50 -08:00
hetong007
4c25600d2a fix segfault and add two function for handle and booster 2015-02-09 17:28:48 -08:00
hetong007
0aef62dabc fix with new predict 2015-02-09 16:25:00 -08:00
hetong007
f7c838ffaa fix bugs 2015-02-09 16:16:11 -08:00
hetong007
5b611c355e add handle and raw structure to xgb.Booster 2015-02-09 15:51:24 -08:00
hetong007
ea5860d574 fix save.raw doc 2015-02-09 13:43:32 -08:00
Tong He
8c16491b42 Update xgb.save.raw.R 2015-02-09 13:31:21 -08:00
Tong He
ac3791bf74 Merge pull request #169 from pommedeterresautee/master
Fix some warnings in Cran check
2015-02-09 13:16:15 -08:00
pommedeterresautee
eecfd015fa Update CK.means version 2015-02-09 21:37:31 +01:00
pommedeterresautee
f4b454d6dd fix some warning in Cran check 2015-02-09 21:34:53 +01:00
Tianqi Chen
a3cf30592f Merge pull request #168 from pommedeterresautee/master
xgboost simplified documentation + dump function performance optimization (for big model)
2015-02-09 09:05:57 -08:00
El Potaeto
3971323203 fix bug 2015-02-09 18:01:14 +01:00
El Potaeto
0922883250 Optimization in dump function (replaced some regular R function by data.table) 2015-02-09 17:20:21 +01:00
El Potaeto
a45497e6f3 add web address 2015-02-08 22:46:59 +01:00
El Potaeto
76e24fdd36 documentation simplification 2015-02-08 22:46:29 +01:00
El Potaeto
29b5312428 remove not required dependency 2015-02-08 00:02:53 +01:00
El Potaeto
9d89441e38 small doc fix 2015-02-07 23:58:09 +01:00
El Potaeto
12b0e8e6d5 small doc fix 2015-02-07 23:57:48 +01:00
El Potaeto
75f205b0b1 fix documentation 2015-02-07 23:53:55 +01:00
El Potaeto
85739c537d new doc 2015-02-07 23:40:49 +01:00
El Potaeto
85186a2e55 remove buggy feature 2015-02-06 11:44:09 +01:00
tqchen
8b4acef662 remove sync from wrapper.h 2015-02-05 21:03:06 -08:00
El Potaeto
a82a942cd6 add importance feature sign 2015-02-05 17:25:37 +01:00
El Potaeto
68290546ca simplidied included column computation 2015-02-05 09:53:21 +01:00
El Potaeto
b7526671ba wording 2015-02-05 00:03:39 +01:00
El Potaeto
92652bffa1 wording 2015-02-05 00:01:13 +01:00
El Potaeto
9f5889f1e3 new included feature in dt.tree function 2015-02-04 23:59:53 +01:00
tqchen
b34a56b1f9 fix for ulong 2015-02-04 11:18:56 -08:00
Tong He
90c698ba13 Merge pull request #162 from pommedeterresautee/patch-1
Spell
2015-02-02 13:09:59 -08:00
Michaël Benesty
5d135858f7 Spell 2015-02-02 13:21:13 +01:00
tqchen
1d21ff87ff add saveload to raw 2015-02-01 21:19:24 -08:00
tqchen
dc3003cefd add saveload to raw 2015-02-01 21:17:37 -08:00
Tong He
6e91846c55 Merge pull request #155 from pommedeterresautee/master
fix mermaid + change in description + new plot importance feature function + fix bug in CV function + add 1 Vignette
2015-02-01 14:12:43 -08:00
El Potaeto
451944c52b CSS 2015-02-01 16:13:18 +01:00
El Potaeto
b31cbdb0a4 modif CSS 2015-02-01 16:13:13 +01:00
pommedeterresautee
a17e29b130 Fix bug in Cross Validation when showsd = FALSE 2015-02-01 14:08:48 +01:00
pommedeterresautee
9f5929497a version stringr 2015-02-01 13:09:27 +01:00
pommedeterresautee
f35950dc46 small change in package version 2015-02-01 13:02:33 +01:00
tqchen
02e98e0534 chg back to g++ 2015-01-30 21:47:49 -08:00
tqchen
3791ae5cf0 Squashed 'subtree/rabit/' changes from fb13cab..1bb8fe9
1bb8fe9 chg makefile

git-subtree-dir: subtree/rabit
git-subtree-split: 1bb8fe9615
2015-01-30 16:50:27 -08:00
tqchen
8b2dbbb782 Merge commit '3791ae5cf0a03aa64c763692cb4a5865816f37b6' 2015-01-30 16:50:27 -08:00
tqchen
b32d4faa82 quick fix seed 2015-01-30 16:50:10 -08:00
tqchen
9725cf2aeb Squashed 'subtree/rabit/' changes from 4ebe657..fb13cab
fb13cab change makefile
1479e37 fixed small bug in mpi submission script
0ca7a63 Update README.md
5ef4830 ok
93a1338 chg note

git-subtree-dir: subtree/rabit
git-subtree-split: fb13cab216
2015-01-30 16:41:06 -08:00
tqchen
25957bb1d4 Merge commit '9725cf2aeb26d5366ab659a59334b601b980f90b' 2015-01-30 16:41:06 -08:00
tqchen
42a4da91b5 chges 2015-01-30 16:40:58 -08:00
Tong He
964c668d44 Update DESCRIPTION 2015-01-29 16:20:13 -08:00
Tong He
f3b2c74153 Update README.md 2015-01-29 15:30:46 -08:00
Tong He
d788bf9aeb Update DESCRIPTION 2015-01-29 15:27:29 -08:00
Tong He
4d79ed9bb1 Update runall.R 2015-01-29 13:30:47 -08:00
El Potaeto
7ec17038f0 improve text of the Vignette 2015-01-29 10:30:50 +01:00
El Potaeto
f71aa2874c Vignette, 1st version 2015-01-28 21:43:18 +01:00
El Potaeto
170dcc49be doc 2015-01-28 21:42:58 +01:00
El Potaeto
e35a9f4822 Merge remote-tracking branch 'upstream/master' 2015-01-28 10:13:58 +01:00
tqchen
16db3ce620 quick fix 2015-01-27 16:31:53 -08:00
tqchen
3e0fba392d fix the integer overflow 2015-01-27 16:29:52 -08:00
pommedeterresautee
d6ef74386d ... 2015-01-27 22:36:35 +01:00
pommedeterresautee
5687af9774 fix error message during check 2015-01-27 22:29:29 +01:00
pommedeterresautee
e06c1da842 new plot feature importance function 2015-01-27 22:26:57 +01:00
tqchen
deb4983273 ok 2015-01-26 10:40:04 -08:00
tqchen
a264bc3969 ok 2015-01-26 10:30:12 -08:00
tqchen
e72174f0f8 add readme 2015-01-26 10:29:34 -08:00
tqchen
1f6b8eb344 Merge branch 'master' of ssh://github.com/tqchen/xgboost
Conflicts:
	.gitignore
2015-01-26 10:28:20 -08:00
tqchen
c34367b207 add msd 2015-01-26 10:27:44 -08:00
Tianqi Chen
97e058dbd7 Update README.md 2015-01-26 09:04:55 -08:00
Tianqi Chen
4266827105 Update README.md 2015-01-26 09:04:34 -08:00
El Potaeto
15dee73795 change in Description 2015-01-26 00:00:14 +01:00
hetong007
5188bad873 fix cv attr 2015-01-25 14:16:46 -08:00
El Potaeto
5e94126963 fix mermaid 2015-01-25 21:07:06 +01:00
El Potaeto
52a2b652d3 Documentation: no need to save model in txt... 2015-01-25 20:16:56 +01:00
hetong
f75387f701 update document 2015-01-25 10:37:11 -08:00
hetong
33101d5cad edit document 2015-01-25 10:31:48 -08:00
Tong He
8971f0ff50 Update xgboost.R 2015-01-25 10:21:24 -08:00
tqchen
f848844310 better warning at multiclass, fix cran check 2015-01-25 10:05:47 -08:00
Tong He
da9f0989c6 Merge pull request #152 from pommedeterresautee/master
Fix global variable message (Cran Checks)
2015-01-22 10:26:15 -08:00
El Potaeto
d188c997f0 add RStudio parameters to exclusion 2015-01-21 23:56:27 +01:00
pommedeterresautee
7f1aff7858 forget one variable 2015-01-21 22:07:30 +01:00
El Potaeto
f1d9fe8153 fix a bug introduced in previous commit 2015-01-21 13:31:17 +01:00
El Potaeto
e475b7d84e Avoid some Cran check error messages 2015-01-21 13:26:34 +01:00
hetong
34e2fbd2c4 fix some issues from the cran check 2015-01-20 21:29:51 -08:00
tqchen
417ac4a631 rm socket from source 2015-01-20 17:15:54 -08:00
hetong007
42110f3d70 documentation update 2015-01-20 16:24:01 -08:00
hetong007
d87cb24793 documentation update 2015-01-20 16:21:13 -08:00
hetong007
6901e90730 resolving not-CRAN issues 2015-01-20 15:51:42 -08:00
hetong007
eb01acfad8 improve demo of cv in R 2015-01-20 14:35:44 -08:00
hetong007
947f0a926d enable returning prediction in cv 2015-01-20 14:12:45 -08:00
tqchen
6937384e62 Squashed 'subtree/rabit/' changes from 85b7463..4ebe657
4ebe657 fix in cxx11

git-subtree-dir: subtree/rabit
git-subtree-split: 4ebe657dd7
2015-01-19 21:37:23 -08:00
tqchen
89d5e67b78 Merge commit '6937384e625dd44b181d0216fde6234be1b7c874' 2015-01-19 21:37:23 -08:00
tqchen
cd2bce4719 update with new rabit api 2015-01-19 21:32:25 -08:00
tqchen
ea50f8e030 Squashed 'subtree/rabit/' changes from 1db6449..85b7463
85b7463 change def of reducer to take function ptr
fe6366e add engine base
a98720e more deps

git-subtree-dir: subtree/rabit
git-subtree-split: 85b746394e
2015-01-19 21:26:25 -08:00
tqchen
25cf27d50f Merge commit 'ea50f8e030111f659dd69b89c86eba51abd39eba' 2015-01-19 21:26:25 -08:00
hetong
3b190123c8 update demo readme 2015-01-19 19:29:24 -08:00
hetong
c0c6951b73 fix bug in format of input 2015-01-19 19:26:25 -08:00
hetong
f295177b1d add nrow to getinfo 2015-01-19 13:36:53 -08:00
hetong
a1e188aa75 add nrow to getinfo 2015-01-19 13:35:11 -08:00
hetong
43c13d82ba add leaf example in R 2015-01-19 10:34:14 -08:00
tqchen
312546b99d quick fix 2015-01-19 10:00:28 -08:00
tqchen
7c6cf4bad8 quick fix 2015-01-19 09:59:33 -08:00
Tianqi Chen
1ea23d3390 Merge pull request #149 from tqchen/unity
add proptype of predleaf in R, fix bug in lambda rank
2015-01-19 09:08:19 -08:00
tqchen
632fdbbf5c add proptype of predleaf in R, fix bug in lambda rank 2015-01-19 09:07:37 -08:00
Tianqi Chen
9b3a601ede Merge pull request #148 from tqchen/unity
Distributed XGBoost from unity
2015-01-19 08:45:07 -08:00
tqchen
b9650f19c1 change tracker dir 2015-01-19 08:41:14 -08:00
tqchen
c1f84ba446 add note to subtree 2015-01-19 08:39:26 -08:00
tqchen
902f84cf4a ok 2015-01-19 08:37:17 -08:00
tqchen
9ea6b2f1b8 minor fix 2015-01-19 08:36:19 -08:00
tqchen
f0a412d224 update note 2015-01-19 08:34:35 -08:00
Tianqi Chen
e5c609271f add rabit to xgb 2015-01-19 08:16:54 -08:00
tqchen
ccba73e5d5 remove xgpred 2015-01-19 08:07:50 -08:00
tqchen
1211ea40c9 add single instance prediction 2015-01-19 08:07:22 -08:00
Tianqi Chen
748389f052 fix win compile 2015-01-19 00:29:03 -08:00
Tianqi Chen
8e8926550f fix of Rpack 2015-01-19 00:01:17 -08:00
tqchen
0b55fa6aff Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2015-01-18 22:56:33 -08:00
tqchen
631b092b25 changes 2015-01-18 22:56:29 -08:00
Tianqi Chen
f22ee7cb61 windows changes 2015-01-18 22:54:01 -08:00
tqchen
7780bc45c2 change R build script 2015-01-18 22:14:38 -08:00
tqchen
81749e6b63 Squashed 'subtree/rabit/' changes from c7282ac..1db6449
1db6449 remove include in -I, make things easier to direct compile

git-subtree-dir: subtree/rabit
git-subtree-split: 1db6449b01
2015-01-18 21:31:16 -08:00
tqchen
c51e01da2f Merge commit '81749e6b637997156c481e7f1d74fd319ba7b1d4' into unity 2015-01-18 21:31:16 -08:00
tqchen
ba0b950a84 add sync module 2015-01-18 21:31:09 -08:00
tqchen
d87691ec60 Squashed 'subtree/rabit/' content from commit c7282ac
git-subtree-dir: subtree/rabit
git-subtree-split: c7282acb2a
2015-01-18 21:08:17 -08:00
tqchen
152e08974d Merge commit 'd87691ec603db325d5b1c5db1186295a748df7cc' as 'subtree/rabit' 2015-01-18 21:08:17 -08:00
tqchen
07da390575 add subtree folder 2015-01-18 21:07:31 -08:00
tqchen
9695c51ce1 Merge branch 'master' into unity 2015-01-18 20:09:36 -08:00
tqchen
f49fd88de8 Merge branch 'unity'
Conflicts:
	.gitignore
	R-package/src/xgboost_R.cpp
	src/gbm/gblinear-inl.hpp
	tools/xgcombine_buffer.cpp
2015-01-18 20:09:21 -08:00
Tianqi Chen
d50079f993 Merge pull request #145 from pommedeterresautee/master
refactoring
2015-01-18 14:57:44 -08:00
El Potaeto
d84d27ae3d refactoring 2015-01-18 00:35:38 +01:00
tqchen
b898672753 ok 2015-01-15 22:03:32 -08:00
tqchen
90ec783e65 remove build 2015-01-15 22:01:55 -08:00
tqchen
4715672d76 chg 2015-01-15 22:01:29 -08:00
tqchen
b1df8039a0 ignore 2015-01-15 21:56:39 -08:00
tqchen
b1f89f29b8 cleanup multi-node 2015-01-15 21:55:56 -08:00
tqchen
b762231b02 change makefile to lazy checkpt, fix col splt code 2015-01-15 21:32:31 -08:00
Tianqi Chen
962c2432a0 Merge pull request #143 from cblsjtu/unity
modify doc
2015-01-14 10:07:33 -08:00
Boliang Chen
4d30fa2449 Merge branch 'unity' of github.com:tqchen/xgboost into unity
Conflicts:
	multi-node/hadoop/README.md
2015-01-14 22:36:39 +08:00
Boliang Chen
ede1222b02 modify doc 2015-01-14 22:15:31 +08:00
Tong He
bbbc6be58e Add vcd to the dependencies 2015-01-13 15:38:50 -08:00
tqchen
a53f0cd9bf doc chg 2015-01-12 11:55:42 -08:00
tqchen
9346c328cb chg 2015-01-12 11:53:40 -08:00
tqchen
2a9a864b11 ok 2015-01-12 11:50:18 -08:00
tqchen
6b7f20c002 chgs 2015-01-12 11:49:42 -08:00
tqchen
5e0e8a5ff7 changes 2015-01-12 11:47:46 -08:00
tqchen
083c032319 Merge branch 'cblsjtu-unity' into unity 2015-01-12 11:41:59 -08:00
tqchen
48a44b24f9 Merge branch 'unity' of https://github.com/cblsjtu/xgboost into cblsjtu-unity
Conflicts:
	multi-node/hadoop/README.md
	multi-node/hadoop/mushroom.hadoop.conf
	multi-node/hadoop/run_hadoop_mushroom.sh
2015-01-12 11:41:07 -08:00
Tianqi Chen
d57cb4f17b Update mushroom.hadoop.conf 2015-01-12 09:02:53 -08:00
tqchen
62a108a7c2 chg of hadoop script 2015-01-11 21:02:38 -08:00
Tianqi Chen
166e7525da Merge pull request #142 from pommedeterresautee/master
avoid warning message when a tree is just made of one leaf
2015-01-11 16:02:56 -08:00
El Potaeto
48c1911bc4 fix error 2015-01-11 23:39:24 +01:00
El Potaeto
d441a9d382 avoid error when a tree is just made of one leaf 2015-01-11 23:37:02 +01:00
Tianqi Chen
9a2ad91b48 Merge pull request #138 from pommedeterresautee/master
new parameters, refactoring...
2015-01-11 14:27:38 -08:00
Tianqi Chen
15bf8677da Merge pull request #140 from EricChenDM/unity
yarn script
2015-01-11 10:40:04 -08:00
chenshuaihua
0111a14aef yarn script 2015-01-11 23:57:52 +08:00
Boliang Chen
df3f87c182 add more details 2015-01-11 18:20:16 +08:00
Boliang Chen
fdbca6013d modify 2015-01-11 17:57:41 +08:00
El Potaeto
31a3b38ef8 add new parameters model to avoid the use of dump file for functions plot, dt.tree, importance
add new size parameter for plot function
2015-01-11 09:40:55 +01:00
Boliang Chen
ef2518364c change to minimal setting 2015-01-11 16:07:00 +08:00
Boliang Chen
525c1594e5 revise the script 2015-01-11 16:06:19 +08:00
Tianqi Chen
c38f7109bd Merge pull request #137 from cblsjtu/unity
Unity hadoop version scripts
2015-01-10 23:47:52 -08:00
tqchen
69e079941e allow pred to stdout 2015-01-10 23:46:29 -08:00
Boliang Chen
ceabf5755f hadoop version conf 2015-01-11 15:44:16 +08:00
Boliang Chen
fb65356dd4 change file name 2015-01-11 15:41:46 +08:00
Boliang Chen
2f95968a1c ok 2015-01-11 15:34:55 +08:00
Boliang Chen
966416e69c Merge remote-tracking branch 'tqchen/unity' into unity 2015-01-11 13:48:29 +08:00
tqchen
db4637b085 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2015-01-10 21:33:16 -08:00
tqchen
9eaf073e3c change default distributed mode to row 2015-01-10 21:33:07 -08:00
Boliang Chen
d5e9b1d4ea delete hadoop conf 2015-01-11 13:08:52 +08:00
El Potaeto
c8c5789efd add new parameters to several functions avoid the need of a text dump 2015-01-11 03:06:41 +01:00
El Potaeto
70df227689 dump function is now memory safe 2015-01-11 01:04:54 +01:00
Tianqi Chen
d348f83c17 Merge pull request #136 from cblsjtu/unity
hadoop example
2015-01-10 09:31:06 -08:00
Boliang Chen
7665dd1ed2 rename 2015-01-11 00:04:47 +08:00
Boliang Chen
74348c8001 initialize 2015-01-11 00:00:03 +08:00
Boliang Chen
24f99220cb fix bugs 2015-01-10 23:59:25 +08:00
Boliang Chen
61a43111a7 hadoop version of xgboost binary classification script 2015-01-10 12:30:00 +08:00
Boliang Chen
e20d4f4387 comment some parameters not supported by hadoop version of xgboost 2015-01-10 12:26:43 +08:00
Tianqi Chen
72f6fbd46f Merge pull request #135 from pommedeterresautee/master
fix a small bug in CV function
2015-01-09 10:06:22 -08:00
El Potaeto
359889e3d6 fix a small bug in CV function 2015-01-09 19:03:47 +01:00
Tianqi Chen
75a75bc1e9 Merge pull request #134 from pommedeterresautee/master
nice work! merged to master.
2015-01-09 09:46:53 -08:00
El Potaeto
99b4ead937 add new dependency on DiagrammeR 2015-01-09 18:28:10 +01:00
El Potaeto
a3493934d1 documentation example change 2015-01-09 18:26:56 +01:00
El Potaeto
51935851bd fix plenty of small bugs 2015-01-09 18:24:12 +01:00
El Potaeto
b656ca1554 reindent 2015-01-09 11:54:23 +01:00
El Potaeto
d96bd15b7d small fix in the C dump code 2015-01-09 11:52:40 +01:00
El Potaeto
31d0e8f65d better doc of dump function 2015-01-09 11:14:08 +01:00
El Potaeto
9d6eecf34e small change in import lib 2015-01-09 11:07:53 +01:00
El Potaeto
10f755e055 only replace tabulation which begins a line (avoid wrong replacement in feature name) 2015-01-09 11:06:56 +01:00
El Potaeto
3e1eea0eea refactor dump function to adapt to the new possibilities of exporting a String 2015-01-09 00:14:01 +01:00
El Potaeto
6fd8bbe71a C part export a model dump string 2015-01-08 23:47:00 +01:00
El Potaeto
3d0bbae2c2 refactoring of importance function 2015-01-07 18:18:52 +01:00
El Potaeto
d532f04394 add new function to read model and use it in the plot function 2015-01-07 17:47:50 +01:00
El Potaeto
e380e4facf refactoring for perf 2015-01-07 17:09:56 +01:00
El Potaeto
cce26756bf add style option 2015-01-07 17:05:34 +01:00
pommedeterresautee
9e20893d35 Change in aesthetic
Improve documentation
2015-01-06 23:57:33 +01:00
El Potaeto
3dd202a19e Add stat indicators in plot 2015-01-06 18:18:55 +01:00
El Potaeto
94d070da60 add limit number of trees option 2015-01-06 13:59:29 +01:00
El Potaeto
a6c588f90d fix arg check 2015-01-06 13:59:14 +01:00
Boliang Chen
f82732a362 add hadoop folder 2015-01-06 17:09:15 +08:00
El Potaeto
c64bfad5bb fix import issue 2015-01-05 19:35:33 +01:00
El Potaeto
59412f64ad Merge remote-tracking branch 'upstream/master' 2015-01-05 19:30:29 +01:00
El Potaeto
f793df671b Change code to look like a function 2015-01-05 19:26:26 +01:00
El Potaeto
3d068b4e1a new documentation
new import
2015-01-05 19:26:09 +01:00
El Potaeto
b9799c6ac4 refactor plot function 2015-01-04 22:42:17 +01:00
El Potaeto
ffbd78fce4 use style CSS class instead of q style per item 2015-01-04 22:40:31 +01:00
El Potaeto
f6290ad792 plot all trees 2015-01-04 21:56:41 +01:00
El Potaeto
33bb168574 basis to plot 2015-01-04 17:23:53 +01:00
tqchen
2925236fab change dump stats 2015-01-04 02:35:24 -08:00
El Potaeto
8b45ef07ca build data.table from raw model data 2015-01-04 11:21:39 +01:00
El Potaeto
cfe5015e54 small fix in parsing 2015-01-04 11:21:03 +01:00
El Potaeto
cdea1685e5 Add a new verbose parameter to print progress during the process (set to true by default to not change behavior of existing code) + source code refactoring 2015-01-02 11:21:53 +01:00
Tianqi Chen
61df646eed Merge pull request #132 from pommedeterresautee/master
Return history as data.table for cross validation + bring back linear model dump to master + other fixes
2015-01-02 17:06:24 +08:00
El Potaeto
4d0d65837d parse history first line to guess which columns are required 2015-01-01 22:43:23 +01:00
El Potaeto
8bbe45eed2 fix some missing imports 2015-01-01 16:09:03 +01:00
El Potaeto
a524a51a06 return history as data.table for cross validation + documentation 2015-01-01 16:05:43 +01:00
El Potaeto
34aaeff3d9 small documentation change 2015-01-01 14:57:48 +01:00
El Potaeto
5e5500d6d3 rewording 2015-01-01 13:50:28 +01:00
El Potaeto
901904b535 linear text dump model 2015-01-01 13:50:05 +01:00
Tianqi Chen
3974231440 Merge pull request #130 from pommedeterresautee/master
Improve demo text (more explanation)
2014-12-31 18:32:13 +08:00
El Potaeto
d07be2bb96 Username parameter is deprecated in install_function (see doc of the package for more information). 2014-12-31 11:03:51 +01:00
El Potaeto
4f0ae53974 text change 2014-12-31 10:49:05 +01:00
El Potaeto
9998575c32 Small text improvement 2014-12-31 10:47:57 +01:00
El Potaeto
4cc3790b76 Improve explanation, add new concepts. 2014-12-31 10:36:10 +01:00
Tianqi Chen
4183c239ca Merge pull request #128 from mhue/master
Fixed minor typos.
2014-12-31 09:04:30 +08:00
El Potaeto
c3d8f21df3 change assignation sign 2014-12-31 00:52:53 +01:00
Bing Xu
9267e3b368 Merge pull request #129 from pommedeterresautee/master
Add demo code
2014-12-30 16:51:11 -07:00
El Potaeto
006578e2e6 fix demo index 2014-12-31 00:46:12 +01:00
El Potaeto
97fd9b47d4 Add new demo 2014-12-31 00:39:13 +01:00
Martial Hue
79731f48b6 Fixed minor typos. 2014-12-30 17:50:24 +01:00
El Potaeto
7558a94507 Update wlkthrough R demo code to include variable importance. 2014-12-30 16:38:56 +01:00
El Potaeto
8e74bcdd05 remove unneeded text... 2014-12-30 16:29:13 +01:00
El Potaeto
2364e914bd Documentation regenerated with fixes 2014-12-30 16:24:16 +01:00
El Potaeto
e64cb99f89 Missing parameter documentation
Fix data documentation
2014-12-30 16:22:50 +01:00
El Potaeto
af31397ec2 Missing parameter documentation 2014-12-30 16:22:24 +01:00
El Potaeto
31ed2813bd Spell 2014-12-30 16:05:12 +01:00
El Potaeto
45a006f367 R demo code README 2014-12-30 16:04:43 +01:00
El Potaeto
345b93fcfa fix link 2014-12-30 15:03:21 +01:00
El Potaeto
d8eb978f98 Update readme with new win on Kaggle 2014-12-30 15:00:52 +01:00
cblsjtu
01f640f8a6 Merge pull request #1 from tqchen/unity
Unity
2014-12-30 20:26:12 +08:00
Tianqi Chen
39bb719063 Merge pull request #125 from pommedeterresautee/master
Take gain into account for feature importance
2014-12-30 19:50:19 +08:00
El Potaeto
c6f76fab56 add new Gain and Weight columns.
documentation updated.
2014-12-30 12:32:58 +01:00
El Potaeto
c754fd4ad0 documentation wording 2014-12-30 12:32:21 +01:00
El Potaeto
3694772bde Add a new Weight and Gain column.
Update documentation.
2014-12-30 12:16:13 +01:00
tqchen
5ad100b5a3 now support distributed evaluation 2014-12-29 19:24:08 -08:00
tqchen
c395c5bed3 update build script 2014-12-29 17:41:47 -08:00
El Potaeto
78813d8f78 wording 2014-12-30 00:12:01 +01:00
El Potaeto
263f7fa69d Take gain into account to discover most important variables 2014-12-29 23:57:41 +01:00
El Potaeto
dba1ce7050 new dependency over stringr 2014-12-29 23:57:01 +01:00
El Potaeto
9b6a14a99d regeneration of documentation 2014-12-29 23:56:31 +01:00
El Potaeto
755be4b846 Add variable type checks 2014-12-29 10:31:17 +01:00
tqchen
6b96737811 add dump statistics 2014-12-28 17:45:37 -08:00
Tianqi Chen
0c7e090c19 Merge pull request #124 from pommedeterresautee/master
Add a new function to see importance of features in a model
2014-12-28 20:06:55 +08:00
El Potaeto
99af2c8ffd Documentation of the function 2014-12-28 11:33:14 +01:00
El Potaeto
84fb89af70 fix small bug introduced in refactoring 2014-12-28 11:30:55 +01:00
El Potaeto
2154a160a3 refactoring of validation to improve source code readability. 2014-12-28 11:18:26 +01:00
El Potaeto
151285300b change version number + date 2014-12-28 11:02:48 +01:00
El Potaeto
46862e561b Add .gitignore 2014-12-28 10:47:02 +01:00
El Potaeto
ce83611a72 generated documentation with ROxygen2 2014-12-28 10:46:31 +01:00
El Potaeto
e63c79d6c6 new function cv.importance + documentation 2014-12-28 10:45:47 +01:00
El Potaeto
8c17a86b38 Update Namespace with new function 2014-12-28 10:24:43 +01:00
El Potaeto
1d64cd8896 Add new dependency 2014-12-28 10:24:08 +01:00
El Potaeto
4369a57270 fix data labels 2014-12-28 09:56:55 +01:00
tqchen
c8f422b3b9 add dump to linear model 2014-12-24 02:56:32 -08:00
tqchen
6d7ef172ef add base64 model format 2014-12-24 02:33:50 -08:00
tqchen
c8396ca24e add mock exec 2014-12-21 18:47:56 -08:00
tqchen
677475529f fix the row split recovery, add per iteration random number seed 2014-12-21 17:31:42 -08:00
tqchen
eff5c6baa8 push in row mock file 2014-12-21 04:36:18 -08:00
tqchen
d603852828 rm boost str 2014-12-21 00:17:27 -08:00
tqchen
31eedfea59 pas mock, need to fix rabit lib for not initialization 2014-12-21 00:14:00 -08:00
tqchen
b078663982 ok 2014-12-20 16:39:39 -08:00
tqchen
7a35e1a906 change hist update to lazy 2014-12-20 05:02:38 -08:00
tqchen
deb21351b9 add rabit checkpoint to xgb 2014-12-20 01:05:40 -08:00
tqchen
8e16cc4617 change allreduce lib to rabit library, xgboost now run with rabit 2014-12-20 00:17:09 -08:00
Tianqi Chen
646f33d01d Update README.md 2014-12-12 05:47:00 -08:00
Tianqi Chen
a50fd27fd3 Update README.md 2014-12-12 05:46:32 -08:00
Tianqi Chen
5ae99372d6 Update simple_dmatrix-inl.hpp 2014-11-26 09:13:49 -08:00
Tianqi Chen
be5fb800d5 Merge pull request #112 from tfgit/master
Fixed README
2014-11-25 19:29:41 -08:00
Ted Fujimoto
baf41d589d Fixed README 2014-11-25 22:17:36 -05:00
Tianqi Chen
8d7dbc65b3 Merge pull request #111 from tfgit/master
OS X OpenMP support instructions
2014-11-25 19:12:42 -08:00
Ted Fujimoto
198489438f Added OS X OpenMP instructions 2014-11-25 21:42:13 -05:00
Ted Fujimoto
c356a0acc2 Remove tools folder 2014-11-25 21:27:50 -05:00
Tianqi Chen
cdcfa5687a Update socket.h 2014-11-23 22:46:57 -08:00
tqchen
f53be2884a ok 2014-11-23 22:42:44 -08:00
Tianqi Chen
f805ecb5f3 fix a bug in node sindex set 2014-11-23 22:35:30 -08:00
tqchen
3e162ceda6 windows strange 2014-11-23 22:21:15 -08:00
tqchen
35bf2101fe seems a prob in win 2014-11-23 22:18:28 -08:00
Tianqi Chen
fde580b08e fix windows run 2014-11-23 22:12:55 -08:00
tqchen
77ffd0465b ok 2014-11-23 21:36:22 -08:00
tqchen
78ca72b9c7 start work on win 2014-11-23 21:34:15 -08:00
tqchen
d2f151ef5a bring it back alive again 2014-11-23 21:27:16 -08:00
Tianqi Chen
7f3dc967cf changes in socket, a bit work in linux side first 2014-11-23 21:21:52 -08:00
tqchen
db2adb6885 start check windows compatiblity 2014-11-23 20:59:10 -08:00
Tianqi Chen
2e444f8338 remove warning from MSVC need another round of check 2014-11-23 20:52:13 -08:00
tqchen
b55fe80350 add row map example 2014-11-23 18:15:42 -08:00
tqchen
372de9f968 check in conf 2014-11-23 17:35:21 -08:00
tqchen
373620503a ok 2014-11-23 14:08:34 -08:00
tqchen
5f08313cb2 make wrapper ok 2014-11-23 14:03:59 -08:00
tqchen
69b2f31098 bugfix in allreduce 2014-11-23 11:31:34 -08:00
tqchen
115424826b basic test pass 2014-11-23 11:15:48 -08:00
tqchen
c499dd0f0c start testing allreduce 2014-11-22 22:55:43 -08:00
tqchen
cb1c34aef0 add nonblocking mode 2014-11-22 17:15:05 -08:00
tqchen
67c5d8a2e6 allreduce server side ok, need to add master 2014-11-22 17:12:19 -08:00
tqchen
4864220702 have the function, ready, need initializer 2014-11-22 12:15:30 -08:00
tqchen
7ec3fc936a check in allreduce tcp, check if there could be more concise form 2014-11-21 22:54:11 -08:00
tqchen
b6e1b19205 checkin socket module 2014-11-21 16:09:28 -08:00
tqchen
84dcab6795 checkin socket module 2014-11-21 16:09:26 -08:00
Tianqi Chen
c29a600d46 Update README.md 2014-11-21 09:48:59 -08:00
tqchen
168bb0d0c9 add predict leaf indices 2014-11-21 09:32:09 -08:00
Tianqi Chen
6ed82edad7 Merge pull request #106 from tqchen/master
pull master into unity
2014-11-21 08:56:01 -08:00
Tianqi Chen
d4103ea7ea Update README.md 2014-11-20 22:01:26 -08:00
Tong He
c16e0f6809 Update predict.xgb.Booster.R
add parameter missing
2014-11-20 15:19:53 -08:00
Tong He
98ee7e8057 Update xgboost.R
add parameter missing
2014-11-20 15:14:05 -08:00
Tong He
20817b56f3 Update xgb.cv.R
add parameter missing
2014-11-20 15:14:00 -08:00
Tong He
bbd7098e51 Update utils.R
add parameter missing
2014-11-20 15:13:28 -08:00
tqchen
ed87eb61bd allow nan as mssing 2014-11-20 13:14:04 -08:00
tqchen
23fbf079b9 fix bug in row 2014-11-20 12:56:30 -08:00
tqchen
974202eb55 check pipe, commit optimization for hist 2014-11-20 11:22:09 -08:00
tqchen
6b674b491f Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-11-19 20:09:38 -08:00
tqchen
9af464303a checkin row continue training 2014-11-19 20:09:26 -08:00
Tianqi Chen
b595854e8c Update README.md 2014-11-19 20:08:11 -08:00
tqchen
970dd58dc2 checkin continue training 2014-11-19 20:06:08 -08:00
tqchen
26e5eae6f2 ok 2014-11-19 19:27:04 -08:00
tqchen
41eac089c8 chg 2014-11-19 19:25:49 -08:00
tqchen
338117867b small change 2014-11-19 19:24:20 -08:00
tqchen
a0342cb196 small change 2014-11-19 19:22:36 -08:00
tqchen
3b48a9f359 checkin split row 2014-11-19 19:21:56 -08:00
tqchen
c42ba8d281 get multinode in 2014-11-19 19:19:53 -08:00
tqchen
7c3a392136 compile 2014-11-19 15:28:09 -08:00
tqchen
55e62a7120 still need to test row merge 2014-11-19 11:44:24 -08:00
tqchen
da54f5e5d8 add note for col 2014-11-19 11:37:54 -08:00
tqchen
03e24cf590 check multinode 2014-11-19 11:22:17 -08:00
tqchen
54e2ed90d7 recheck column mode 2014-11-19 11:21:07 -08:00
tqchen
dffcbc838b Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity
Conflicts:
	src/tree/updater_histmaker-inl.hpp
2014-11-19 09:55:05 -08:00
tqchen
fa1581b94c cqmaker ok 2014-11-19 09:51:30 -08:00
tqchen
32beb56ba3 only need to add in create hist col base 2014-11-18 22:21:41 -08:00
tqchen
08e9813c9b potential BUG in skmaker? 2014-11-18 21:23:36 -08:00
tqchen
1b66a87456 checkin skmaker 2014-11-18 20:57:28 -08:00
tqchen
303f8b9bc5 hack to make the propose fast in one pass, start sketchmaker 2014-11-18 11:25:54 -08:00
tqchen
ce7ecadf5e simplify 2014-11-18 10:52:18 -08:00
tqchen
5de0a2cdc0 sorted base sketch maker 2014-11-18 10:19:18 -08:00
tqchen
5e8e9a9b74 updated base 2014-11-17 10:49:53 -08:00
tqchen
8874234e5e check in basemaker 2014-11-16 22:23:33 -08:00
tqchen
d11445e0b1 add in sync 2014-11-16 22:01:22 -08:00
tqchen
8ed585a7a2 check in two bad ones, start think of column distribut cut row 2014-11-16 13:31:50 -08:00
tqchen
5061d55725 alrite 2014-11-16 11:47:21 -08:00
tqchen
129fee64f3 fix regression 2014-11-16 11:38:21 -08:00
tqchen
02c2278f96 ok 2014-11-15 21:18:15 -08:00
tqchen
daa28f238e fix compile, need final leaf node? 2014-11-15 21:02:19 -08:00
tqchen
c86b83ea04 a version that compile 2014-11-15 17:41:03 -08:00
tqchen
c1f1bb9206 first ver 2014-11-15 09:46:30 -08:00
tqchen
076159cf7a remove cstdio 2014-11-14 14:37:13 -08:00
Tianqi Chen
b66bcb7974 Merge pull request #100 from travisbrady/master
add ifdef __cplusplus to wrapper header file
2014-11-14 14:33:49 -08:00
Travis Brady
42712988af add ifdef __cplusplus to wrapper header file 2014-11-14 15:48:13 -06:00
tqchen
698c010247 add example 2014-11-10 22:09:01 -08:00
tqchen
e7ea87b5fd ok for now 2014-11-10 22:03:42 -08:00
tqchen
9d101b47f9 optimize heavy hitter 2014-11-10 21:18:37 -08:00
tqchen
b426eef527 chg begin end type 2014-11-10 17:24:44 -08:00
tqchen
9855a90142 unified gk and wq 2014-11-10 17:06:10 -08:00
tqchen
7b8ba268dc commit in quantile test 2014-11-10 16:44:07 -08:00
tqchen
d4c4ee0b01 mostly correct\n 2014-11-09 23:34:45 -08:00
tqchen
69874dc571 init check 2014-11-09 21:56:56 -08:00
tqchen
5561dd9cb0 fix bug in queue2summary 2014-11-09 21:09:07 -08:00
tqchen
7c1ec78a01 before test quantile 2014-11-09 18:03:36 -08:00
tqchen
0e6b899d07 quantile 2014-11-09 16:02:38 -08:00
tqchen
aace84c349 pass group data test 2014-11-06 15:58:36 -08:00
tqchen
539fce2856 ok 2014-11-06 15:37:23 -08:00
tqchen
ca96468745 everything is ready, except for propose 2014-11-02 21:52:59 -08:00
Tianqi Chen
b2850ae0f9 Update README.md 2014-10-23 09:43:03 -07:00
Tianqi Chen
c17c0f3197 Update README.md 2014-10-23 09:41:12 -07:00
tqchen
96c5196647 remv debug 2014-10-20 18:06:15 -07:00
tqchen
23eaa7ed32 add quantile sketch 2014-10-20 18:04:39 -07:00
tqchen
dcd0dd5e26 finish find split, next to do quantile sketch 2014-10-18 10:24:29 -07:00
tqchen
a7bc769971 incomplete histmaker 2014-10-17 17:55:07 -07:00
tqchen
c2fa390181 move sync tree to pruner, pruner is now distributed 2014-10-17 14:53:43 -07:00
tqchen
a68ac8033e refresher is now distributed 2014-10-17 14:48:32 -07:00
tqchen
9df9e07f9b minor change in main 2014-10-17 14:11:46 -07:00
tqchen
f6d61f02f6 fix load bug 2014-10-16 21:47:01 -07:00
tqchen
3f3c90c3c0 add part_load col 2014-10-16 19:41:43 -07:00
tqchen
f512f08437 finish mushroom example 2014-10-16 18:06:47 -07:00
tqchen
0cf2dd39ea new change for mpi 2014-10-16 15:12:10 -07:00
tqchen
a21df0770d make clear seperation 2014-10-16 13:03:42 -07:00
tqchen
47145a7fac ok, now work on update position 2014-10-16 11:56:55 -07:00
tqchen
aefe58a207 middle version 2014-10-16 10:38:49 -07:00
tqchen
6680bffaae chg 2014-10-15 21:45:13 -07:00
tqchen
f2577fec86 intial version of sync wrapper 2014-10-15 21:39:42 -07:00
tqchen
e295128973 add bitmap . 2014-10-15 14:30:09 -07:00
tqchen
d0daecb4d3 add bitmap . 2014-10-15 14:30:06 -07:00
Tianqi Chen
f2cceb37eb Update README.md 2014-10-13 09:21:43 -07:00
tqchen
c957e1a648 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-10-01 09:20:16 -07:00
tqchen
78efa13d41 add example with additional attr 2014-10-01 09:20:06 -07:00
Tianqi Chen
d6b60a1e4a Update README.md 2014-09-18 17:53:20 -07:00
Tianqi Chen
d3f7952991 Update README.md 2014-09-18 17:52:41 -07:00
tqchen
91e34c6fb4 ok 2014-09-12 21:26:38 -07:00
tqchen
bf2426f3cd some changes 2014-09-12 17:31:06 -07:00
tqchen
3a0be47b1c add tmp file 2014-09-12 15:52:39 -07:00
tqchen
87cc53f0cd make basic combine buf 2014-09-10 21:38:50 -07:00
tqchen
fe9e89cadd Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-09-10 21:33:51 -07:00
tqchen
0e8846a42f ok 2014-09-10 13:51:34 -07:00
Tianqi Chen
496301585a Update README.md 2014-09-09 21:43:45 -07:00
Tianqi Chen
4275403004 Update README.md 2014-09-09 21:38:01 -07:00
Tianqi Chen
c380342c5f Update README.md 2014-09-09 21:35:24 -07:00
Tianqi Chen
2fec85ab8a Update README.md 2014-09-09 21:34:10 -07:00
Tianqi Chen
86bdef1f19 Update README.md 2014-09-09 21:31:40 -07:00
Tianqi Chen
9e701440e7 Update README.md 2014-09-09 21:28:58 -07:00
Tianqi Chen
1a6af1aacf Update README.md 2014-09-09 21:28:19 -07:00
Tianqi Chen
011df2993a Update README.md 2014-09-09 21:27:01 -07:00
tqchen
7d0d3f07ef Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-09-08 21:52:34 -07:00
tqchen
a3806398b9 delete old cvpack 2014-09-08 21:34:42 -07:00
tqchen
a3d5930f26 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-09-08 16:20:48 -07:00
tqchen
e90b25a381 add object bound checking 2014-09-08 16:20:41 -07:00
Tianqi Chen
4e44dd83a7 Merge pull request #72 from giuliohome/master
python 3 encoding
2014-09-08 14:49:53 -07:00
giuliohome
02e41be857 python 3 encoding 2014-09-08 23:40:04 +02:00
tqchen
d4ab359be1 fix 2014-09-07 20:01:03 -07:00
tqchen
19a1ee24a5 try predpath 2014-09-07 18:40:15 -07:00
tqchen
75aa5bd258 Merge branch 'master' into unity 2014-09-07 18:16:55 -07:00
tqchen
ae3621b372 Merge branch 'unity'
Conflicts:
	R-package/src/xgboost_R.cpp
	wrapper/xgboost.py
2014-09-07 18:16:49 -07:00
Tianqi Chen
852ce6be0b Update README.md 2014-09-07 16:48:45 -07:00
Tong He
946f3c7ac5 Update DESCRIPTION 2014-09-07 10:36:50 -07:00
tqchen
5621d9811f remove deprecate 2014-09-07 10:17:34 -07:00
hetong
9e3b878943 refine style with max.depth 2014-09-06 23:20:11 -07:00
hetong
1925321a16 remove incorrect link to old folders 2014-09-06 23:14:38 -07:00
hetong
80636cd804 improve runall.R 2014-09-06 23:06:47 -07:00
hetong
cd35d88a03 remove inst/, improve vignette 2014-09-06 23:05:21 -07:00
hetong
50d77c72eb Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-06 22:48:24 -07:00
hetong
fbecd163c5 replace iris in docs 2014-09-06 22:48:08 -07:00
tqchen
89b9965cbf change max depth 2014-09-06 22:40:51 -07:00
Tianqi Chen
32a2925be8 Update build.sh 2014-09-06 22:27:25 -07:00
Tianqi Chen
2d2cee879d Update build.sh 2014-09-06 22:26:35 -07:00
tqchen
17ebdde707 chg back to g++ 2014-09-06 22:21:50 -07:00
tqchen
014e830a04 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-09-06 22:20:18 -07:00
tqchen
a7a0b34a54 add auto build script 2014-09-06 22:20:11 -07:00
hetong
ddf715953a forced add doc for test 2014-09-06 22:03:07 -07:00
hetong
d174a79fbd add doc for agaricus.test 2014-09-06 21:54:12 -07:00
hetong
43a781f59b improvement for reducing warnings 2014-09-06 21:28:42 -07:00
hetong
d214013681 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-06 19:02:56 -07:00
hetong
e04b6aaec5 add documentation for datasets 2014-09-06 19:02:23 -07:00
Tianqi Chen
e7bce3a940 Update xgb.DMatrix.save.R 2014-09-06 18:38:01 -07:00
Tianqi Chen
67fc1dd990 Update xgb.DMatrix.save.R 2014-09-06 18:37:34 -07:00
hetong
99b7ead5ad re-compress the data 2014-09-06 18:29:13 -07:00
hetong
a9bdf38885 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-06 11:23:19 -07:00
tqchen
09e39e5901 chg pack file 2014-09-06 11:21:54 -07:00
hetong
c3cef7e2c7 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-06 11:17:43 -07:00
hetong
f1d7b012a6 refine doc, with Rd 2014-09-06 11:17:38 -07:00
tqchen
515befd4f9 remove runall 2014-09-06 11:15:10 -07:00
tqchen
a42bcaf61f add 2014-09-06 11:14:32 -07:00
tqchen
e9ed4eb1a2 ok 2014-09-06 11:13:19 -07:00
tqchen
7879db8702 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-09-06 10:29:42 -07:00
tqchen
35431e664e add boost from prediction 2014-09-06 10:28:48 -07:00
hetong
166df74024 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-06 10:20:05 -07:00
hetong
a35d93c736 change data from iris back to mushroom 2014-09-06 10:19:46 -07:00
tqchen
4a8612defc add customize objective 2014-09-06 10:19:19 -07:00
tqchen
b858283ec5 add basic walkthrough 2014-09-06 10:11:45 -07:00
hetong
8ad9293437 expose setinfo 2014-09-06 00:44:24 -07:00
hetong
9e05db7261 add mushroom data 2014-09-06 00:26:02 -07:00
hetong
3014ac6778 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-06 00:23:02 -07:00
hetong
bb2c61f7b5 custom eval 2014-09-06 00:16:55 -07:00
tqchen
6157d538c1 check in current iris 2014-09-05 23:22:54 -07:00
hetong
4d00be84c3 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-05 23:04:00 -07:00
hetong
905051b7cb in the middle of guide-r 2014-09-05 23:03:04 -07:00
tqchen
ab238ff831 chg cv 2014-09-05 22:46:09 -07:00
tqchen
831a102d48 add cv 2014-09-05 22:36:59 -07:00
tqchen
0ecd6c08f3 add cross validation 2014-09-05 22:34:32 -07:00
tqchen
bc1817ca2f Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-09-05 20:34:46 -07:00
tqchen
984102e586 style cleanup, incomplete CV 2014-09-05 20:34:41 -07:00
hetong
af07f5135a cleaning 2014-09-05 20:33:39 -07:00
hetong
63dd037db6 add r basic walkthrough 2014-09-05 20:25:38 -07:00
hetong
de08c5a3da remove temp files 2014-09-05 19:49:25 -07:00
hetong
801a17fa02 fix iris to Rd files 2014-09-05 19:47:58 -07:00
hetong
d776e0fdf5 fix iris multiclass problem 2014-09-05 19:22:27 -07:00
Tianqi Chen
2b170ecda4 Merge pull request #69 from giuliohome/fix
Fixing Configuration Type for Win32/Debug.

Thanks Giulio!
2014-09-05 08:41:34 -07:00
giuliohome
59e1e75857 same version
reset changes
2014-09-05 13:37:18 +02:00
giuliohome
1d90288655 Fixing Configuration Type for Win32/Debug
Proposed fix to the main repo
Changed the windows wrapper type to DynamicLibrary. It was already ok
for the Win64/Release. maybe it got lost after latest commit
2014-09-05 13:30:02 +02:00
giuliohome
efbd1b21a6 Merge branch 'tqchen-master' 2014-09-05 13:26:20 +02:00
giuliohome
909a61edac Merge branch 'master' of https://github.com/tqchen/xgboost into tqchen-master
Conflicts:
	README.md
2014-09-05 13:24:45 +02:00
giuliohome
73b627d532 Fixing Configuration Type for Win32/Debug
Proposed fix to the main repo
Changed the windows wrapper type to DynamicLibrary. It was already ok
for the Win64/Release. maybe it got lost after latest commit
2014-09-05 13:08:06 +02:00
tqchen
e8df76b131 make it cleaner 2014-09-04 21:22:02 -07:00
tqchen
80bf8b71f2 OK 2014-09-04 21:21:26 -07:00
tqchen
a9dc145433 add what is new 2014-09-04 21:20:27 -07:00
tqchen
0752b8b9f3 change readme 2014-09-04 21:12:25 -07:00
tqchen
512a0f69fd add glm 2014-09-04 21:09:52 -07:00
tqchen
f9f982a7aa Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-09-04 20:58:05 -07:00
tqchen
a1c6e22af9 add create from csc 2014-09-04 20:57:49 -07:00
tqchen
df3eafc5ba chg mldata to page 2014-09-04 14:20:52 -07:00
antinucleon
1222839efa higgs cv 2014-09-04 11:00:42 -06:00
tqchen
2bc1d2e73a fix doc 2014-09-04 09:23:35 -07:00
tqchen
6c6d00261c small fix to the doc 2014-09-04 09:18:52 -07:00
tqchen
da9c856701 add cv for python 2014-09-03 22:43:55 -07:00
Tianqi Chen
586d6ae740 Update basic_walkthrough.py 2014-09-03 22:05:56 -07:00
Tianqi Chen
d4b62e679d Update README.md 2014-09-03 22:05:13 -07:00
Tianqi Chen
b078c159bd Update README.md 2014-09-03 21:42:28 -07:00
giuliohome
3f11354adb Parallel execution of CV plus double inputted model 2014-09-03 23:14:31 +02:00
tqchen
46cddb80f4 Merge branch 'mastet push origin unityr' into unity 2014-09-03 13:52:11 -07:00
tqchen
5f6e849b21 Merge branch 'unity'
Conflicts:
	src/utils/io.h
	wrapper/xgboost.py
2014-09-03 13:52:03 -07:00
tqchen
8952d9c357 fix 2014-09-03 13:28:03 -07:00
tqchen
b2586b6130 ok 2014-09-03 13:27:06 -07:00
tqchen
5cd92e33f6 remove R for now 2014-09-03 13:24:34 -07:00
tqchen
e6359b5484 ok 2014-09-03 13:23:36 -07:00
tqchen
60e1167b56 fix doc 2014-09-03 13:20:23 -07:00
tqchen
7a61f0dca2 ok 2014-09-03 13:18:36 -07:00
tqchen
c1e0ff0326 push python examples in 2014-09-03 13:15:17 -07:00
tqchen
41ea0bf97a Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-09-03 13:14:00 -07:00
tqchen
fa11840f4b move python example 2014-09-03 13:13:54 -07:00
Tianqi Chen
3192bf82d8 Update xgboost.py 2014-09-03 12:15:57 -07:00
antinucleon
0c36231ea3 chg 2014-09-03 12:57:05 -06:00
tqchen
998ca3bdc9 make some changes to cv 2014-09-03 11:46:33 -07:00
tqchen
244a589e5d change include order, so that Rinternal does not disturb us 2014-09-03 11:31:05 -07:00
antinucleon
2182ebcba1 Merge branch 'master' of github.com:tqchen/xgboost 2014-09-03 00:38:06 -06:00
antinucleon
02dd8d1212 chg 2014-09-03 00:37:55 -06:00
Tianqi Chen
85dbaf638b Update xgboost.Rnw 2014-09-02 23:33:04 -07:00
Tianqi Chen
642b5bda0a Update DESCRIPTION 2014-09-02 23:30:53 -07:00
Tianqi Chen
582ef2f9d5 Update DESCRIPTION 2014-09-02 23:29:48 -07:00
tqchen
06b5533209 chg fobj back to obj, to keep parameter name unchanged 2014-09-02 23:15:41 -07:00
tqchen
ac8958b284 move custom obj build in into booster 2014-09-02 23:07:50 -07:00
tqchen
10648a1ca7 remove using std from cpp 2014-09-02 22:43:19 -07:00
tqchen
1dbcebb6fe fix cxx98 2014-09-02 22:12:28 -07:00
tqchen
65340ffda6 quick lint 2014-09-02 17:51:05 -07:00
tqchen
401d648372 some lint 2014-09-02 17:49:39 -07:00
tqchen
e6e467ad60 more ignore 2014-09-02 17:40:30 -07:00
tqchen
f3360d173b pass trival test 2014-09-02 17:38:51 -07:00
tqchen
226d26d40c still buggy 2014-09-02 17:18:17 -07:00
tqchen
a89e3063e6 untested version of cpage 2014-09-02 15:34:11 -07:00
tqchen
e4817bb4c3 fix ntreelimit 2014-09-02 15:05:49 -07:00
antinucleon
5177fa02e4 adjust weight 2014-09-02 15:22:08 -06:00
tqchen
4b9aeea89c finish the fmatrix 2014-09-02 13:14:54 -07:00
tqchen
76c513b191 t push origin unityMerge branch 'master' into unity 2014-09-02 11:22:57 -07:00
tqchen
eeb04a0603 Merge remote-tracking branch 'origin/unity'
Conflicts:
	R-package/src/Makevars
	R-package/src/Makevars.win
	src/utils/io.h
	wrapper/xgboost.py
2014-09-02 11:22:47 -07:00
tqchen
c75275a861 more movement to beginptr 2014-09-02 11:14:57 -07:00
tqchen
27cabd131e add beginPtr, to make vector address taking safe 2014-09-02 11:01:38 -07:00
tqchen
70219ee1ae move nthread to local var 2014-09-02 09:06:24 -07:00
tqchen
28128a1b6e fix new warning 2014-09-02 09:02:27 -07:00
tqchen
1d5db6877d fix param.h 2014-09-02 08:55:26 -07:00
tqchen
c9f2f47acb fix som solaris 2014-09-02 00:12:15 -07:00
tqchen
bb5c151f57 move sprintf into std 2014-09-01 23:12:50 -07:00
tqchen
29a7027dba fix the zero length vector 2014-09-01 22:50:48 -07:00
tqchen
9100ffc12a chg version 2014-09-01 22:32:03 -07:00
tqchen
42fb7b4d9d some fix to make it more c++ 2014-09-01 22:06:10 -07:00
tqchen
e43bb91185 add matrix builder 2014-09-01 21:30:03 -07:00
tqchen
9d3e09ff2a make rowbatch page flexible 2014-09-01 20:44:15 -07:00
Tianqi Chen
50f1b5d903 Update README.md 2014-09-01 19:00:37 -07:00
Tianqi Chen
b60b23ed1c Update README.md 2014-09-01 18:58:56 -07:00
Tianqi Chen
48411193ae Update README.md 2014-09-01 18:58:00 -07:00
Tianqi Chen
1841d730af Update README.md 2014-09-01 18:55:20 -07:00
Tianqi Chen
85e3fbb06a Update README.md 2014-09-01 18:54:45 -07:00
Tianqi Chen
51a9a36b51 Update DESCRIPTION 2014-09-01 18:53:24 -07:00
hetong
76d5fc7e78 attemp to fix line breaking issue of doc 2014-09-01 17:43:28 -07:00
hetong
19887dcc37 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-09-01 17:24:37 -07:00
hetong
9ee9d29f13 refine readme.md 2014-09-01 17:24:13 -07:00
tqchen
0d5debcc25 fine fix 2014-09-01 17:23:44 -07:00
tqchen
0c5f2b9409 gard GNU c 2014-09-01 17:15:04 -07:00
tqchen
2f6a64e8fa Merge branch 'master' of ssh://github.com/tqchen/xgboost
Conflicts:
	src/utils/omp.h
2014-09-01 17:03:20 -07:00
tqchen
a6ce55493d make R package strict c99 2014-09-01 17:02:42 -07:00
Tong He
d391becb4e Update omp.h 2014-09-01 16:16:06 -07:00
Tong He
ada9dd94ad Update omp.h 2014-09-01 15:51:48 -07:00
hetong
b973a4dcaa improve doc in predict 2014-09-01 15:38:29 -07:00
tqchen
8863c520e7 some quick fix 2014-09-01 15:32:02 -07:00
Tong He
025ca170ec Update predict.xgb.Booster.R 2014-09-01 15:25:16 -07:00
tqchen
6ac6a3d9c9 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-09-01 15:10:29 -07:00
tqchen
4592e500cb add ntree limit 2014-09-01 15:10:19 -07:00
hetong
24e87e1cf8 fix doc with redirection to inst/examples 2014-09-01 15:07:17 -07:00
tqchen
7d1e9f06d4 add fmatrix in, todo add buffer file 2014-09-01 10:45:05 -07:00
tqchen
4c451de90b change message 2014-09-01 09:00:45 -07:00
Tianqi Chen
7393291f81 msvc 2014-09-01 08:59:02 -07:00
tqchen
427ab6434c message 2014-09-01 08:56:40 -07:00
tqchen
6641fa546d change warning to pragma message 2014-09-01 08:50:45 -07:00
tqchen
485e0f140e add 2014-08-31 22:53:35 -07:00
tqchen
8b3465cde0 cleaner makevar 2014-08-31 22:42:15 -07:00
tqchen
b2097b96c7 more clean makevar 2014-08-31 22:39:37 -07:00
tqchen
e3153b976c chgs 2014-08-31 22:25:30 -07:00
tqchen
0a7cfb32c6 add fmatrix, fight tmr 2014-08-31 21:58:01 -07:00
giuliohome
0be4f0032c new theory: predict from cv + parametric rounds 2014-09-01 01:50:07 +02:00
giuliohome
dde22976cf format README 2014-09-01 01:17:29 +02:00
giuliohome
c60649d28c README 2014-09-01 01:16:12 +02:00
giuliohome
2d1430ac01 set NFold CV from cmd args 2014-09-01 01:14:10 +02:00
giuliohome
f1d6429e96 Parametric NFold from cmd args 2014-09-01 01:10:29 +02:00
giuliohome
147b7d33fe NFold Refactoring 2014-09-01 00:50:43 +02:00
Tianqi Chen
b49927e602 Update xgboost_R.cpp 2014-08-31 14:32:45 -07:00
tqchen
79fa8b99d4 pack script with cleanup 2014-08-31 14:26:35 -07:00
tqchen
a3187e932a Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-31 14:15:53 -07:00
tqchen
88da7839b7 fix random 2014-08-31 14:14:39 -07:00
Tianqi Chen
d5f37d1238 add git ignore 2014-08-31 14:13:44 -07:00
tqchen
9e0cc778e8 fix win 2014-08-31 14:12:47 -07:00
tqchen
c1e9acba17 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-31 14:07:51 -07:00
tqchen
168f78623f allow standalone random 2014-08-31 14:07:44 -07:00
Tong He
12d503cec8 Update DESCRIPTION 2014-08-31 13:39:49 -07:00
tqchen
ba4f00d55d Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-31 13:13:19 -07:00
tqchen
1ed40e2b46 more strict makefile 2014-08-31 13:13:11 -07:00
Tianqi Chen
172423ca0c Update README.md 2014-08-31 12:19:44 -07:00
tqchen
37499245ea remove GNUism 2014-08-31 10:26:20 -07:00
Tianqi Chen
4d5ec01cd3 change windows 2014-08-31 09:25:25 -07:00
tqchen
e83090a579 change flagname to pass check 2014-08-31 09:17:49 -07:00
tqchen
bba13af922 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-31 09:13:07 -07:00
tqchen
26c61dc0a3 remove useless flag 2014-08-31 09:12:58 -07:00
Tianqi Chen
d4aacbf8cf add ignore 2014-08-31 09:08:17 -07:00
giuliohome
f42b25ec82 test my inline cv 2014-08-31 18:04:28 +02:00
giuliohome
21f16eac7b fix: cv2 2014-08-31 18:03:12 +02:00
giuliohome
f88aa8d137 fix: submission format 2014-08-31 18:00:34 +02:00
tqchen
fabe2f39e2 more clean makefile 2014-08-31 08:36:17 -07:00
giuliohome
cd0976202b 5 fold cv implementation in c# for the demo: you see inline cv ams while training (of course on a completely separate set) 2014-08-31 17:23:58 +02:00
giuliohome
442d17501f cv1 + cv2 (inline 5-fold cross validation) 2014-08-31 17:09:52 +02:00
giuliohome
23195ac95b Merge branch 'master' of https://github.com/giuliohome/xgboost 2014-08-31 16:31:11 +02:00
giuliohome
04fc25615c Update README.md 2014-08-31 16:28:49 +02:00
giuliohome
318d57f9d0 CV 5-fold implemented 2014-08-31 16:26:42 +02:00
giuliohome
71e5b4c413 Update README.md 2014-08-31 16:13:20 +02:00
giuliohome
41eef462f0 Update README.md 2014-08-31 15:49:34 +02:00
giuliohome
e4ad70e21c Update README.md 2014-08-31 15:41:34 +02:00
giuliohome
e26c072e83 Update README.md 2014-08-31 15:39:20 +02:00
giuliohome
a7b512a1c8 Update README.md 2014-08-31 15:31:16 +02:00
giuliohome
0f28ee4a8e Update README.md 2014-08-31 15:30:48 +02:00
giuliohome
a68f6680a0 Update README.md 2014-08-31 15:29:03 +02:00
giuliohome
82470ef96b Update README.md 2014-08-31 15:28:23 +02:00
hetong
b123fbbcf9 final revision before CRAN 2014-08-30 22:24:25 -07:00
unknown
22a38d8440 move demo to inst/examples 2014-08-30 21:04:47 -07:00
Tong He
b153ffe451 Update DESCRIPTION 2014-08-30 20:46:21 -07:00
Tianqi Chen
629799df0b Update DESCRIPTION 2014-08-30 20:24:23 -07:00
tqchen
f2c8093ba6 check in description 2014-08-30 20:22:36 -07:00
tqchen
104d1d61c7 add license name 2014-08-30 20:06:31 -07:00
tqchen
273816a3b4 chg data 2014-08-30 18:58:32 -07:00
tqchen
9c0389981a fix print problem, fix Tong's email format 2014-08-30 18:49:30 -07:00
Tong He
9739a1c806 Update DESCRIPTION 2014-08-30 18:17:20 -07:00
hetong
257c864274 remove pdf file 2014-08-30 16:26:26 -07:00
hetong
9b618acba2 add import methods in NAMESPACE 2014-08-30 15:42:57 -07:00
hetong
3e85419428 add back import of methdos 2014-08-30 15:34:36 -07:00
hetong
1abdcaa11d eliminate warnings and notes from R CMD check 2014-08-30 15:17:17 -07:00
hetong
a06f01e8ec improve document format 2014-08-30 15:14:36 -07:00
tqchen
e18a4fc5b6 Merge branch 'master' into unity 2014-08-30 15:01:52 -07:00
tqchen
602558c5d6 Merge branch 'unity'
Conflicts:
	R-package/src/Makevars
	R-package/src/Makevars.win
2014-08-30 15:01:36 -07:00
tqchen
2c1aabf6b0 fix indent 2014-08-30 12:47:04 -07:00
tqchen
6e054e8fa4 fix indent 2014-08-30 12:45:46 -07:00
Tianqi Chen
3f7aeb22c5 fix some windows type conversion warning 2014-08-30 12:40:51 -07:00
Tianqi Chen
99c44f2e51 fix makefile in win 2014-08-30 12:25:41 -07:00
hetong
daf430506e Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-30 12:11:40 -07:00
hetong
f9fc1aec2f modify licence and desc to standard format 2014-08-30 12:11:15 -07:00
Tianqi Chen
202a17f148 fix windows 2014-08-30 12:10:50 -07:00
hetong
4cebbdae66 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-30 12:10:41 -07:00
tqchen
74b27bfad2 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-30 12:03:41 -07:00
tqchen
51ef32d73a chg makefile 2014-08-30 12:03:32 -07:00
hetong
70cdd2787c add 00Index 2014-08-30 12:02:01 -07:00
hetong
1b7de855e9 remove logo 2014-08-30 11:53:58 -07:00
hetong
6d36e8460d change getinfo Rd 2014-08-30 11:28:10 -07:00
Tong He
efe8b38a35 fix error in demo 2014-08-30 11:24:15 -07:00
hetong
5e839f6fe7 change location and template of vignette 2014-08-30 10:55:13 -07:00
Tianqi Chen
7845ee0c85 Update CHANGES.md 2014-08-30 09:58:35 -07:00
Tianqi Chen
784ab8d02c Update README.md 2014-08-30 09:58:14 -07:00
Tianqi Chen
86e852d1da edit the doc 2014-08-30 09:31:14 -07:00
giuliohome
6d3eea5056 c# Booster class (almost ready to do cv) 2014-08-30 16:14:09 +02:00
giuliohome
77e967f0e6 Fix: Events Dictionary 2014-08-30 15:19:12 +02:00
giuliohome
473744c5ac conversion from csv to libsvm 2014-08-30 14:55:45 +02:00
giuliohome
b208338098 c# kaggle higgs demo drafted 2014-08-30 10:26:41 +02:00
hetong
84607a34a5 refine vignette 2014-08-29 22:40:07 -07:00
Tianqi Chen
366ac95ad3 windows check 2014-08-29 21:27:03 -07:00
tqchen
9830674b75 seems page is ok, try add col tmr 2014-08-29 21:04:40 -07:00
tqchen
7bc1c3ee79 various fix of page 2014-08-29 20:54:24 -07:00
tqchen
ce772c2f3e first check of page 2014-08-29 19:59:19 -07:00
tqchen
d0e27482ef fix compiler error 2014-08-29 18:44:02 -07:00
tqchen
ce2d34ecd4 check unity back 2014-08-29 18:35:26 -07:00
tqchen
551b3b70f1 check unity back 2014-08-29 18:31:24 -07:00
giuliohome
2587da5fea First example of c# wrapper done (marshalling prediction to submission file) 2014-08-30 03:05:40 +02:00
giuliohome
8b26cba148 eval training 2014-08-30 02:03:00 +02:00
giuliohome
4a67296e30 program cleanse
NEXT TO DO: try to predict after training
2014-08-30 01:43:45 +02:00
giuliohome
ba2d062f09 sharp higgs demo - training 2014-08-30 01:36:04 +02:00
giuliohome
db46e7a730 starting to develop a c# wrapper for xgboost:
c# implementation of kaggle higgs demo
2014-08-30 01:01:30 +02:00
giuliohome
6c3bc36a25 starting to develop a c# wrapper for xgboost 2014-08-30 00:36:01 +02:00
hetong
04c520ea3d refine vignette 2014-08-29 11:53:59 -07:00
hetong
8eb00e3916 refinement of document 2014-08-29 11:43:03 -07:00
hetong
cc12ee0d22 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-29 11:40:37 -07:00
hetong
5f510c683b add vignette 2014-08-29 11:40:15 -07:00
tqchen@graphlab.com
6db4e99b19 improve pack script 2014-08-29 09:47:50 -07:00
unknown
086433da0d add speedtest.R by -f 2014-08-28 22:40:44 -07:00
Tianqi Chen
23e80413f5 Update README.md 2014-08-28 22:34:12 -07:00
Tianqi Chen
6f6d754d4d Update README.md 2014-08-28 22:33:09 -07:00
tqchen
03127fc07e checkin makefile 2014-08-28 22:21:51 -07:00
unknown
b0130545a6 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-28 22:00:44 -07:00
unknown
6ed5d37771 speed test for R, and refinement of item list in doc 2014-08-28 22:00:13 -07:00
tqchen
3e92eb13d3 make it packable 2014-08-28 21:46:12 -07:00
tqchen
2e96bc51f5 do things 2014-08-28 21:23:27 -07:00
unknown
fba591fbf5 add slice document 2014-08-28 09:24:23 -07:00
unknown
26868ebada fix NAMESPACE with import classes 2014-08-28 09:22:11 -07:00
tqchen
8c50cbb6dd checkin slice 2014-08-28 09:04:30 -07:00
tqchen
776e4627de pass pedantic 2014-08-28 08:40:34 -07:00
tqchen
8100006483 fix 2014-08-28 08:34:51 -07:00
hetong
d95bc458e3 fix NAMESPACE 2014-08-28 08:16:45 -07:00
hetong
73419f6cd7 compile Rd files, i.e. R documents 2014-08-28 08:12:48 -07:00
tqchen
df6cd25fd5 OK 2014-08-28 07:43:26 -07:00
tqchen
d79161cfce chg 2014-08-28 07:38:44 -07:00
tqchen
d00302d3ac get a pass in function docstring 2014-08-28 07:35:57 -07:00
unknown
8127f31cdd add documentation notes 2014-08-28 01:44:03 -07:00
unknown
a0f22f6aaa hide xgb.Boost 2014-08-27 22:25:54 -07:00
unknown
8a4e66299a remove default value for nrounds 2014-08-27 22:12:30 -07:00
unknown
4723b8c07e Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-27 21:36:27 -07:00
unknown
6ed5e713d5 ignore csv 2014-08-27 21:35:55 -07:00
Tianqi Chen
b380e0432f Update DESCRIPTION 2014-08-27 21:35:28 -07:00
Tianqi Chen
d7735512cf Delete LICENSE 2014-08-27 21:35:00 -07:00
Tianqi Chen
077c556179 Update DESCRIPTION 2014-08-27 21:34:41 -07:00
Tianqi Chen
ca3141208f Update README.md 2014-08-27 21:32:33 -07:00
Tianqi Chen
af5abc04b3 Update README.md 2014-08-27 21:31:47 -07:00
unknown
b51b913494 modification of higgs-pred.R 2014-08-27 21:31:13 -07:00
Tianqi Chen
8be3249cb8 Update README.md 2014-08-27 21:16:54 -07:00
Tianqi Chen
582e4e3d8c Merge pull request #51 from tqchen/unity
merge unity into master, R package ready
2014-08-27 21:13:38 -07:00
tqchen
12b19c97fa change higgs script, remove R wrapper 2014-08-27 21:13:04 -07:00
tqchen
7ab45b3e64 add files back 2014-08-27 21:07:31 -07:00
Tianqi Chen
de111a1c26 make windows version in 2010 2014-08-27 21:01:39 -07:00
Bing Xu
211d85f04b make py work 2014-08-27 20:55:44 -06:00
tqchen@graphlab.com
4369bc2bfd chg code guide 2014-08-27 19:31:49 -07:00
tqchen@graphlab.com
b162acb858 adapt R package 2014-08-27 19:30:09 -07:00
Tianqi Chen
f9541efa01 Merge pull request #50 from tqchen/master
pull master into unity
2014-08-27 19:19:48 -07:00
tqchen@graphlab.com
075dc9a998 pass build 2014-08-27 19:19:04 -07:00
tqchen@graphlab.com
8aeb038ddd seems ok, need review destructors 2014-08-27 19:12:13 -07:00
tqchen@graphlab.com
f175e1cfb4 finish refactor, need debug 2014-08-27 18:33:52 -07:00
tqchen@graphlab.com
605269133e complete refactor data.h, now replies on iterator to access column 2014-08-27 17:00:21 -07:00
unknown
ae4128fcb2 styling of else in R 2014-08-27 16:46:47 -07:00
Tong He
114cfb2167 fix a tiny bug in xgboost 2014-08-27 15:51:34 -07:00
unknown
b151617ac1 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-27 15:49:26 -07:00
unknown
02df006286 modify readme in R-package 2014-08-27 15:15:22 -07:00
unknown
d693e8d5cc use demo instead of inst 2014-08-27 15:10:07 -07:00
unknown
0f0c12707c modify xgb.getinfo to getinfo 2014-08-27 15:03:24 -07:00
Tianqi Chen
0b5e611c22 Merge pull request #49 from giuliohome/master
Thanks giulio!
2014-08-27 14:49:06 -07:00
giuliohome
f3136c2d92 README 2014-08-27 23:24:57 +02:00
giuliohome
73c42d4574 FIX: If you are using Windows, __declspec(dllexport) is necessary 2014-08-27 23:21:55 +02:00
unknown
a060a2e9a6 remove old R demo files 2014-08-27 13:16:16 -07:00
unknown
247e0d5d78 tidy code by formatR 2014-08-27 13:15:28 -07:00
unknown
4dcc7d7303 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-08-27 12:58:04 -07:00
unknown
d747172d37 refinement of R package 2014-08-27 12:57:37 -07:00
Tianqi Chen
57c0ab2721 Update xgboost.py 2014-08-27 12:27:25 -07:00
Tianqi Chen
2451ba0f1c Merge pull request #48 from giuliohome/master
adding a dll project to the msvc solution for the python wrapper on win64
2014-08-27 12:24:09 -07:00
giuliohome
30b31a6910 win64 python dll project 2014-08-27 20:38:30 +02:00
giuliohome
1383afd8f4 MSVS DLL Project for Python wrapper (ver.3 on win64) 2014-08-27 20:27:05 +02:00
giuliohome
ce1803a40c Merge pull request #1 from tqchen/master
updating fork to current master
2014-08-27 20:17:44 +02:00
tqchen@graphlab.com
a59f8945dc rename SparseBatch to RowBatch 2014-08-27 10:56:55 -07:00
tqchen@graphlab.com
d5a5e0a42a rename findex->index 2014-08-27 10:52:27 -07:00
tqchen@graphlab.com
f3a3470916 make wrapper compile 2014-08-27 10:48:25 -07:00
tqchen@graphlab.com
0fe5470a4f delete extra things 2014-08-27 09:59:39 -07:00
unknown
0130be4acc major change in the design of R interface 2014-08-26 23:41:03 -07:00
Tianqi Chen
84e5fc285b bst_ulong supported by sparsematrix builder 2014-08-26 20:32:33 -07:00
tqchen
414e7f27ff Merge branch 'master' into unity
Conflicts:
	src/learner/evaluation-inl.hpp
	wrapper/xgboost_R.cpp
	wrapper/xgboost_wrapper.cpp
	wrapper/xgboost_wrapper.h
2014-08-26 20:32:07 -07:00
tqchen
4787108b5f change uint64_t to ulong, to make mac happy, this is final change 2014-08-26 20:10:07 -07:00
Tianqi Chen
d00f27dc6b change uint64_t to depend on utils 2014-08-26 20:08:13 -07:00
Tianqi Chen
3e5cb25830 minor fix, add openmp 2014-08-26 20:02:10 -07:00
Tianqi Chen
9d2c1cf9f5 add omp uint when openmp is not there 2014-08-26 19:59:55 -07:00
tqchen
90226035fa chg r package path back 2014-08-26 19:39:34 -07:00
tqchen
7739f57c8b change omp loop var to bst_omp_uint, add XGB_DLL to wrapper 2014-08-26 19:37:04 -07:00
tqchen
97467fe807 chg size_t to uint64_t 2014-08-26 19:12:51 -07:00
tqchen
2623ab0a60 chg size_t to uint64_t unsigned long in wrapper 2014-08-26 19:06:53 -07:00
tqchen
3c1ed847fb remove dependency on bst 2014-08-26 18:06:22 -07:00
Tianqi Chen
636ffaf23b Merge pull request #46 from tqchen/master
merge master into unity
2014-08-26 12:18:26 -07:00
tqchen@graphlab.com
46f14b8c27 fix magic so that it can detect binary file 2014-08-26 12:17:27 -07:00
tqchen@graphlab.com
9eb32b9dd4 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-26 10:24:04 -07:00
tqchen@graphlab.com
2e3c214173 improve makefile 2014-08-26 10:23:57 -07:00
hetong
41d290906f fix NAMESPACE with export method predict 2014-08-26 10:14:29 -07:00
hetong
262108cf3b modify demo filenames 2014-08-26 10:02:13 -07:00
hetong
d9f363632a Merge branch 'master' of https://github.com/tqchen/xgboost
Initial development of R pacakge and merge with the modification from tqchen.
2014-08-26 09:57:38 -07:00
hetong
4940fff55b export fewer functions to user and optimize parameter setting 2014-08-26 09:57:28 -07:00
Tianqi Chen
98e92f1a79 more detailed warning 2014-08-26 09:29:17 -07:00
Tianqi Chen
b1bffde6c9 fix compile under rtools 2014-08-26 09:09:28 -07:00
hetong
5f6d5d19b8 import package methods in desc 2014-08-25 23:01:53 -07:00
tqchen@graphlab.com
a1f1015ae1 add package parameter to all calls, test pass in mac 2014-08-25 22:25:03 -07:00
tqchen
7297c0a92b add openmp flags 2014-08-25 22:14:48 -07:00
tqchen
ddc0970c46 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-25 22:02:19 -07:00
tqchen
0fca16008e runnable 2014-08-25 22:01:35 -07:00
Tianqi Chen
47a0e84c5f add win make 2014-08-25 21:54:24 -07:00
tqchen
c6eaf01a97 add git ignore 2014-08-25 21:25:49 -07:00
tqchen
68f38cf228 initial trial package 2014-08-25 21:20:55 -07:00
Tianqi Chen
c6d59dac4b Merge pull request #45 from tqchen/master
better error handling
2014-08-25 16:00:33 -07:00
tqchen@graphlab.com
c2484f3134 better error handling 2014-08-25 15:58:52 -07:00
tqchen
4c04cf8728 add grow5 back, seems no changes 2014-08-25 14:08:38 -07:00
tqchen
0066cd13a7 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-08-25 13:57:21 -07:00
tqchen
3e9f8bfac9 change things back 2014-08-25 13:56:03 -07:00
tqchen@graphlab.com
6da62159d0 fix by giulio 2014-08-25 12:10:45 -07:00
tqchen@graphlab.com
e26af5e66c Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-08-25 12:08:50 -07:00
tqchen@graphlab.com
b83a96fa21 fix by giulio 2014-08-25 12:08:41 -07:00
tqchen
b708f3f029 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity
Conflicts:
	src/learner/evaluation-inl.hpp
2014-08-25 11:56:59 -07:00
tqchen@graphlab.com
d61b0b757f chg 2014-08-25 11:35:38 -07:00
tqchen@graphlab.com
c78a2164c2 fix line from auto spacing by msvc 2014-08-25 11:34:49 -07:00
tqchen
9e5788a47c Merge branch 'master' into unity 2014-08-25 11:22:37 -07:00
tqchen
e4b9ee22fa :Merge branch 'unity'
Conflicts:
	src/gbm/gbtree-inl.hpp
	src/learner/evaluation-inl.hpp
	src/tree/param.h
2014-08-25 11:21:56 -07:00
Tianqi Chen
bd52a7f448 changes 2014-08-25 11:13:06 -07:00
Tianqi Chen
ca0b008fb0 clean up warnings from msvc 2014-08-25 11:01:21 -07:00
tqchen
fd03239b77 fix now today, try to think how to work tmr 2014-08-24 22:08:21 -07:00
tqchen
f62b4a02f9 beta version, do a review 2014-08-24 21:36:30 -07:00
tqchen
ce97f2fdf8 a fixed version 2014-08-24 21:17:13 -07:00
tqchen
6daa1c365d add cvgrad stats, simplify data 2014-08-24 20:07:16 -07:00
tqchen
c640485f1d initial correction for vec tree 2014-08-24 18:48:19 -07:00
Tianqi Chen
4f0b0d2c88 Merge pull request #43 from tqchen/unity
add changes that are not commited
2014-08-24 17:26:21 -07:00
tqchen
7874c2559b add changes 2014-08-24 17:25:17 -07:00
Tianqi Chen
4c023077dd Merge pull request #42 from tqchen/unity
Unity this is final minor change in data structure
2014-08-24 17:23:46 -07:00
tqchen
da75f8f1a4 move ncol, row to booster, add set/get uint info 2014-08-24 17:19:22 -07:00
tqchen
19447cdb12 chg higgs back 2014-08-24 16:09:13 -07:00
tqchen
4889b40abc tstats now depend on param 2014-08-24 16:08:58 -07:00
tqchen
49e6575c86 add set leaf, constructor of tstats now rely on param 2014-08-24 16:07:59 -07:00
Tianqi Chen
d7c6f8e81a Merge pull request #41 from tqchen/unity
Unity
2014-08-24 15:24:20 -07:00
tqchen
ba9fbd380c templatize refresher 2014-08-24 15:22:11 -07:00
tqchen
f71b732e7a refactor grad stats to be like visitor 2014-08-24 15:17:22 -07:00
Tianqi Chen
c0496685c4 Merge pull request #39 from tqchen/unity
fix mac compile issue
2014-08-24 09:52:03 -07:00
tqchen
d49c6e6e84 fix 2014-08-24 09:51:15 -07:00
tqchen
88beee5639 try to fix compile bug 2014-08-24 09:47:08 -07:00
tqchen@graphlab.com
46d41a2b43 fix compilation on mac 2014-08-24 09:32:06 -07:00
Tianqi Chen
40483e6dc3 Merge pull request #38 from tqchen/unity
Unity
2014-08-23 21:16:14 -07:00
tqchen
b381c842f1 link glc 2014-08-23 21:14:53 -07:00
tqchen
5802141d59 add glc comment 2014-08-23 21:12:55 -07:00
Tianqi Chen
cf274e76f4 Merge pull request #37 from tqchen/unity
Unity
2014-08-23 20:54:27 -07:00
tqchen
fea7245fa0 chg python back 2014-08-23 20:53:56 -07:00
tqchen
d16a56814b remove pred.csv 2014-08-23 20:53:16 -07:00
tqchen
ed9d8a1c0e add higgs example 2014-08-23 20:52:56 -07:00
Tianqi Chen
851f3fce86 Merge pull request #36 from tqchen/unity
add acknowledgement
2014-08-23 19:05:22 -07:00
tqchen
d86cd62415 add acknowledgement 2014-08-23 19:04:50 -07:00
Tianqi Chen
cd16a3b124 Merge pull request #35 from tqchen/unity
ok
2014-08-23 18:59:52 -07:00
tqchen
a656e61571 ok 2014-08-23 18:57:19 -07:00
Tianqi Chen
b2b5895634 Merge pull request #34 from tqchen/unity
Unity
2014-08-23 18:56:38 -07:00
tqchen
3b12ff51b9 seems ok 2014-08-23 18:38:39 -07:00
tqchen
de83ac72ea complete R example 2014-08-23 15:26:08 -07:00
tqchen
8bf758c63b chg wrapper 2014-08-23 14:27:56 -07:00
tqchen
08a6b92216 chg 2014-08-23 14:20:29 -07:00
tqchen
3ba7995754 finish dump 2014-08-23 13:09:47 -07:00
tqchen
40da2fa2c0 workable R wrapper 2014-08-23 12:14:44 -07:00
tqchen
5e23f6577f try add R wrapper 2014-08-23 09:30:02 -07:00
tqchen
9d210f9bd3 ok 2014-08-22 20:14:43 -07:00
Tianqi Chen
741bfe015f Merge pull request #32 from tqchen/master
merge master into unity
2014-08-22 20:13:23 -07:00
Tianqi Chen
13b5269855 Update machine.conf 2014-08-22 20:00:04 -07:00
Tianqi Chen
cf69d34d06 Update mq2008.conf 2014-08-22 19:59:30 -07:00
Tianqi Chen
4378f1f039 Update mushroom.conf 2014-08-22 19:58:59 -07:00
Tianqi Chen
3acd10e031 Merge pull request #31 from tqchen/unity
Change master branch into unity
2014-08-22 19:54:48 -07:00
tqchen
58cda4d708 ok 2014-08-22 19:53:52 -07:00
tqchen
104fced9c3 ok 2014-08-22 19:52:43 -07:00
tqchen
ce5b776bdc add change note 2014-08-22 19:47:05 -07:00
tqchen
07ddf98718 add log 2014-08-22 19:41:58 -07:00
tqchen
2ac8cdb873 check in linear model 2014-08-22 19:27:33 -07:00
tqchen
37b707e110 clean up 2014-08-22 16:51:27 -07:00
tqchen
bf71cf52be add 2014-08-22 16:50:28 -07:00
tqchen
24030b26fd add 2014-08-22 16:49:42 -07:00
tqchen
edc539a024 add message about glc 2014-08-22 16:47:50 -07:00
tqchen
4ed67b9c27 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-08-22 16:26:45 -07:00
tqchen
58354643b0 chg root index to booster info, need review 2014-08-22 16:26:37 -07:00
tqchen
a45fb2d737 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-08-22 16:10:23 -07:00
tqchen
3f5b5e1fdc add apratio 2014-08-22 16:10:19 -07:00
tqchen
58d74861b9 fix multiclass 2014-08-22 14:29:32 -07:00
tqchen@graphlab.com
1fd6ff817f ok 2014-08-19 12:20:31 -07:00
tqchen@graphlab.com
9caccd3b36 change row subsample to prob 2014-08-19 12:07:52 -07:00
tqchen@graphlab.com
91e70c76ff refresher test 2014-08-19 11:41:35 -07:00
tqchen
762b360739 fix typo 2014-08-19 08:42:36 -07:00
tqchen
e7de77aa1f chg 2014-08-19 08:08:54 -07:00
tqchen
406db647f2 add pratio 2014-08-19 08:05:05 -07:00
tqchen
fdba6e9c46 add pratio 2014-08-19 08:02:29 -07:00
tqchen
d08d8ed3ed add tree refresher, need review 2014-08-18 21:32:48 -07:00
tqchen
f757520c02 add tree refresher, need review 2014-08-18 21:32:31 -07:00
tqchen
dbf3a21942 change dense fvec logic to tree 2014-08-18 19:03:32 -07:00
tqchen
1d8c2391e8 update tree maker to make it more robust 2014-08-18 14:58:30 -07:00
tqchen
3de07b0abe add more guideline about python path 2014-08-18 14:12:35 -07:00
tqchen@graphlab.com
3b02fb26b0 fix num parallel tree 2014-08-18 13:33:58 -07:00
tqchen@graphlab.com
c4b21775fa some lint 2014-08-18 12:57:31 -07:00
antinucleon
e9bfc026b7 fix typo 2014-08-18 13:38:09 -06:00
antinucleon
0b36c8295d lack include 2014-08-18 13:33:36 -06:00
tqchen@graphlab.com
9da2ced8a2 add base_margin 2014-08-18 12:20:13 -07:00
tqchen@graphlab.com
46fed899ab add more note 2014-08-18 10:57:08 -07:00
tqchen@graphlab.com
f6c763a2a7 fix base score, and print message 2014-08-18 10:53:15 -07:00
tqchen@graphlab.com
04e04ec5a0 chg readme 2014-08-18 10:19:47 -07:00
tqchen@graphlab.com
66ae3a7578 add no omp flag 2014-08-18 10:17:49 -07:00
tqchen@graphlab.com
7c068cbe46 fix mac 2014-08-18 10:14:34 -07:00
tqchen
d3bfc31e6a enforce putting iteration numbers in train 2014-08-18 09:00:23 -07:00
tqchen
3c1c7e2780 Merge branch 'unity' of ssh://github.com/tqchen/xgboost into unity 2014-08-18 08:57:45 -07:00
tqchen
e912dd3364 fix omp 2014-08-18 08:57:26 -07:00
Bing Xu
b76853731c make it compatible with old code 2014-08-18 02:10:54 -04:00
tqchen
0d9a8c042c make xgcombine buffer work 2014-08-17 22:49:36 -07:00
tqchen
4ed4b08146 ok 2014-08-17 20:47:20 -07:00
tqchen
5a472145de check in rank loss 2014-08-17 20:32:02 -07:00
tqchen
9df8bb1397 check in softmax multiclass 2014-08-17 19:16:17 -07:00
tqchen
e77df13815 ok 2014-08-17 18:49:54 -07:00
tqchen
301685e0a4 python module pass basic test 2014-08-17 18:43:25 -07:00
tqchen
af100dd869 remake the wrapper 2014-08-17 17:43:46 -07:00
tqchen
2c969ecf14 first version that reproduce binary classification demo 2014-08-16 15:44:35 -07:00
tqchen
c4acb4fe01 check in io module 2014-08-16 14:06:31 -07:00
tqchen
ac1cc15b90 pass fmatrix as const 2014-08-15 21:24:23 -07:00
tqchen
d9dbd1efc6 modify readme 2014-08-15 21:06:44 -07:00
tqchen
34dd409c5b mv code into src 2014-08-15 21:04:23 -07:00
tqchen
3589e8252f refactor config 2014-08-15 21:02:33 -07:00
tqchen
dafa44753a chg readme 2014-08-15 20:22:54 -07:00
tqchen
2a92c82b92 start unity refactor 2014-08-15 20:15:58 -07:00
tqchen@graphlab.com
5b215742c2 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-08-15 13:36:56 -07:00
tqchen@graphlab.com
5edc4f3775 save name_obj from now 2014-08-15 13:36:19 -07:00
Tianqi Chen
6d7b33a883 Update README.md 2014-08-12 14:57:28 -07:00
Tianqi Chen
f033f88221 Update README.md 2014-08-12 14:57:05 -07:00
Tianqi Chen
048194ce23 Update README.md 2014-08-12 14:56:51 -07:00
Tianqi Chen
e7ae704504 Update README.md 2014-08-12 14:56:12 -07:00
tqchen
662733db31 support for multiclass output prob 2014-08-01 11:21:17 -07:00
Tianqi Chen
8b4f7d7fa2 Update xgboost_regrank.h 2014-07-12 10:14:30 -07:00
Tianqi Chen
497fc86998 Merge pull request #16 from smly/minor-leak
fix (trivial) leak in xgboost_regrank, Thanks for the fix
2014-07-12 09:58:07 -07:00
Kohei Ozaki
0516d09938 fix (trivial) leak in xgboost_regrank 2014-07-12 17:29:49 +09:00
tqchen
1620cfc9e8 fix combine buffer 2014-05-25 16:46:03 -07:00
tqchen
ec62953e54 add rand seeds back 2014-05-25 10:18:04 -07:00
tqchen
86515a2c15 ok 2014-05-25 10:15:57 -07:00
Tianqi Chen
1048561ede change rank order output to follow kaggle convention 2014-05-25 10:08:38 -07:00
tqchen
6abfce620c make python random seed invariant in each round 2014-05-24 20:57:39 -07:00
tqchen
e2999a0efb fix sometimes python cachelist problem 2014-05-20 15:42:19 -07:00
tqchen
89a2fc5e94 more clean demo 2014-05-20 08:33:35 -07:00
tqchen
ea3bf5d57e fix bug in classification, scale_pos_weight initialization 2014-05-20 08:30:19 -07:00
tqchen
f4dedc4d2d chg 2014-05-19 10:02:01 -07:00
Tianqi Chen
1b9372f431 Merge pull request #7 from jrings/master
Compatibility with both Python 2(.7) and 3
2014-05-19 09:48:34 -07:00
Joerg Rings
93d83ca077 Compatibility with both Python 2(.7) and 3 2014-05-19 11:23:53 -05:00
Tianqi Chen
991634a58e Merge pull request #6 from tqchen/dev
Fix the bug in MAC
2014-05-17 11:07:42 -07:00
tqchen
7aae2ec009 add omp flag back 2014-05-17 11:07:12 -07:00
tqchen
1afe894a63 use back g++ 2014-05-17 11:06:36 -07:00
tqchen
29363d6100 force handle as void_p, seems fix mac problem 2014-05-17 11:03:21 -07:00
Tianqi Chen
049e8cfb2d Merge pull request #5 from tqchen/dev
add return type for xgboost, don't know if it is mac problem. #4
2014-05-17 09:19:20 -07:00
tqchen
2507e4403a add return type for xgboost, don't know if it is mac problem 2014-05-17 09:13:54 -07:00
Tianqi Chen
007f60a352 Update README.md 2014-05-16 22:54:24 -07:00
Tianqi Chen
85108e6a65 Merge pull request #2 from tqchen/dev
fix loss_type
2014-05-16 21:30:09 -07:00
tqchen
3975bf1e62 some cleanup 2014-05-16 21:29:14 -07:00
tqchen
baed0d0f08 fix for loss_type problem in outside reset base 2014-05-16 21:28:03 -07:00
tqchen
bf473bd6c8 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-05-16 20:58:03 -07:00
tqchen
71fc734d3b chg 2014-05-16 20:57:54 -07:00
antinucleon
9f3e5a2778 del 2014-05-17 03:57:38 +00:00
Tianqi Chen
59a9b6b325 Merge pull request #1 from tqchen/dev
2.0 version, lots of changes
2014-05-16 20:53:19 -07:00
Tianqi Chen
8e941b2a79 Update README.md 2014-05-16 20:49:05 -07:00
tqchen
877bac216c Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-16 20:46:18 -07:00
tqchen
348d35a668 add ignore 2014-05-16 20:46:08 -07:00
tqchen
d7bb10eb79 final check 2014-05-16 20:44:02 -07:00
Tianqi Chen
4dadc76652 Update README.md 2014-05-16 20:41:59 -07:00
Tianqi Chen
4218c1ef53 Update README.md 2014-05-16 20:41:43 -07:00
Tianqi Chen
32a3371073 Update README.md 2014-05-16 20:41:21 -07:00
Tianqi Chen
58cbfa0692 Update README.md 2014-05-16 20:41:05 -07:00
tqchen
51482a29bf Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-16 20:37:55 -07:00
tqchen
d429289ad3 ok 2014-05-16 20:37:45 -07:00
yepyao
1cf41066d9 Merge branch 'dev' of https://github.com/tqchen/xgboost into dev 2014-05-17 11:36:12 +08:00
yepyao
391be10806 small change 2014-05-17 11:35:43 +08:00
yepyao
255bad90cb small change 2014-05-17 11:34:24 +08:00
tqchen
84afaaaa7d Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-16 20:29:17 -07:00
tqchen
b07ff1ac8d fix softmax 2014-05-16 20:28:07 -07:00
antinucleon
3e4dd2fce0 chg 2014-05-16 21:27:37 -06:00
tqchen
6c72d02205 chg 2014-05-16 20:18:34 -07:00
Tianqi Chen
cfd6c9e3b7 Update train.py 2014-05-16 20:16:10 -07:00
tqchen
8e5e3340a2 multi class 2014-05-16 20:12:04 -07:00
antinucleon
f52f7b7899 demo 2014-05-16 21:05:11 -06:00
antinucleon
f971d1b554 Merge branch 'dev' of github.com:tqchen/xgboost into dev 2014-05-16 21:03:32 -06:00
Tianqi Chen
7537d691d9 Update README.md 2014-05-16 20:00:20 -07:00
antinucleon
c67b098bd6 demo 2014-05-17 02:59:10 +00:00
antinucleon
d05cb13751 demo 2014-05-16 20:57:42 -06:00
tqchen
2cae28087a do not need to dump in rank 2014-05-16 19:52:39 -07:00
tqchen
12bf54d4ef Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-16 19:51:41 -07:00
tqchen
6a9438ac86 before commit 2014-05-16 19:51:33 -07:00
yepyao
c4a783f408 small change 2014-05-17 10:50:15 +08:00
yepyao
e872f488a5 Merge branch 'dev' of https://github.com/tqchen/xgboost into dev
Conflicts:
	demo/rank/mq2008.conf
	demo/rank/runexp.sh
	regrank/xgboost_regrank_obj.h
2014-05-17 10:40:12 +08:00
yepyao
e565916c1c fix small bug 2014-05-17 10:35:10 +08:00
tqchen
a70454e3ce add bing to author list 2014-05-16 19:33:59 -07:00
Tianqi Chen
1150fb59a8 Update demo.py 2014-05-16 19:30:32 -07:00
tqchen
53633ae9c2 chgs 2014-05-16 19:24:53 -07:00
tqchen
98e507451c chg all settings to obj 2014-05-16 19:10:52 -07:00
tqchen
213375baca pre-release version 2014-05-16 18:49:02 -07:00
tqchen
8a0f8a93c7 chg scripts 2014-05-16 18:46:43 -07:00
tqchen
02cefb8f1b cleanup 2014-05-16 18:40:46 -07:00
tqchen
bee87cfce7 chg rank demo 2014-05-16 18:38:40 -07:00
tqchen
4743cc98ec Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-16 18:29:37 -07:00
tqchen
bf66d31b49 chng few things 2014-05-16 18:25:01 -07:00
tqchen
c67b4d1864 minor changes 2014-05-16 18:19:57 -07:00
antinucleon
4bf23cfbb1 new speed test 2014-05-16 18:05:17 -06:00
antinucleon
4bcf947408 speedtest 2014-05-16 17:48:03 -06:00
yepyao
4d03729683 use ndcg@all in lambdarank for ndcg 2014-05-16 23:06:24 +08:00
yepyao
5db373e73c small change 2014-05-16 21:20:41 +08:00
yepyao
e3a0c0efe5 Download data set from web site 2014-05-16 21:18:32 +08:00
kalenhaha
07e98254f5 Impement new Lambda rank interface 2014-05-16 20:42:46 +08:00
tqchen
2baeeabac4 new lambda rank interface 2014-05-16 00:02:26 -07:00
Bing Xu
da0bb3f44e Update README.md 2014-05-16 01:30:29 -04:00
tqchen
92d1df2d2e ok 2014-05-15 21:17:17 -07:00
tqchen
6af6d64f0b a correct version 2014-05-15 21:11:46 -07:00
tqchen
2be3f6ece0 fix numpy convert 2014-05-15 20:28:34 -07:00
tqchen
a7f3d7edd7 ok 2014-05-15 20:05:22 -07:00
tqchen
c22df2b31a ok 2014-05-15 18:56:28 -07:00
tqchen
e2d13db24e bug fix in pairwise rank 2014-05-15 15:37:58 -07:00
tqchen
37e1473cea cleanup code 2014-05-15 15:01:41 -07:00
tqchen
3960ac9cb4 add xgcombine_buffer with weights 2014-05-15 14:41:11 -07:00
tqchen
a59969cd52 change data format to include weight in binary file, add get weight to python 2014-05-15 14:37:56 -07:00
tqchen
3cb42d3f87 ok 2014-05-15 14:25:44 -07:00
tqchen
88526668f5 add ams 2014-05-14 23:23:27 -07:00
tqchen
31a0823e6d some fix 2014-05-14 16:55:59 -07:00
tqchen
ae9d937510 add AMS metric 2014-05-14 11:30:45 -07:00
kalenhaha
121348c0d7 add in grad and hess rescale in lambdarank 2014-05-14 23:13:27 +08:00
kalenhaha
671c34be63 small bug in ndcg eval 2014-05-13 14:30:42 +08:00
kalenhaha
8967be4af5 Merge branch 'dev' of https://github.com/tqchen/xgboost into dev 2014-05-12 22:22:32 +08:00
kalenhaha
5411e2a500 Add LETOR MQ2008 for rank demo 2014-05-12 22:21:07 +08:00
kalenhaha
e858523d19 remove sampler 2014-05-11 14:31:57 +08:00
kalenhaha
6648a15817 small change 2014-05-11 14:25:30 +08:00
kalenhaha
faf35c409e small change 2014-05-11 14:03:21 +08:00
tqchen
604568b512 simple chgs 2014-05-09 20:39:15 -07:00
kalenhaha
f7b2281510 fix some warnings 2014-05-09 14:14:43 +08:00
kalenhaha
0794dd0f6f Merge branch 'dev' of https://github.com/tqchen/xgboost into dev 2014-05-09 14:07:06 +08:00
kalenhaha
4b6024c563 Separating Lambda MAP and Lambda NDCG 2014-05-09 14:05:52 +08:00
tqchen
41edad7b3d add python o3 2014-05-08 20:15:23 -07:00
tqchen
2ccd28339e faster convert to numpy array 2014-05-08 19:35:06 -07:00
tqchen
a0c0fbbb61 commit the fix 2014-05-08 19:31:32 -07:00
tqchen
06327ff8d0 Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-07 12:00:17 -07:00
tqchen
0bf6261961 fix omp for bug in obj 2014-05-07 11:52:12 -07:00
kalenhaha
8b3fc78999 Merge branch 'dev' of https://github.com/tqchen/xgboost into dev
Conflicts:
	regrank/xgboost_regrank_obj.hpp
2014-05-07 22:15:59 +08:00
tqchen
833cf29867 fix 2014-05-06 16:53:37 -07:00
tqchen
4b00b3e565 Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-06 16:51:18 -07:00
tqchen
abe5309977 Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev
Conflicts:
	regrank/xgboost_regrank_data.h
2014-05-06 16:51:11 -07:00
tqchen
7ddff7b570 add regrank utils 2014-05-06 16:50:46 -07:00
tqchen
c39e1f2f30 right group size 2014-05-06 16:49:10 -07:00
tqchen
4f9833ed76 add cutomized training 2014-05-04 13:57:10 -07:00
tqchen
9bc699fd0e add cutomized training 2014-05-04 13:55:58 -07:00
tqchen
8c0c10463e add boost group support to xgboost. now have beta multi-class classification 2014-05-04 12:10:03 -07:00
kalenhaha
8eae8d956d c++11 features removed 2014-05-04 16:58:44 +08:00
kalenhaha
7161618b4c c++11 features removed 2014-05-04 16:56:57 +08:00
tqchen
21f93ffd6a fix 2014-05-04 00:09:16 -07:00
tqchen
2057dda560 add interact mode 2014-05-03 23:24:22 -07:00
tqchen
6fd77cbb24 add python interface for xgboost 2014-05-03 23:04:02 -07:00
tqchen
adc9400736 finish python lib 2014-05-03 22:18:25 -07:00
tqchen
20de7f8f97 finish matrix 2014-05-03 17:12:25 -07:00
tqchen
5bab27cfa6 good 2014-05-03 16:15:44 -07:00
tqchen
30e725a28c ok 2014-05-03 14:24:00 -07:00
tqchen
aab1b0e7b3 important change to regrank interface, need some more test 2014-05-03 14:20:27 -07:00
tqchen
2305ea7af7 try python 2014-05-03 10:54:08 -07:00
tqchen
c1223bfdef pass test 2014-05-02 18:04:45 -07:00
tqchen
cc91c73160 add new combine tool as promised 2014-05-02 12:55:34 -07:00
tqchen
cbceeb8ca6 Merge branch 'dev' of ssh://github.com/tqchen/xgboost into dev 2014-05-01 11:01:05 -07:00
tqchen
ef7df40bc8 cleanup of evaluation metric, move c++11 codes into sample.h for backup, add lambda in a clean way latter 2014-05-01 11:00:50 -07:00
Tianqi Chen
f93ccda075 Update xgboost_omp.h 2014-05-01 10:16:05 -07:00
kalenhaha
f17d400fd3 fix some bugs in linux 2014-05-02 00:16:12 +08:00
kalenhaha
b836b1123e lambda rank added 2014-05-01 22:17:26 +08:00
tqchen
bf64608cc9 add softmax 2014-04-30 22:11:26 -07:00
tqchen
54c482ffd5 add pre @ n 2014-04-30 22:00:53 -07:00
tqchen
223bb5638b use omp parallel sortting 2014-04-30 09:48:41 -07:00
tqchen
bb93c0aaac add rank 2014-04-30 09:32:42 -07:00
tqchen
a383f11759 add pairwise rank first version 2014-04-29 21:12:30 -07:00
tqchen
81414c0e5b new AUC code 2014-04-29 17:26:58 -07:00
tqchen
87a9c22795 new AUC evaluator, now compatible with weighted loss 2014-04-29 17:03:34 -07:00
tqchen
31edfda03c make regression module compatible with rank loss, now support weighted loss 2014-04-29 16:16:02 -07:00
tqchen
7a79c009ce chg fmap format 2014-04-29 09:59:10 -07:00
tqchen
ea354683b4 add auc evaluation metric 2014-04-24 22:20:40 -07:00
tqchen
7f9637aae4 remove unwanted private field 2014-04-21 10:42:19 -07:00
tqchen
5f0018b070 expose fmatrixs 2014-04-18 18:18:19 -07:00
tqchen
c3592dc06c Merge branch 'master' of ssh://github.com/tqchen/xgboost
Conflicts:
	regression/xgboost_reg_data.h
2014-04-18 17:46:44 -07:00
tqchen
3d327503fd simplify data 2014-04-18 17:43:44 -07:00
kalenhaha
91bb4777b0 Lambda rank added 2014-04-11 10:50:13 +08:00
kalenhaha
efeea99283 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-04-11 10:48:45 +08:00
kalenhaha
07eea71010 Lambda rank added 2014-04-10 22:11:15 +08:00
kalenhaha
c8b2f46b89 lambda rank added 2014-04-10 22:09:19 +08:00
Tianqi Chen
a022a783ce Update xgboost_utils.h 2014-04-07 16:25:21 -07:00
kalenhaha
a10f594644 rank pass toy 2014-04-07 23:25:35 +08:00
tqchen
40c380e40a add deleted main back 2014-04-06 09:32:27 -07:00
kalenhaha
1fa367b220 small fix 2014-04-06 22:54:41 +08:00
kalenhaha
6bc71df494 compiled 2014-04-06 22:51:52 +08:00
tqchen
ddb8a6982c add dev 2014-04-04 10:42:13 -07:00
kalenhaha
c62dea8325 pairwise ranking implemented 2014-04-05 00:14:55 +08:00
kalenhaha
0b1e584d73 Adding ranking task 2014-04-03 16:22:55 +08:00
tqchen
dc239376c7 add dump nice to regression demo 2014-03-26 16:47:01 -07:00
tqchen
7d97d6b1d4 update regression 2014-03-26 16:25:44 -07:00
kalenhaha
0a971cb466 small fix 2014-03-27 00:08:47 +08:00
kalenhaha
52992442ad Merge branch 'master' of https://github.com/tqchen/xgboost 2014-03-26 23:50:56 +08:00
tqchen
c751d6ead3 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-03-25 17:18:27 -07:00
tqchen
c7869a7855 small fix 2014-03-25 17:17:00 -07:00
Tianqi Chen
87fc848b12 Update README.md 2014-03-26 08:01:47 +08:00
Tianqi Chen
159ed0f7e1 Update README.md 2014-03-26 08:01:24 +08:00
Tianqi Chen
f7d9c774d7 Update README 2014-03-26 07:21:15 +08:00
kalenhaha
feb914c35b change the regression demo data set 2014-03-24 23:23:11 +08:00
tqchen
d93e8717c1 fix test to pred 2014-03-24 00:31:53 -07:00
kalenhaha
57713be940 remove test directory 2014-03-23 00:05:46 +08:00
kalenhaha
77901f2428 adding regression demo 2014-03-22 21:52:29 +08:00
kalenhaha
55d1b1e109 Merge branch 'master' of https://github.com/tqchen/xgboost 2014-03-22 21:50:31 +08:00
kalenhaha
193d1d165f separate binary classification and regression demo 2014-03-22 21:48:27 +08:00
Tianqi Chen
bc071cac4f Update README.md 2014-03-20 23:12:41 -07:00
Tianqi Chen
50c76ec0d3 Update README.md 2014-03-20 23:12:16 -07:00
tqchen
db285cc4ba add batch running 2014-03-20 16:27:24 -07:00
tqchen
255b1f4043 add feature constraint 2014-03-19 10:47:56 -07:00
tqchen
d3fe4b26a9 fixed remove bug 2014-03-13 13:42:40 -07:00
tqchen
c13126191d neglok 2014-03-12 20:28:21 -07:00
tqchen
8c8dd1a740 support int type 2014-03-12 17:58:14 -07:00
tqchen
329cc61795 more compact 2014-03-11 13:07:20 -07:00
tqchen
a191863213 add accuracy 2014-03-11 13:06:22 -07:00
tqchen
d9ff9fadf6 fix delete 2014-03-11 12:40:51 -07:00
tqchen
377a573097 add remove tree 2014-03-11 11:25:50 -07:00
tqchen
364b4a0f77 add name dumpath 2014-03-06 11:23:51 -08:00
tqchen
d960550933 add add and remove 2014-03-05 16:39:07 -08:00
tqchen
ef5a389ecf try interact mode 2014-03-05 15:28:53 -08:00
tqchen
2bdcad9630 add a test folder 2014-03-05 15:20:11 -08:00
tqchen
74828295fe complete row maker 2014-03-05 14:38:13 -08:00
tqchen
73dfdc539b add row tree maker, to be finished 2014-03-05 11:00:03 -08:00
tqchen
cf14b11130 split new base treemaker, not very good abstraction, but ok 2014-03-05 10:20:36 -08:00
tqchen
8ef7d6beb4 fix reg model_out 2014-03-05 09:34:37 -08:00
tqchen
0fdda29470 reupdate data 2014-03-04 22:47:39 -08:00
tqchen
1479adba58 fix text 2014-03-04 16:22:24 -08:00
tqchen
ae5c26daf6 fix fmatrix 2014-03-04 11:45:22 -08:00
tqchen
ffcfb12515 add simple text loader 2014-03-04 11:33:33 -08:00
tqchen
cba130c40c ok fix 2014-03-03 22:20:45 -08:00
tqchen
9da9861377 big change, change interface to template, everything still OK 2014-03-03 22:16:37 -08:00
tqchen
fad6522a53 backup makefile 2014-03-03 15:21:50 -08:00
tqchen
bbbbe6bc4e compatibility issue with openmp 2014-03-03 15:11:41 -08:00
tqchen
5a65f4b958 ok 2014-03-03 12:26:40 -08:00
tqchen
f0b38810bb maptree is not needed 2014-03-03 11:06:24 -08:00
tqchen
623e003923 fix fmap 2014-03-03 11:05:10 -08:00
tqchen
074a861e7b auto do reboost 2014-03-02 16:42:22 -08:00
tqchen
d534c22094 chg file name of reg 2014-03-02 16:39:00 -08:00
tqchen
4ebdd3cdd2 chg file name of reg 2014-03-02 16:38:59 -08:00
tqchen
c2460da2ab change test task to pred 2014-03-02 16:20:42 -08:00
tqchen
2dd03b1963 make style more like Google style 2014-03-02 13:30:24 -08:00
tqchen
7761d562b1 add smart decision of nfeatures 2014-03-01 21:49:29 -08:00
tqchen
0f410ac54a fix type 2014-03-01 21:29:07 -08:00
tqchen
75427938c3 add smart load 2014-03-01 21:15:54 -08:00
tqchen
5cdc38648b full omp support for regression 2014-03-01 20:56:25 -08:00
tqchen
550010e9d2 fix col maker, make it default 2014-03-01 15:16:30 -08:00
tqchen
394d325078 add col maker 2014-03-01 14:00:09 -08:00
Tianqi Chen
1f04893784 Update README.md 2014-02-28 20:13:01 -08:00
Tianqi Chen
260cbcd3c0 Update README.md 2014-02-28 20:10:57 -08:00
tqchen
e4a4f7d315 chg license, README 2014-02-28 20:09:40 -08:00
tqchen
b57656902e start add coltree maker 2014-02-28 11:44:50 -08:00
tqchen
82807b3a55 add dump2json 2014-02-26 18:54:12 -08:00
tqchen
733f8ae393 add pathdump 2014-02-26 17:08:23 -08:00
tqchen
4a612eb3ba modify tree so that training is standalone 2014-02-26 16:03:00 -08:00
tqchen
2c6922f432 modify tree so that training is standalone 2014-02-26 16:02:58 -08:00
tqchen
9b09cd3d49 change input data structure 2014-02-26 11:51:58 -08:00
tqchen
6fa5c30777 fix mushroom 2014-02-24 23:19:58 -08:00
tqchen
c4949c0937 finish mushroom 2014-02-24 23:06:57 -08:00
tqchen
9d6ef11eb5 add mushroom classification 2014-02-24 22:25:43 -08:00
tqchen
4aa4faa625 add mushroom 2014-02-24 22:19:40 -08:00
tqchen
daab1fef19 pass simple test 2014-02-20 22:28:05 -08:00
tqchen
e52720976c changes to reg booster 2014-02-20 22:08:31 -08:00
kalenhaha
a0dddaf224 tab eliminated 2014-02-19 13:25:01 +08:00
kalenhaha
a20b1d1866 add toy data 2014-02-19 13:01:15 +08:00
kalenhaha
e1b5b99113 add in reg.conf for configuration demo 2014-02-18 16:49:23 +08:00
kalenhaha
7821ef3a7c Merge branch 'master' of https://github.com/tqchen/xgboost 2014-02-16 14:34:35 +08:00
kalenhaha
6d500b2964 fix some bugs 2014-02-16 11:44:03 +08:00
tqchen
f204dd7fcf fix nboosters 2014-02-15 19:42:02 -08:00
tqchen
c38399b989 update license 2014-02-15 17:45:48 -08:00
tqchen
ece5f00ca1 Merge branch 'master' of ssh://github.com/tqchen/xgboost 2014-02-15 17:42:31 -08:00
tqchen
db938ff595 update license 2014-02-15 17:42:23 -08:00
tqchen
5c09686c78 Update README.md 2014-02-15 11:22:50 -08:00
kalenhaha
32e670a4da Comments added 2014-02-13 13:04:55 +08:00
kalenhaha
4dfc4491c2 GBRT Train and Test Phase added 2014-02-12 23:30:32 +08:00
tqchen
d6261c25f2 Update README.md 2014-02-11 20:38:06 -08:00
tqchen
bf81263301 chg fmt to libsvm 2014-02-10 21:41:43 -08:00
tqchen
45a452b27e cleanup reg 2014-02-10 21:09:09 -08:00
tqchen
56e4a2ced1 add regression data 2014-02-10 20:32:23 -08:00
kalenhaha
4d1d3712ea Merge branch 'master' of https://github.com/tqchen/xgboost 2014-02-11 11:19:27 +08:00
kalenhaha
fb568a7a47 gbrt modified 2014-02-11 11:07:00 +08:00
kalenhaha
3afd186ea9 gbrt implemented 2014-02-10 23:40:38 +08:00
tqchen
365b8c4bdc Update README.md 2014-02-08 19:02:33 -08:00
tqchen
6c38e35ffb Update README.md 2014-02-08 13:01:10 -08:00
tqchen
08604d35fc Update README.md 2014-02-08 13:00:49 -08:00
tqchen
52058735d0 Update README.md 2014-02-08 12:50:24 -08:00
tqchen
6a43247bc3 finish readme 2014-02-08 11:47:37 -08:00
tqchen
33acaaa3ae add linear booster 2014-02-08 11:24:35 -08:00
tqchen
d656d9df2c add ok 2014-02-07 22:51:16 -08:00
tqchen
e8feddc6a8 chg makefile 2014-02-07 22:43:13 -08:00
tqchen
bed2e26019 adapt tree booster 2014-02-07 22:41:32 -08:00
tqchen
5d052b9e14 adapt svdfeature tree 2014-02-07 22:38:26 -08:00
tqchen
bf36374678 add detailed comment about gbmcore 2014-02-07 20:30:39 -08:00
tqchen
1e7ac402e6 add empty folder for regression. TODO 2014-02-07 20:20:09 -08:00
tqchen
9ee1048fe9 move core code to booster 2014-02-07 20:13:27 -08:00
tqchen
0d3ecd9033 add base code 2014-02-07 18:40:53 -08:00
tqchen
4e2d67b81a sync everything 2014-02-06 21:28:47 -08:00
tqchen
51d8409e30 add config 2014-02-06 21:26:27 -08:00
tqchen
ee7643bdf6 update this folder 2014-02-06 16:06:59 -08:00
tqchen
5a2b8678fc update this folder 2014-02-06 16:06:18 -08:00
tqchen
750871a158 initial cleanup of interface 2014-02-06 16:03:04 -08:00
tqchen
aecfbf5096 init commit 2014-02-06 15:50:50 -08:00
672 changed files with 98739 additions and 15402 deletions

21
.clang-tidy Normal file
View File

@@ -0,0 +1,21 @@
Checks: 'modernize-*,-modernize-make-*,-modernize-use-auto,-modernize-raw-string-literal,google-*,-google-default-arguments,-clang-diagnostic-#pragma-messages,readability-identifier-naming'
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMemberSuffix, value: '_' }
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: '_' }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.EnumConstant, value: CamelCase }
- { key: readability-identifier-naming.EnumConstantPrefix, value: k }
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- { key: readability-identifier-naming.GlobalConstantPrefix, value: k }
- { key: readability-identifier-naming.StaticConstantCase, value: CamelCase }
- { key: readability-identifier-naming.StaticConstantPrefix, value: k }
- { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
- { key: readability-identifier-naming.ConstexprVariablePrefix, value: k }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }

11
.editorconfig Normal file
View File

@@ -0,0 +1,11 @@
root = true
[*]
charset=utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
[*.py]
indent_style = space
indent_size = 4

7
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,7 @@
Thanks for participating in the XGBoost community! We use https://discuss.xgboost.ai for any general usage questions and discussions. The issue tracker is used for actionable items such as feature proposals discussion, roadmaps, and bug tracking. You are always welcomed to post on the forum first :)
Issues that are inactive for a period of time may get closed. We adopt this policy so that we won't lose track of actionable issues that may fall at the bottom of the pile. Feel free to reopen a new one if you feel there is an additional problem that needs attention when an old one gets closed.
For bug reports, to help the developer act on the issues, please include a description of your environment, preferably a minimum script to reproduce the problem.
For feature proposals, list clear, small actionable items so we can track the progress of the change.

32
.github/lock.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 90
# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
exemptLabels:
- feature-request
# Label to add before locking, such as `outdated`. Set to `false` to disable
lockLabel: false
# Comment to post before locking. Set to `false` to disable
lockComment: false
# Assign `resolved` as the reason for locking. Set to `false` to disable
setLockReason: true
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings just for `issues` or `pulls`
# issues:
# exemptLabels:
# - help-wanted
# lockLabel: outdated
# pulls:
# daysUntilLock: 30
# Repository to extend settings from
# _extends: repo

86
.gitignore vendored
View File

@@ -2,25 +2,97 @@
*.slo
*.lo
*.o
*.page
# Compiled Dynamic libraries
*.so
*.dylib
*.page
# Compiled Static libraries
*.lai
*.la
*.a
*~
*txt*
*.Rcheck
*.rds
*.tar.gz
*conf
*buffer
*model
xgboost
*pyc
*train
*test
*.train
*.test
*.tar
*group
*rar
*vali
*data
*sdf
Release
*exe*
*exp
ipch
*.filters
*.user
*log
Debug
*suo
.Rhistory
*.dll
*i386
*x64
*dump
*save
*csv
.Rproj.user
*.cpage.col
*.cpage
*.Rproj
./xgboost.mpi
./xgboost.mock
#.Rbuildignore
R-package.Rproj
*.cache*
# java
java/xgboost4j/target
java/xgboost4j/tmp
java/xgboost4j-demo/target
java/xgboost4j-demo/data/
java/xgboost4j-demo/tmp/
java/xgboost4j-demo/model/
nb-configuration*
# Eclipse
.project
.cproject
.pydevproject
.settings/
build
config.mk
/xgboost
*.data
build_plugin
.idea
recommonmark/
tags
*.iml
*.class
target
*.swp
# cpp tests and gcov generated files
*.gcov
*.gcda
*.gcno
build_tests
/tests/cpp/xgboost_test
.DS_Store
lib/
# spark
metastore_db
plugin/updater_gpu/test/cpp/data
/include/xgboost/build_config.h
# files from R-package source install
**/config.status
R-package/src/Makevars

9
.gitmodules vendored Normal file
View File

@@ -0,0 +1,9 @@
[submodule "dmlc-core"]
path = dmlc-core
url = https://github.com/dmlc/dmlc-core
[submodule "rabit"]
path = rabit
url = https://github.com/dmlc/rabit
[submodule "cub"]
path = cub
url = https://github.com/NVlabs/cub

60
.travis.yml Normal file
View File

@@ -0,0 +1,60 @@
# disable sudo for container build.
sudo: required
# Enabling test on Linux and OS X
os:
- osx
osx_image: xcode9.3
# Use Build Matrix to do lint and build seperately
env:
matrix:
# python package test
- TASK=python_test
# java package test
- TASK=java_test
# cmake test
# - TASK=cmake_test
# dependent apt packages
addons:
homebrew:
packages:
- gcc@7
- graphviz
- openssl
- libgit2
- r
update: true
before_install:
- source dmlc-core/scripts/travis/travis_setup_env.sh
- export PYTHONPATH=${PYTHONPATH}:${PWD}/python-package
- echo "MAVEN_OPTS='-Xmx2g -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=512m -Dorg.slf4j.simpleLogger.defaultLogLevel=error'" > ~/.mavenrc
install:
- source tests/travis/setup.sh
script:
- tests/travis/run_test.sh
cache:
directories:
- ${HOME}/.cache/usr
- ${HOME}/.cache/pip
before_cache:
- dmlc-core/scripts/travis/travis_before_cache.sh
after_failure:
- tests/travis/travis_after_failure.sh
after_success:
- tree build
- bash <(curl -s https://codecov.io/bash) -a '-o src/ src/*.c'
notifications:
email:
on_success: change
on_failure: always

18
CITATION Normal file
View File

@@ -0,0 +1,18 @@
@inproceedings{Chen:2016:XST:2939672.2939785,
author = {Chen, Tianqi and Guestrin, Carlos},
title = {{XGBoost}: A Scalable Tree Boosting System},
booktitle = {Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},
series = {KDD '16},
year = {2016},
isbn = {978-1-4503-4232-2},
location = {San Francisco, California, USA},
pages = {785--794},
numpages = {10},
url = {http://doi.acm.org/10.1145/2939672.2939785},
doi = {10.1145/2939672.2939785},
acmid = {2939785},
publisher = {ACM},
address = {New York, NY, USA},
keywords = {large-scale machine learning},
}

229
CMakeLists.txt Normal file
View File

@@ -0,0 +1,229 @@
cmake_minimum_required(VERSION 3.3)
project(xgboost LANGUAGES CXX C VERSION 0.90)
include(cmake/Utils.cmake)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
cmake_policy(SET CMP0022 NEW)
message(STATUS "CMake version ${CMAKE_VERSION}")
if (MSVC)
cmake_minimum_required(VERSION 3.11)
endif (MSVC)
set_default_configuration_release()
#-- Options
option(BUILD_C_DOC "Build documentation for C APIs using Doxygen." OFF)
option(USE_OPENMP "Build with OpenMP support." ON)
## Bindings
option(JVM_BINDINGS "Build JVM bindings" OFF)
option(R_LIB "Build shared library for R package" OFF)
## Dev
option(GOOGLE_TEST "Build google tests" OFF)
option(USE_DMLC_GTEST "Use google tests bundled with dmlc-core submodule (EXPERIMENTAL)" OFF)
option(USE_NVTX "Build with cuda profiling annotations. Developers only." OFF)
set(NVTX_HEADER_DIR "" CACHE PATH "Path to the stand-alone nvtx header")
## CUDA
option(USE_CUDA "Build with GPU acceleration" OFF)
option(USE_NCCL "Build with NCCL to enable multi-GPU support." OFF)
option(BUILD_WITH_SHARED_NCCL "Build with shared NCCL library." OFF)
set(GPU_COMPUTE_VER "" CACHE STRING
"Semicolon separated list of compute versions to be built against, e.g. '35;61'")
if (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
message(SEND_ERROR "Build XGBoost with -DUSE_NCCL=ON to enable BUILD_WITH_SHARED_NCCL.")
endif (BUILD_WITH_SHARED_NCCL AND (NOT USE_NCCL))
## Sanitizers
option(USE_SANITIZER "Use santizer flags" OFF)
option(SANITIZER_PATH "Path to sanitizes.")
set(ENABLED_SANITIZERS "address" "leak" CACHE STRING
"Semicolon separated list of sanitizer names. E.g 'address;leak'. Supported sanitizers are
address, leak and thread.")
## Plugins
option(PLUGIN_LZ4 "Build lz4 plugin" OFF)
option(PLUGIN_DENSE_PARSER "Build dense parser plugin" OFF)
## Deprecation warning
if (USE_AVX)
message(WARNING "The option 'USE_AVX' is deprecated as experimental AVX features have been removed from xgboost.")
endif (USE_AVX)
# Sanitizer
if (USE_SANITIZER)
# Older CMake versions have had troubles with Sanitizer
cmake_minimum_required(VERSION 3.12)
include(cmake/Sanitizer.cmake)
enable_sanitizers("${ENABLED_SANITIZERS}")
endif (USE_SANITIZER)
if (USE_CUDA)
cmake_minimum_required(VERSION 3.12)
SET(USE_OPENMP ON CACHE BOOL "CUDA requires OpenMP" FORCE)
# `export CXX=' is ignored by CMake CUDA.
set(CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER})
message(STATUS "Configured CUDA host compiler: ${CMAKE_CUDA_HOST_COMPILER}")
enable_language(CUDA)
set(GEN_CODE "")
format_gencode_flags("${GPU_COMPUTE_VER}" GEN_CODE)
message(STATUS "CUDA GEN_CODE: ${GEN_CODE}")
endif (USE_CUDA)
# dmlc-core
msvc_use_static_runtime()
add_subdirectory(${PROJECT_SOURCE_DIR}/dmlc-core)
set_target_properties(dmlc PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON)
list(APPEND LINKED_LIBRARIES_PRIVATE dmlc)
# rabit
# full rabit doesn't build on windows, so we can't import it as subdirectory
if(MINGW OR R_LIB)
set(RABIT_SOURCES
rabit/src/engine_empty.cc
rabit/src/c_api.cc)
else ()
set(RABIT_SOURCES
rabit/src/allreduce_base.cc
rabit/src/allreduce_robust.cc
rabit/src/engine.cc
rabit/src/c_api.cc)
endif (MINGW OR R_LIB)
add_library(rabit STATIC ${RABIT_SOURCES})
target_include_directories(rabit PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/dmlc-core/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/rabit/include/rabit>)
set_target_properties(rabit
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON)
list(APPEND LINKED_LIBRARIES_PRIVATE rabit)
# Exports some R specific definitions and objects
if (R_LIB)
add_subdirectory(${PROJECT_SOURCE_DIR}/R-package)
endif (R_LIB)
# core xgboost
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
set(XGBOOST_OBJ_SOURCES "${XGBOOST_OBJ_SOURCES};$<TARGET_OBJECTS:objxgboost>")
#-- Shared library
add_library(xgboost SHARED ${XGBOOST_OBJ_SOURCES} ${PLUGINS_SOURCES})
target_include_directories(xgboost
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
target_link_libraries(xgboost PRIVATE ${LINKED_LIBRARIES_PRIVATE})
# This creates its own shared library `xgboost4j'.
if (JVM_BINDINGS)
add_subdirectory(${PROJECT_SOURCE_DIR}/jvm-packages)
endif (JVM_BINDINGS)
#-- End shared library
#-- CLI for xgboost
add_executable(runxgboost ${PROJECT_SOURCE_DIR}/src/cli_main.cc ${XGBOOST_OBJ_SOURCES})
# For cli_main.cc only
if (USE_OPENMP)
find_package(OpenMP REQUIRED)
target_compile_options(runxgboost PRIVATE ${OpenMP_CXX_FLAGS})
endif (USE_OPENMP)
target_include_directories(runxgboost
PRIVATE
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/dmlc-core/include
${PROJECT_SOURCE_DIR}/rabit/include)
target_link_libraries(runxgboost PRIVATE ${LINKED_LIBRARIES_PRIVATE})
set_target_properties(
runxgboost PROPERTIES
OUTPUT_NAME xgboost
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON)
#-- End CLI for xgboost
set_output_directory(runxgboost ${PROJECT_SOURCE_DIR})
set_output_directory(xgboost ${PROJECT_SOURCE_DIR}/lib)
# Ensure these two targets do not build simultaneously, as they produce outputs with conflicting names
add_dependencies(xgboost runxgboost)
#-- Installing XGBoost
if (R_LIB)
set_target_properties(xgboost PROPERTIES PREFIX "")
if (APPLE)
set_target_properties(xgboost PROPERTIES SUFFIX ".so")
endif (APPLE)
setup_rpackage_install_target(xgboost ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/dummy_inst")
endif (R_LIB)
if (MINGW)
set_target_properties(xgboost PROPERTIES PREFIX "")
endif (MINGW)
if (BUILD_C_DOC)
include(cmake/Doc.cmake)
run_doxygen()
endif (BUILD_C_DOC)
include(GNUInstallDirs)
# Exposing only C APIs.
install(FILES
"${PROJECT_SOURCE_DIR}/include/xgboost/c_api.h"
DESTINATION
include/xgboost/)
install(TARGETS xgboost runxgboost
EXPORT XGBoostTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${LIBLEGACY_INCLUDE_DIRS})
install(EXPORT XGBoostTargets
FILE XGBoostTargets.cmake
NAMESPACE xgboost::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/xgboost)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/xgboost-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/xgboost-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/xgboost)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/cmake/xgboost-config-version.cmake
VERSION ${XGBOOST_VERSION}
COMPATIBILITY AnyNewerVersion)
install(
FILES
${CMAKE_BINARY_DIR}/cmake/xgboost-config.cmake
${CMAKE_BINARY_DIR}/cmake/xgboost-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/xgboost)
#-- Test
if (GOOGLE_TEST)
enable_testing()
# Unittests.
add_subdirectory(${PROJECT_SOURCE_DIR}/tests/cpp)
add_test(
NAME TestXGBoostLib
COMMAND testxgboost
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
# CLI tests
configure_file(
${PROJECT_SOURCE_DIR}/tests/cli/machine.conf.in
${PROJECT_BINARY_DIR}/tests/cli/machine.conf
@ONLY)
add_test(
NAME TestXGBoostCLI
COMMAND runxgboost ${PROJECT_BINARY_DIR}/tests/cli/machine.conf
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
set_tests_properties(TestXGBoostCLI
PROPERTIES
PASS_REGULAR_EXPRESSION ".*test-rmse:0.087.*")
endif (GOOGLE_TEST)
# For MSVC: Call msvc_use_static_runtime() once again to completely
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
# for issues caused by mixing of /MD and /MT flags
msvc_use_static_runtime()

91
CONTRIBUTORS.md Normal file
View File

@@ -0,0 +1,91 @@
Contributors of DMLC/XGBoost
============================
XGBoost has been developed and used by a group of active community. Everyone is more than welcomed to is a great way to make the project better and more accessible to more users.
Committers
----------
Committers are people who have made substantial contribution to the project and granted write access to the project.
* [Tianqi Chen](https://github.com/tqchen), University of Washington
- Tianqi is a Ph.D. student working on large-scale machine learning. He is the creator of the project.
* [Tong He](https://github.com/hetong007), Amazon AI
- Tong is an applied scientist in Amazon AI. He is the maintainer of XGBoost R package.
* [Vadim Khotilovich](https://github.com/khotilov)
- Vadim contributes many improvements in R and core packages.
* [Bing Xu](https://github.com/antinucleon)
- Bing is the original creator of XGBoost Python package and currently the maintainer of [XGBoost.jl](https://github.com/antinucleon/XGBoost.jl).
* [Michael Benesty](https://github.com/pommedeterresautee)
- Michael is a lawyer and data scientist in France. He is the creator of XGBoost interactive analysis module in R.
* [Yuan Tang](https://github.com/terrytangyuan), Ant Financial
- Yuan is a software engineer in Ant Financial. He contributed mostly in R and Python packages.
* [Nan Zhu](https://github.com/CodingCat), Uber
- Nan is a software engineer in Uber. He contributed mostly in JVM packages.
* [Sergei Lebedev](https://github.com/superbobry), Criteo
- Sergei is a software engineer in Criteo. He contributed mostly in JVM packages.
* [Hongliang Liu](https://github.com/phunterlau)
* [Scott Lundberg](http://scottlundberg.com/), University of Washington
- Scott is a Ph.D. student at University of Washington. He is the creator of SHAP, a unified approach to explain the output of machine learning models such as decision tree ensembles. He also helps maintain the XGBoost Julia package.
* [Rory Mitchell](https://github.com/RAMitchell), University of Waikato
- Rory is a Ph.D. student at University of Waikato. He is the original creator of the GPU training algorithms. He improved the CMake build system and continuous integration.
* [Hyunsu Cho](http://hyunsu-cho.io/), Amazon AI
- Hyunsu is an applied scientist in Amazon AI. He is the maintainer of the XGBoost Python package. He also manages the Jenkins continuous integration system (https://xgboost-ci.net/). He is the initial author of the CPU 'hist' updater.
* [Jiaming](https://github.com/trivialfis)
- Jiaming contributed to the GPU algorithms. He has also introduced new abstractions to improve the quality of the C++ codebase.
Become a Committer
------------------
XGBoost is a opensource project and we are actively looking for new committers who are willing to help maintaining and lead the project.
Committers comes from contributors who:
* Made substantial contribution to the project.
* Willing to spent time on maintaining and lead the project.
New committers will be proposed by current committer members, with support from more than two of current committers.
List of Contributors
--------------------
* [Full List of Contributors](https://github.com/dmlc/xgboost/graphs/contributors)
- To contributors: please add your name to the list when you submit a patch to the project:)
* [Kailong Chen](https://github.com/kalenhaha)
- Kailong is an early contributor of XGBoost, he is creator of ranking objectives in XGBoost.
* [Skipper Seabold](https://github.com/jseabold)
- Skipper is the major contributor to the scikit-learn module of XGBoost.
* [Zygmunt Zając](https://github.com/zygmuntz)
- Zygmunt is the master behind the early stopping feature frequently used by kagglers.
* [Ajinkya Kale](https://github.com/ajkl)
* [Boliang Chen](https://github.com/cblsjtu)
* [Yangqing Men](https://github.com/yanqingmen)
- Yangqing is the creator of XGBoost java package.
* [Engpeng Yao](https://github.com/yepyao)
* [Giulio](https://github.com/giuliohome)
- Giulio is the creator of Windows project of XGBoost
* [Jamie Hall](https://github.com/nerdcha)
- Jamie is the initial creator of XGBoost scikit-learn module.
* [Yen-Ying Lee](https://github.com/white1033)
* [Masaaki Horikoshi](https://github.com/sinhrks)
- Masaaki is the initial creator of XGBoost Python plotting module.
* [daiyl0320](https://github.com/daiyl0320)
- daiyl0320 contributed patch to XGBoost distributed version more robust, and scales stably on TB scale datasets.
* [Huayi Zhang](https://github.com/irachex)
* [Johan Manders](https://github.com/johanmanders)
* [yoori](https://github.com/yoori)
* [Mathias Müller](https://github.com/far0n)
* [Sam Thomson](https://github.com/sammthomson)
* [ganesh-krishnan](https://github.com/ganesh-krishnan)
* [Damien Carol](https://github.com/damiencarol)
* [Alex Bain](https://github.com/convexquad)
* [Baltazar Bieniek](https://github.com/bbieniek)
* [Adam Pocock](https://github.com/Craigacp)
* [Gideon Whitehead](https://github.com/gaw89)
* [Yi-Lin Juang](https://github.com/frankyjuang)
* [Andrew Hannigan](https://github.com/andrewhannigan)
* [Andy Adinets](https://github.com/canonizer)
* [Henry Gouk](https://github.com/henrygouk)
* [Pierre de Sahb](https://github.com/pdesahb)
* [liuliang01](https://github.com/liuliang01)
- liuliang01 added support for the qid column for LibSVM input format. This makes ranking task easier in distributed setting.
* [Andrew Thia](https://github.com/BlueTea88)
- Andrew Thia implemented feature interaction constraints
* [Wei Tian](https://github.com/weitian)
* [Chen Qin](https://github.com/chenqin)
* [Sam Wilkinson](https://samwilkinson.io)
* [Matthew Jones](https://github.com/mt-jones)
* [Jiaxiang Li](https://github.com/JiaxiangBU)

345
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,345 @@
#!/usr/bin/groovy
// -*- mode: groovy -*-
// Jenkins pipeline
// See documents at https://jenkins.io/doc/book/pipeline/jenkinsfile/
// Command to run command inside a docker container
dockerRun = 'tests/ci_build/ci_build.sh'
pipeline {
// Each stage specify its own agent
agent none
environment {
DOCKER_CACHE_REPO = '492475357299.dkr.ecr.us-west-2.amazonaws.com'
}
// Setup common job properties
options {
ansiColor('xterm')
timestamps()
timeout(time: 120, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '10'))
preserveStashes()
}
// Build stages
stages {
stage('Jenkins Linux: Get sources') {
agent { label 'linux && cpu' }
steps {
script {
checkoutSrcs()
}
stash name: 'srcs'
milestone ordinal: 1
}
}
stage('Jenkins Linux: Formatting Check') {
agent none
steps {
script {
parallel ([
'clang-tidy': { ClangTidy() },
'lint': { Lint() },
'sphinx-doc': { SphinxDoc() },
'doxygen': { Doxygen() }
])
}
milestone ordinal: 2
}
}
stage('Jenkins Linux: Build') {
agent none
steps {
script {
parallel ([
'build-cpu': { BuildCPU() },
'build-gpu-cuda8.0': { BuildCUDA(cuda_version: '8.0') },
'build-gpu-cuda9.0': { BuildCUDA(cuda_version: '9.0') },
'build-gpu-cuda10.0': { BuildCUDA(cuda_version: '10.0') },
'build-gpu-cuda10.1': { BuildCUDA(cuda_version: '10.1') },
'build-jvm-packages': { BuildJVMPackages(spark_version: '2.4.3') },
'build-jvm-doc': { BuildJVMDoc() }
])
}
milestone ordinal: 3
}
}
stage('Jenkins Linux: Test') {
agent none
steps {
script {
parallel ([
'test-python-cpu': { TestPythonCPU() },
'test-python-gpu-cuda8.0': { TestPythonGPU(cuda_version: '8.0') },
'test-python-gpu-cuda9.0': { TestPythonGPU(cuda_version: '9.0') },
'test-python-gpu-cuda10.0': { TestPythonGPU(cuda_version: '10.0') },
'test-python-gpu-cuda10.1': { TestPythonGPU(cuda_version: '10.1') },
'test-python-mgpu-cuda10.1': { TestPythonGPU(cuda_version: '10.1', multi_gpu: true) },
'test-cpp-gpu': { TestCppGPU(cuda_version: '10.1') },
'test-cpp-mgpu': { TestCppGPU(cuda_version: '10.1', multi_gpu: true) },
'test-jvm-jdk8': { CrossTestJVMwithJDK(jdk_version: '8', spark_version: '2.4.3') },
'test-jvm-jdk11': { CrossTestJVMwithJDK(jdk_version: '11') },
'test-jvm-jdk12': { CrossTestJVMwithJDK(jdk_version: '12') },
'test-r-3.4.4': { TestR(use_r35: false) },
'test-r-3.5.3': { TestR(use_r35: true) }
])
}
milestone ordinal: 4
}
}
}
}
// check out source code from git
def checkoutSrcs() {
retry(5) {
try {
timeout(time: 2, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init'
}
} catch (exc) {
deleteDir()
error "Failed to fetch source codes"
}
}
}
def ClangTidy() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Running clang-tidy job..."
def container_type = "clang_tidy"
def docker_binary = "docker"
def dockerArgs = "--build-arg CUDA_VERSION=9.2"
sh """
${dockerRun} ${container_type} ${docker_binary} ${dockerArgs} tests/ci_build/clang_tidy.sh
"""
deleteDir()
}
}
def Lint() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Running lint..."
def container_type = "cpu"
def docker_binary = "docker"
sh """
${dockerRun} ${container_type} ${docker_binary} make lint
"""
deleteDir()
}
}
def SphinxDoc() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Running sphinx-doc..."
def container_type = "cpu"
def docker_binary = "docker"
def docker_extra_params = "CI_DOCKER_EXTRA_PARAMS_INIT='-e SPHINX_GIT_BRANCH=${BRANCH_NAME}'"
sh """#!/bin/bash
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} make -C doc html
"""
deleteDir()
}
}
def Doxygen() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Running doxygen..."
def container_type = "cpu"
def docker_binary = "docker"
sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/doxygen.sh ${BRANCH_NAME}
"""
archiveArtifacts artifacts: "build/${BRANCH_NAME}.tar.bz2", allowEmptyArchive: true
echo 'Uploading doc...'
s3Upload file: "build/${BRANCH_NAME}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "doxygen/${BRANCH_NAME}.tar.bz2"
deleteDir()
}
}
def BuildCPU() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Build CPU"
def container_type = "cpu"
def docker_binary = "docker"
sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_via_cmake.sh
${dockerRun} ${container_type} ${docker_binary} build/testxgboost
"""
// Sanitizer test
def docker_extra_params = "CI_DOCKER_EXTRA_PARAMS_INIT='-e ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer -e ASAN_OPTIONS=symbolize=1 --cap-add SYS_PTRACE'"
def docker_args = "--build-arg CMAKE_VERSION=3.12"
sh """
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/build_via_cmake.sh -DUSE_SANITIZER=ON -DENABLED_SANITIZERS="address" \
-DCMAKE_BUILD_TYPE=Debug -DSANITIZER_PATH=/usr/lib/x86_64-linux-gnu/
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} build/testxgboost
"""
deleteDir()
}
}
def BuildCUDA(args) {
node('linux && cpu') {
unstash name: 'srcs'
echo "Build with CUDA ${args.cuda_version}"
def container_type = "gpu_build"
def docker_binary = "docker"
def docker_args = "--build-arg CUDA_VERSION=${args.cuda_version}"
sh """
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/build_via_cmake.sh -DUSE_CUDA=ON -DUSE_NCCL=ON -DOPEN_MP:BOOL=ON
${dockerRun} ${container_type} ${docker_binary} ${docker_args} bash -c "cd python-package && rm -rf dist/* && python setup.py bdist_wheel --universal"
"""
// Stash wheel for CUDA 8.0 / 9.0 target
if (args.cuda_version == '8.0') {
echo 'Stashing Python wheel...'
stash name: 'xgboost_whl_cuda8', includes: 'python-package/dist/*.whl'
} else if (args.cuda_version == '9.0') {
echo 'Stashing Python wheel...'
stash name: 'xgboost_whl_cuda9', includes: 'python-package/dist/*.whl'
archiveArtifacts artifacts: "python-package/dist/*.whl", allowEmptyArchive: true
echo 'Stashing C++ test executable (testxgboost)...'
stash name: 'xgboost_cpp_tests', includes: 'build/testxgboost'
}
deleteDir()
}
}
def BuildJVMPackages(args) {
node('linux && cpu') {
unstash name: 'srcs'
echo "Build XGBoost4J-Spark with Spark ${args.spark_version}"
def container_type = "jvm"
def docker_binary = "docker"
// Use only 4 CPU cores
def docker_extra_params = "CI_DOCKER_EXTRA_PARAMS_INIT='--cpuset-cpus 0-3'"
sh """
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_jvm_packages.sh ${args.spark_version}
"""
echo 'Stashing XGBoost4J JAR...'
stash name: 'xgboost4j_jar', includes: 'jvm-packages/xgboost4j/target/*.jar,jvm-packages/xgboost4j-spark/target/*.jar,jvm-packages/xgboost4j-example/target/*.jar'
deleteDir()
}
}
def BuildJVMDoc() {
node('linux && cpu') {
unstash name: 'srcs'
echo "Building JVM doc..."
def container_type = "jvm"
def docker_binary = "docker"
sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/build_jvm_doc.sh ${BRANCH_NAME}
"""
archiveArtifacts artifacts: "jvm-packages/${BRANCH_NAME}.tar.bz2", allowEmptyArchive: true
echo 'Uploading doc...'
s3Upload file: "jvm-packages/${BRANCH_NAME}.tar.bz2", bucket: 'xgboost-docs', acl: 'PublicRead', path: "${BRANCH_NAME}.tar.bz2"
deleteDir()
}
}
def TestPythonCPU() {
node('linux && cpu') {
unstash name: 'xgboost_whl_cuda9'
unstash name: 'srcs'
echo "Test Python CPU"
def container_type = "cpu"
def docker_binary = "docker"
sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/test_python.sh cpu
"""
deleteDir()
}
}
def TestPythonGPU(args) {
nodeReq = (args.multi_gpu) ? 'linux && mgpu' : 'linux && gpu'
node(nodeReq) {
if (args.cuda_version == '8.0') {
unstash name: 'xgboost_whl_cuda8'
} else {
unstash name: 'xgboost_whl_cuda9'
}
unstash name: 'srcs'
echo "Test Python GPU: CUDA ${args.cuda_version}"
def container_type = "gpu"
def docker_binary = "nvidia-docker"
def docker_args = "--build-arg CUDA_VERSION=${args.cuda_version}"
if (args.multi_gpu) {
echo "Using multiple GPUs"
sh """
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/test_python.sh mgpu
"""
} else {
echo "Using a single GPU"
sh """
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/test_python.sh gpu
"""
}
deleteDir()
}
}
def TestCppGPU(args) {
nodeReq = (args.multi_gpu) ? 'linux && mgpu' : 'linux && gpu'
node(nodeReq) {
unstash name: 'xgboost_cpp_tests'
unstash name: 'srcs'
echo "Test C++, CUDA ${args.cuda_version}"
def container_type = "gpu"
def docker_binary = "nvidia-docker"
def docker_args = "--build-arg CUDA_VERSION=${args.cuda_version}"
if (args.multi_gpu) {
echo "Using multiple GPUs"
sh "${dockerRun} ${container_type} ${docker_binary} ${docker_args} build/testxgboost --gtest_filter=*.MGPU_*"
} else {
echo "Using a single GPU"
sh "${dockerRun} ${container_type} ${docker_binary} ${docker_args} build/testxgboost --gtest_filter=-*.MGPU_*"
}
deleteDir()
}
}
def CrossTestJVMwithJDK(args) {
node('linux && cpu') {
unstash name: 'xgboost4j_jar'
unstash name: 'srcs'
if (args.spark_version != null) {
echo "Test XGBoost4J on a machine with JDK ${args.jdk_version}, Spark ${args.spark_version}"
} else {
echo "Test XGBoost4J on a machine with JDK ${args.jdk_version}"
}
def container_type = "jvm_cross"
def docker_binary = "docker"
def spark_arg = (args.spark_version != null) ? "--build-arg SPARK_VERSION=${args.spark_version}" : ""
def docker_args = "--build-arg JDK_VERSION=${args.jdk_version} ${spark_arg}"
// Run integration tests only when spark_version is given
def docker_extra_params = (args.spark_version != null) ? "CI_DOCKER_EXTRA_PARAMS_INIT='-e RUN_INTEGRATION_TEST=1'" : ""
sh """
${docker_extra_params} ${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/test_jvm_cross.sh
"""
deleteDir()
}
}
def TestR(args) {
node('linux && cpu') {
unstash name: 'srcs'
echo "Test R package"
def container_type = "rproject"
def docker_binary = "docker"
def use_r35_flag = (args.use_r35) ? "1" : "0"
def docker_args = "--build-arg USE_R35=${use_r35_flag}"
sh """
${dockerRun} ${container_type} ${docker_binary} ${docker_args} tests/ci_build/build_test_rpkg.sh
"""
deleteDir()
}
}

134
Jenkinsfile-win64 Normal file
View File

@@ -0,0 +1,134 @@
#!/usr/bin/groovy
// -*- mode: groovy -*-
/* Jenkins pipeline for Windows AMD64 target */
pipeline {
agent none
// Build stages
stages {
stage('Jenkins Win64: Get sources') {
agent { label 'win64 && build' }
steps {
script {
checkoutSrcs()
}
stash name: 'srcs'
milestone ordinal: 1
}
}
stage('Jenkins Win64: Build') {
agent none
steps {
script {
parallel ([
'build-win64-cuda9.0': { BuildWin64() }
])
}
milestone ordinal: 2
}
}
stage('Jenkins Win64: Test') {
agent none
steps {
script {
parallel ([
'test-win64-cpu': { TestWin64CPU() },
'test-win64-gpu-cuda9.0': { TestWin64GPU(cuda_target: 'cuda9') },
'test-win64-gpu-cuda10.0': { TestWin64GPU(cuda_target: 'cuda10_0') },
'test-win64-gpu-cuda10.1': { TestWin64GPU(cuda_target: 'cuda10_1') }
])
}
milestone ordinal: 3
}
}
}
}
// check out source code from git
def checkoutSrcs() {
retry(5) {
try {
timeout(time: 2, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init'
}
} catch (exc) {
deleteDir()
error "Failed to fetch source codes"
}
}
}
def BuildWin64() {
node('win64 && build') {
unstash name: 'srcs'
echo "Building XGBoost for Windows AMD64 target..."
bat "nvcc --version"
bat """
mkdir build
cd build
cmake .. -G"Visual Studio 15 2017 Win64" -DUSE_CUDA=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON
"""
bat """
cd build
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe" xgboost.sln /m /p:Configuration=Release /nodeReuse:false
"""
bat """
cd python-package
conda activate && python setup.py bdist_wheel --universal
"""
echo "Insert vcomp140.dll (OpenMP runtime) into the wheel..."
bat """
cd python-package\\dist
COPY /B ..\\..\\tests\\ci_build\\insert_vcomp140.py
conda activate && python insert_vcomp140.py *.whl
"""
echo 'Stashing Python wheel...'
stash name: 'xgboost_whl', includes: 'python-package/dist/*.whl'
archiveArtifacts artifacts: "python-package/dist/*.whl", allowEmptyArchive: true
echo 'Stashing C++ test executable (testxgboost)...'
stash name: 'xgboost_cpp_tests', includes: 'build/testxgboost.exe'
deleteDir()
}
}
def TestWin64CPU() {
node('win64 && cpu') {
unstash name: 'srcs'
unstash name: 'xgboost_whl'
echo "Test Win64 CPU"
echo "Installing Python wheel..."
bat "conda activate && (python -m pip uninstall -y xgboost || cd .)"
bat """
conda activate && for /R %%i in (python-package\\dist\\*.whl) DO python -m pip install "%%i"
"""
echo "Running Python tests..."
bat "conda activate && python -m pytest -v -s --fulltrace tests\\python"
bat "conda activate && python -m pip uninstall -y xgboost"
deleteDir()
}
}
def TestWin64GPU(args) {
node("win64 && gpu && ${args.cuda_target}") {
unstash name: 'srcs'
unstash name: 'xgboost_whl'
unstash name: 'xgboost_cpp_tests'
echo "Test Win64 GPU (${args.cuda_target})"
bat "nvcc --version"
echo "Running C++ tests..."
bat "build\\testxgboost.exe"
echo "Installing Python wheel..."
bat "conda activate && (python -m pip uninstall -y xgboost || cd .)"
bat """
conda activate && for /R %%i in (python-package\\dist\\*.whl) DO python -m pip install "%%i"
"""
echo "Running Python tests..."
bat """
conda activate && python -m pytest -v -s --fulltrace -m "(not slow) and (not mgpu)" tests\\python-gpu
"""
bat "conda activate && python -m pip uninstall -y xgboost"
deleteDir()
}
}

210
LICENSE
View File

@@ -1,13 +1,201 @@
Copyright (c) 2014 by Tianqi Chen and Contributors
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright (c) 2018 by Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

285
Makefile
View File

@@ -1,26 +1,281 @@
export CC = gcc
ifndef config
ifneq ("$(wildcard ./config.mk)","")
config = config.mk
else
config = make/config.mk
endif
endif
ifndef DMLC_CORE
DMLC_CORE = dmlc-core
endif
ifndef RABIT
RABIT = rabit
endif
ROOTDIR = $(CURDIR)
# workarounds for some buggy old make & msys2 versions seen in windows
ifeq (NA, $(shell test ! -d "$(ROOTDIR)" && echo NA ))
$(warning Attempting to fix non-existing ROOTDIR [$(ROOTDIR)])
ROOTDIR := $(shell pwd)
$(warning New ROOTDIR [$(ROOTDIR)] $(shell test -d "$(ROOTDIR)" && echo " is OK" ))
endif
MAKE_OK := $(shell "$(MAKE)" -v 2> /dev/null)
ifndef MAKE_OK
$(warning Attempting to recover non-functional MAKE [$(MAKE)])
MAKE := $(shell which make 2> /dev/null)
MAKE_OK := $(shell "$(MAKE)" -v 2> /dev/null)
endif
$(warning MAKE [$(MAKE)] - $(if $(MAKE_OK),checked OK,PROBLEM))
ifeq ($(OS), Windows_NT)
UNAME="Windows"
else
UNAME=$(shell uname)
endif
include $(config)
ifeq ($(USE_OPENMP), 0)
export NO_OPENMP = 1
endif
include $(DMLC_CORE)/make/dmlc.mk
# include the plugins
ifdef XGB_PLUGINS
include $(XGB_PLUGINS)
endif
# set compiler defaults for OSX versus *nix
# let people override either
OS := $(shell uname)
ifeq ($(OS), Darwin)
ifndef CC
export CC = $(if $(shell which clang), clang, gcc)
endif
ifndef CXX
export CXX = $(if $(shell which clang++), clang++, g++)
endif
else
# linux defaults
ifndef CC
export CC = gcc
endif
ifndef CXX
export CXX = g++
export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fopenmp
endif
endif
export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)
export CFLAGS= -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude $(ADD_CFLAGS) $(PLUGIN_CFLAGS)
CFLAGS += -I$(DMLC_CORE)/include -I$(RABIT)/include -I$(GTEST_PATH)/include
#java include path
export JAVAINCFLAGS = -I${JAVA_HOME}/include -I./java
ifeq ($(TEST_COVER), 1)
CFLAGS += -g -O0 -fprofile-arcs -ftest-coverage
else
CFLAGS += -O3 -funroll-loops
ifeq ($(USE_SSE), 1)
CFLAGS += -msse2
endif
endif
ifndef LINT_LANG
LINT_LANG= "all"
endif
ifeq ($(UNAME), Windows)
XGBOOST_DYLIB = lib/xgboost.dll
JAVAINCFLAGS += -I${JAVA_HOME}/include/win32
else
ifeq ($(UNAME), Darwin)
XGBOOST_DYLIB = lib/libxgboost.dylib
CFLAGS += -fPIC
else
XGBOOST_DYLIB = lib/libxgboost.so
CFLAGS += -fPIC
endif
endif
ifeq ($(UNAME), Linux)
LDFLAGS += -lrt
JAVAINCFLAGS += -I${JAVA_HOME}/include/linux
endif
ifeq ($(UNAME), Darwin)
JAVAINCFLAGS += -I${JAVA_HOME}/include/darwin
endif
OPENMP_FLAGS =
ifeq ($(USE_OPENMP), 1)
OPENMP_FLAGS = -fopenmp
else
OPENMP_FLAGS = -DDISABLE_OPENMP
endif
CFLAGS += $(OPENMP_FLAGS)
# specify tensor path
BIN = xgboost
OBJ =
.PHONY: clean all
.PHONY: clean all lint clean_all doxygen rcpplint pypack Rpack Rbuild Rcheck java pylint
all: $(BIN) $(OBJ)
export LDFLAGS= -pthread -lm
all: lib/libxgboost.a $(XGBOOST_DYLIB) xgboost
xgboost: regrank/xgboost_regrank_main.cpp regrank/*.h regrank/*.hpp booster/*.h booster/*/*.hpp booster/*.hpp
$(DMLC_CORE)/libdmlc.a: $(wildcard $(DMLC_CORE)/src/*.cc $(DMLC_CORE)/src/*/*.cc)
+ cd $(DMLC_CORE); "$(MAKE)" libdmlc.a config=$(ROOTDIR)/$(config); cd $(ROOTDIR)
$(RABIT)/lib/$(LIB_RABIT): $(wildcard $(RABIT)/src/*.cc)
+ cd $(RABIT); "$(MAKE)" lib/$(LIB_RABIT) USE_SSE=$(USE_SSE); cd $(ROOTDIR)
jvm: jvm-packages/lib/libxgboost4j.so
SRC = $(wildcard src/*.cc src/*/*.cc)
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC)) $(PLUGIN_OBJS)
AMALGA_OBJ = amalgamation/xgboost-all0.o
LIB_DEP = $(DMLC_CORE)/libdmlc.a $(RABIT)/lib/$(LIB_RABIT)
ALL_DEP = $(filter-out build/cli_main.o, $(ALL_OBJ)) $(LIB_DEP)
CLI_OBJ = build/cli_main.o
include tests/cpp/xgboost_test.mk
build/%.o: src/%.cc
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d
$(CXX) -c $(CFLAGS) $< -o $@
build_plugin/%.o: plugin/%.cc
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -MM -MT build_plugin/$*.o $< >build_plugin/$*.d
$(CXX) -c $(CFLAGS) $< -o $@
# The should be equivalent to $(ALL_OBJ) except for build/cli_main.o
amalgamation/xgboost-all0.o: amalgamation/xgboost-all0.cc
$(CXX) -c $(CFLAGS) $< -o $@
# Equivalent to lib/libxgboost_all.so
lib/libxgboost_all.so: $(AMALGA_OBJ) $(LIB_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %.a, $^) $(LDFLAGS)
lib/libxgboost.a: $(ALL_DEP)
@mkdir -p $(@D)
ar crv $@ $(filter %.o, $?)
lib/xgboost.dll lib/libxgboost.so lib/libxgboost.dylib: $(ALL_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %a, $^) $(LDFLAGS)
jvm-packages/lib/libxgboost4j.so: jvm-packages/xgboost4j/src/native/xgboost4j.cpp $(ALL_DEP)
@mkdir -p $(@D)
$(CXX) $(CFLAGS) $(JAVAINCFLAGS) -shared -o $@ $(filter %.cpp %.o %.a, $^) $(LDFLAGS)
$(BIN) :
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^)
xgboost: $(CLI_OBJ) $(ALL_DEP)
$(CXX) $(CFLAGS) -o $@ $(filter %.o %.a, $^) $(LDFLAGS)
$(OBJ) :
$(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c, $^) )
rcpplint:
python3 dmlc-core/scripts/lint.py xgboost ${LINT_LANG} R-package/src
install:
cp -f -r $(BIN) $(INSTALL_PATH)
lint: rcpplint
python3 dmlc-core/scripts/lint.py --exclude_path python-package/xgboost/dmlc-core \
python-package/xgboost/include python-package/xgboost/lib \
python-package/xgboost/make python-package/xgboost/rabit \
python-package/xgboost/src --pylint-rc ${PWD}/python-package/.pylintrc xgboost \
${LINT_LANG} include src plugin python-package
pylint:
flake8 --ignore E501 python-package
flake8 --ignore E501 tests/python
test: $(ALL_TEST)
$(ALL_TEST)
check: test
./tests/cpp/xgboost_test
ifeq ($(TEST_COVER), 1)
cover: check
@- $(foreach COV_OBJ, $(COVER_OBJ), \
gcov -pbcul -o $(shell dirname $(COV_OBJ)) $(COV_OBJ) > gcov.log || cat gcov.log; \
)
endif
clean:
$(RM) $(OBJ) $(BIN) *~
$(RM) -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o #xgboost
$(RM) -rf build_tests *.gcov tests/cpp/xgboost_test
if [ -d "R-package/src" ]; then \
cd R-package/src; \
$(RM) -rf rabit src include dmlc-core amalgamation *.so *.dll; \
cd $(ROOTDIR); \
fi
clean_all: clean
cd $(DMLC_CORE); "$(MAKE)" clean; cd $(ROOTDIR)
cd $(RABIT); "$(MAKE)" clean; cd $(ROOTDIR)
doxygen:
doxygen doc/Doxyfile
# create standalone python tar file.
pypack: ${XGBOOST_DYLIB}
cp ${XGBOOST_DYLIB} python-package/xgboost
cd python-package; tar cf xgboost.tar xgboost; cd ..
# create pip source dist (sdist) pack for PyPI
pippack: clean_all
rm -rf xgboost-python
# remove symlinked directories in python-package/xgboost
rm -rf python-package/xgboost/lib
rm -rf python-package/xgboost/dmlc-core
rm -rf python-package/xgboost/include
rm -rf python-package/xgboost/make
rm -rf python-package/xgboost/rabit
rm -rf python-package/xgboost/src
cp -r python-package xgboost-python
cp -r Makefile xgboost-python/xgboost/
cp -r make xgboost-python/xgboost/
cp -r src xgboost-python/xgboost/
cp -r tests xgboost-python/xgboost/
cp -r include xgboost-python/xgboost/
cp -r dmlc-core xgboost-python/xgboost/
cp -r rabit xgboost-python/xgboost/
# Use setup_pip.py instead of setup.py
mv xgboost-python/setup_pip.py xgboost-python/setup.py
# Build sdist tarball
cd xgboost-python; python setup.py sdist; mv dist/*.tar.gz ..; cd ..
# Script to make a clean installable R package.
Rpack: clean_all
rm -rf xgboost xgboost*.tar.gz
cp -r R-package xgboost
rm -rf xgboost/src/*.o xgboost/src/*.so xgboost/src/*.dll
rm -rf xgboost/src/*/*.o
rm -rf xgboost/demo/*.model xgboost/demo/*.buffer xgboost/demo/*.txt
rm -rf xgboost/demo/runall.R
cp -r src xgboost/src/src
cp -r include xgboost/src/include
cp -r amalgamation xgboost/src/amalgamation
mkdir -p xgboost/src/rabit
cp -r rabit/include xgboost/src/rabit/include
cp -r rabit/src xgboost/src/rabit/src
rm -rf xgboost/src/rabit/src/*.o
mkdir -p xgboost/src/dmlc-core
cp -r dmlc-core/include xgboost/src/dmlc-core/include
cp -r dmlc-core/src xgboost/src/dmlc-core/src
cp ./LICENSE xgboost
cat R-package/src/Makevars.in|sed '2s/.*/PKGROOT=./' | sed '3s/.*/ENABLE_STD_THREAD=0/' > xgboost/src/Makevars.in
cp xgboost/src/Makevars.in xgboost/src/Makevars.win
sed -i -e 's/@OPENMP_CXXFLAGS@/$$\(SHLIB_OPENMP_CXXFLAGS\)/g' xgboost/src/Makevars.win
sed -i -e 's/-pthread/$$\(SHLIB_PTHREAD_FLAGS\)/g' xgboost/src/Makevars.win
bash R-package/remove_warning_suppression_pragma.sh
rm xgboost/remove_warning_suppression_pragma.sh
Rbuild: Rpack
R CMD build --no-build-vignettes xgboost
rm -rf xgboost
Rcheck: Rbuild
R CMD check xgboost*.tar.gz
-include build/*.d
-include build/*/*.d
-include build_plugin/*/*.d

792
NEWS.md Normal file
View File

@@ -0,0 +1,792 @@
XGBoost Change Log
==================
This file records the changes in xgboost library in reverse chronological order.
## v0.90 (2019.05.18)
### XGBoost Python package drops Python 2.x (#4379, #4381)
Python 2.x is reaching its end-of-life at the end of this year. [Many scientific Python packages are now moving to drop Python 2.x](https://python3statement.org/).
### XGBoost4J-Spark now requires Spark 2.4.x (#4377)
* Spark 2.3 is reaching its end-of-life soon. See discussion at #4389.
* **Consistent handling of missing values** (#4309, #4349, #4411): Many users had reported issue with inconsistent predictions between XGBoost4J-Spark and the Python XGBoost package. The issue was caused by Spark mis-handling non-zero missing values (NaN, -1, 999 etc). We now alert the user whenever Spark doesn't handle missing values correctly (#4309, #4349). See [the tutorial for dealing with missing values in XGBoost4J-Spark](https://xgboost.readthedocs.io/en/release_0.90/jvm/xgboost4j_spark_tutorial.html#dealing-with-missing-values). This fix also depends on the availability of Spark 2.4.x.
### Roadmap: better performance scaling for multi-core CPUs (#4310)
* Poor performance scaling of the `hist` algorithm for multi-core CPUs has been under investigation (#3810). #4310 optimizes quantile sketches and other pre-processing tasks. Special thanks to @SmirnovEgorRu.
### Roadmap: Harden distributed training (#4250)
* Make distributed training in XGBoost more robust by hardening [Rabit](https://github.com/dmlc/rabit), which implements [the AllReduce primitive](https://en.wikipedia.org/wiki/Reduce_%28parallel_pattern%29). In particular, improve test coverage on mechanisms for fault tolerance and recovery. Special thanks to @chenqin.
### New feature: Multi-class metric functions for GPUs (#4368)
* Metrics for multi-class classification have been ported to GPU: `merror`, `mlogloss`. Special thanks to @trivialfis.
* With supported metrics, XGBoost will select the correct devices based on your system and `n_gpus` parameter.
### New feature: Scikit-learn-like random forest API (#4148, #4255, #4258)
* XGBoost Python package now offers `XGBRFClassifier` and `XGBRFRegressor` API to train random forests. See [the tutorial](https://xgboost.readthedocs.io/en/release_0.90/tutorials/rf.html). Special thanks to @canonizer
### New feature: use external memory in GPU predictor (#4284, #4396, #4438, #4457)
* It is now possible to make predictions on GPU when the input is read from external memory. This is useful when you want to make predictions with big dataset that does not fit into the GPU memory. Special thanks to @rongou, @canonizer, @sriramch.
```python
dtest = xgboost.DMatrix('test_data.libsvm#dtest.cache')
bst.set_param('predictor', 'gpu_predictor')
bst.predict(dtest)
```
* Coming soon: GPU training (`gpu_hist`) with external memory
### New feature: XGBoost can now handle comments in LIBSVM files (#4430)
* Special thanks to @trivialfis and @hcho3
### New feature: Embed XGBoost in your C/C++ applications using CMake (#4323, #4333, #4453)
* It is now easier than ever to embed XGBoost in your C/C++ applications. In your CMakeLists.txt, add `xgboost::xgboost` as a linked library:
```cmake
find_package(xgboost REQUIRED)
add_executable(api-demo c-api-demo.c)
target_link_libraries(api-demo xgboost::xgboost)
```
[XGBoost C API documentation is available.](https://xgboost.readthedocs.io/en/release_0.90/dev) Special thanks to @trivialfis
### Performance improvements
* Use feature interaction constraints to narrow split search space (#4341, #4428)
* Additional optimizations for `gpu_hist` (#4248, #4283)
* Reduce OpenMP thread launches in `gpu_hist` (#4343)
* Additional optimizations for multi-node multi-GPU random forests. (#4238)
* Allocate unique prediction buffer for each input matrix, to avoid re-sizing GPU array (#4275)
* Remove various synchronisations from CUDA API calls (#4205)
* XGBoost4J-Spark
- Allow the user to control whether to cache partitioned training data, to potentially reduce execution time (#4268)
### Bug-fixes
* Fix node reuse in `hist` (#4404)
* Fix GPU histogram allocation (#4347)
* Fix matrix attributes not sliced (#4311)
* Revise AUC and AUCPR metrics now work with weighted ranking task (#4216, #4436)
* Fix timer invocation for InitDataOnce() in `gpu_hist` (#4206)
* Fix R-devel errors (#4251)
* Make gradient update in GPU linear updater thread-safe (#4259)
* Prevent out-of-range access in column matrix (#4231)
* Don't store DMatrix handle in Python object until it's initialized, to improve exception safety (#4317)
* XGBoost4J-Spark
- Fix non-deterministic order within a zipped partition on prediction (#4388)
- Remove race condition on tracker shutdown (#4224)
- Allow set the parameter `maxLeaves`. (#4226)
- Allow partial evaluation of dataframe before prediction (#4407)
- Automatically set `maximize_evaluation_metrics` if not explicitly given (#4446)
### API changes
* Deprecate `reg:linear` in favor of `reg:squarederror`. (#4267, #4427)
* Add attribute getter and setter to the Booster object in XGBoost4J (#4336)
### Maintenance: Refactor C++ code for legibility and maintainability
* Fix clang-tidy warnings. (#4149)
* Remove deprecated C APIs. (#4266)
* Use Monitor class to time functions in `hist`. (#4273)
* Retire DVec class in favour of c++20 style span for device memory. (#4293)
* Improve HostDeviceVector exception safety (#4301)
### Maintenance: testing, continuous integration, build system
* **Major refactor of CMakeLists.txt** (#4323, #4333, #4453): adopt modern CMake and export XGBoost as a target
* **Major improvement in Jenkins CI pipeline** (#4234)
- Migrate all Linux tests to Jenkins (#4401)
- Builds and tests are now de-coupled, to test an artifact against multiple versions of CUDA, JDK, and other dependencies (#4401)
- Add Windows GPU to Jenkins CI pipeline (#4463, #4469)
* Support CUDA 10.1 (#4223, #4232, #4265, #4468)
* Python wheels are now built with CUDA 9.0, so that JIT is not required on Volta architecture (#4459)
* Integrate with NVTX CUDA profiler (#4205)
* Add a test for cpu predictor using external memory (#4308)
* Refactor tests to get rid of duplication (#4358)
* Remove test dependency on `craigcitro/r-travis`, since it's deprecated (#4353)
* Add files from local R build to `.gitignore` (#4346)
* Make XGBoost4J compatible with Java 9+ by revising NativeLibLoader (#4351)
* Jenkins build for CUDA 10.0 (#4281)
* Remove remaining `silent` and `debug_verbose` in Python tests (#4299)
* Use all cores to build XGBoost4J lib on linux (#4304)
* Upgrade Jenkins Linux build environment to GCC 5.3.1, CMake 3.6.0 (#4306)
* Make CMakeLists.txt compatible with CMake 3.3 (#4420)
* Add OpenMP option in CMakeLists.txt (#4339)
* Get rid of a few trivial compiler warnings (#4312)
* Add external Docker build cache, to speed up builds on Jenkins CI (#4331, #4334, #4458)
* Fix Windows tests (#4403)
* Fix a broken python test (#4395)
* Use a fixed seed to split data in XGBoost4J-Spark tests, for reproducibility (#4417)
* Add additional Python tests to test training under constraints (#4426)
* Enable building with shared NCCL. (#4447)
### Usability Improvements, Documentation
* Document limitation of one-split-at-a-time Greedy tree learning heuristic (#4233)
* Update build doc: PyPI wheel now support multi-GPU (#4219)
* Fix docs for `num_parallel_tree` (#4221)
* Fix document about `colsample_by*` parameter (#4340)
* Make the train and test input with same colnames. (#4329)
* Update R contribute link. (#4236)
* Fix travis R tests (#4277)
* Log version number in crash log in XGBoost4J-Spark (#4271, #4303)
* Allow supression of Rabit output in Booster::train in XGBoost4J (#4262)
* Add tutorial on handling missing values in XGBoost4J-Spark (#4425)
* Fix typos (#4345, #4393, #4432, #4435)
* Added language classifier in setup.py (#4327)
* Added Travis CI badge (#4344)
* Add BentoML to use case section (#4400)
* Remove subtly sexist remark (#4418)
* Add R vignette about parsing JSON dumps (#4439)
### Acknowledgement
**Contributors**: Nan Zhu (@CodingCat), Adam Pocock (@Craigacp), Daniel Hen (@Daniel8hen), Jiaxiang Li (@JiaxiangBU), Rory Mitchell (@RAMitchell), Egor Smirnov (@SmirnovEgorRu), Andy Adinets (@canonizer), Jonas (@elcombato), Harry Braviner (@harrybraviner), Philip Hyunsu Cho (@hcho3), Tong He (@hetong007), James Lamb (@jameslamb), Jean-Francois Zinque (@jeffzi), Yang Yang (@jokerkeny), Mayank Suman (@mayanksuman), jess (@monkeywithacupcake), Hajime Morrita (@omo), Ravi Kalia (@project-delphi), @ras44, Rong Ou (@rongou), Shaochen Shi (@shishaochen), Xu Xiao (@sperlingxx), @sriramch, Jiaming Yuan (@trivialfis), Christopher Suchanek (@wsuchy), Bozhao (@yubozhao)
**Reviewers**: Nan Zhu (@CodingCat), Adam Pocock (@Craigacp), Daniel Hen (@Daniel8hen), Jiaxiang Li (@JiaxiangBU), Laurae (@Laurae2), Rory Mitchell (@RAMitchell), Egor Smirnov (@SmirnovEgorRu), @alois-bissuel, Andy Adinets (@canonizer), Chen Qin (@chenqin), Harry Braviner (@harrybraviner), Philip Hyunsu Cho (@hcho3), Tong He (@hetong007), @jakirkham, James Lamb (@jameslamb), Julien Schueller (@jschueller), Mayank Suman (@mayanksuman), Hajime Morrita (@omo), Rong Ou (@rongou), Sara Robinson (@sararob), Shaochen Shi (@shishaochen), Xu Xiao (@sperlingxx), @sriramch, Sean Owen (@srowen), Sergei Lebedev (@superbobry), Yuan (Terry) Tang (@terrytangyuan), Theodore Vasiloudis (@thvasilo), Matthew Tovbin (@tovbinm), Jiaming Yuan (@trivialfis), Xin Yin (@xydrolase)
## v0.82 (2019.03.03)
This release is packed with many new features and bug fixes.
### Roadmap: better performance scaling for multi-core CPUs (#3957)
* Poor performance scaling of the `hist` algorithm for multi-core CPUs has been under investigation (#3810). #3957 marks an important step toward better performance scaling, by using software pre-fetching and replacing STL vectors with C-style arrays. Special thanks to @Laurae2 and @SmirnovEgorRu.
* See #3810 for latest progress on this roadmap.
### New feature: Distributed Fast Histogram Algorithm (`hist`) (#4011, #4102, #4140, #4128)
* It is now possible to run the `hist` algorithm in distributed setting. Special thanks to @CodingCat. The benefits include:
1. Faster local computation via feature binning
2. Support for monotonic constraints and feature interaction constraints
3. Simpler codebase than `approx`, allowing for future improvement
* Depth-wise tree growing is now performed in a separate code path, so that cross-node syncronization is performed only once per level.
### New feature: Multi-Node, Multi-GPU training (#4095)
* Distributed training is now able to utilize clusters equipped with NVIDIA GPUs. In particular, the rabit AllReduce layer will communicate GPU device information. Special thanks to @mt-jones, @RAMitchell, @rongou, @trivialfis, @canonizer, and @jeffdk.
* Resource management systems will be able to assign a rank for each GPU in the cluster.
* In Dask, users will be able to construct a collection of XGBoost processes over an inhomogeneous device cluster (i.e. workers with different number and/or kinds of GPUs).
### New feature: Multiple validation datasets in XGBoost4J-Spark (#3904, #3910)
* You can now track the performance of the model during training with multiple evaluation datasets. By specifying `eval_sets` or call `setEvalSets` over a `XGBoostClassifier` or `XGBoostRegressor`, you can pass in multiple evaluation datasets typed as a `Map` from `String` to `DataFrame`. Special thanks to @CodingCat.
* See the usage of multiple validation datasets [here](https://github.com/dmlc/xgboost/blob/0c1d5f1120c0a159f2567b267f0ec4ffadee00d0/jvm-packages/xgboost4j-example/src/main/scala/ml/dmlc/xgboost4j/scala/example/spark/SparkTraining.scala#L66-L78)
### New feature: Additional metric functions for GPUs (#3952)
* Element-wise metrics have been ported to GPU: `rmse`, `mae`, `logloss`, `poisson-nloglik`, `gamma-deviance`, `gamma-nloglik`, `error`, `tweedie-nloglik`. Special thanks to @trivialfis and @RAMitchell.
* With supported metrics, XGBoost will select the correct devices based on your system and `n_gpus` parameter.
### New feature: Column sampling at individual nodes (splits) (#3971)
* Columns (features) can now be sampled at individual tree nodes, in addition to per-tree and per-level sampling. To enable per-node sampling, set `colsample_bynode` parameter, which represents the fraction of columns sampled at each node. This parameter is set to 1.0 by default (i.e. no sampling per node). Special thanks to @canonizer.
* The `colsample_bynode` parameter works cumulatively with other `colsample_by*` parameters: for example, `{'colsample_bynode':0.5, 'colsample_bytree':0.5}` with 100 columns will give 25 features to choose from at each split.
### Major API change: consistent logging level via `verbosity` (#3982, #4002, #4138)
* XGBoost now allows fine-grained control over logging. You can set `verbosity` to 0 (silent), 1 (warning), 2 (info), and 3 (debug). This is useful for controlling the amount of logging outputs. Special thanks to @trivialfis.
* Parameters `silent` and `debug_verbose` are now deprecated.
* Note: Sometimes XGBoost tries to change configurations based on heuristics, which is displayed as warning message. If there's unexpected behaviour, please try to increase value of verbosity.
### Major bug fix: external memory (#4040, #4193)
* Clarify object ownership in multi-threaded prefetcher, to avoid memory error.
* Correctly merge two column batches (which uses [CSC layout](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_(CSC_or_CCS))).
* Add unit tests for external memory.
* Special thanks to @trivialfis and @hcho3.
### Major bug fix: early stopping fixed in XGBoost4J and XGBoost4J-Spark (#3928, #4176)
* Early stopping in XGBoost4J and XGBoost4J-Spark is now consistent with its counterpart in the Python package. Training stops if the current iteration is `earlyStoppingSteps` away from the best iteration. If there are multiple evaluation sets, only the last one is used to determinate early stop.
* See the updated documentation [here](https://xgboost.readthedocs.io/en/release_0.82/jvm/xgboost4j_spark_tutorial.html#early-stopping)
* Special thanks to @CodingCat, @yanboliang, and @mingyang.
### Major bug fix: infrequent features should not crash distributed training (#4045)
* For infrequently occuring features, some partitions may not get any instance. This scenario used to crash distributed training due to mal-formed ranges. The problem has now been fixed.
* In practice, one-hot-encoded categorical variables tend to produce rare features, particularly when the cardinality is high.
* Special thanks to @CodingCat.
### Performance improvements
* Faster, more space-efficient radix sorting in `gpu_hist` (#3895)
* Subtraction trick in histogram calculation in `gpu_hist` (#3945)
* More performant re-partition in XGBoost4J-Spark (#4049)
### Bug-fixes
* Fix semantics of `gpu_id` when running multiple XGBoost processes on a multi-GPU machine (#3851)
* Fix page storage path for external memory on Windows (#3869)
* Fix configuration setup so that DART utilizes GPU (#4024)
* Eliminate NAN values from SHAP prediction (#3943)
* Prevent empty quantile sketches in `hist` (#4155)
* Enable running objectives with 0 GPU (#3878)
* Parameters are no longer dependent on system locale (#3891, #3907)
* Use consistent data type in the GPU coordinate descent code (#3917)
* Remove undefined behavior in the CLI config parser on the ARM platform (#3976)
* Initialize counters in GPU AllReduce (#3987)
* Prevent deadlocks in GPU AllReduce (#4113)
* Load correct values from sliced NumPy arrays (#4147, #4165)
* Fix incorrect GPU device selection (#4161)
* Make feature binning logic in `hist` aware of query groups when running a ranking task (#4115). For ranking task, query groups are weighted, not individual instances.
* Generate correct C++ exception type for `LOG(FATAL)` macro (#4159)
* Python package
- Python package should run on system without `PATH` environment variable (#3845)
- Fix `coef_` and `intercept_` signature to be compatible with `sklearn.RFECV` (#3873)
- Use UTF-8 encoding in Python package README, to support non-English locale (#3867)
- Add AUC-PR to list of metrics to maximize for early stopping (#3936)
- Allow loading pickles without `self.booster` attribute, for backward compatibility (#3938, #3944)
- White-list DART for feature importances (#4073)
- Update usage of [h2oai/datatable](https://github.com/h2oai/datatable) (#4123)
* XGBoost4J-Spark
- Address scalability issue in prediction (#4033)
- Enforce the use of per-group weights for ranking task (#4118)
- Fix vector size of `rawPredictionCol` in `XGBoostClassificationModel` (#3932)
- More robust error handling in Spark tracker (#4046, #4108)
- Fix return type of `setEvalSets` (#4105)
- Return correct value of `getMaxLeaves` (#4114)
### API changes
* Add experimental parameter `single_precision_histogram` to use single-precision histograms for the `gpu_hist` algorithm (#3965)
* Python package
- Add option to select type of feature importances in the scikit-learn inferface (#3876)
- Add `trees_to_df()` method to dump decision trees as Pandas data frame (#4153)
- Add options to control node shapes in the GraphViz plotting function (#3859)
- Add `xgb_model` option to `XGBClassifier`, to load previously saved model (#4092)
- Passing lists into `DMatrix` is now deprecated (#3970)
* XGBoost4J
- Support multiple feature importance features (#3801)
### Maintenance: Refactor C++ code for legibility and maintainability
* Refactor `hist` algorithm code and add unit tests (#3836)
* Minor refactoring of split evaluator in `gpu_hist` (#3889)
* Removed unused leaf vector field in the tree model (#3989)
* Simplify the tree representation by combining `TreeModel` and `RegTree` classes (#3995)
* Simplify and harden tree expansion code (#4008, #4015)
* De-duplicate parameter classes in the linear model algorithms (#4013)
* Robust handling of ranges with C++20 span in `gpu_exact` and `gpu_coord_descent` (#4020, #4029)
* Simplify tree training code (#3825). Also use Span class for robust handling of ranges.
### Maintenance: testing, continuous integration, build system
* Disallow `std::regex` since it's not supported by GCC 4.8.x (#3870)
* Add multi-GPU tests for coordinate descent algorithm for linear models (#3893, #3974)
* Enforce naming style in Python lint (#3896)
* Refactor Python tests (#3897, #3901): Use pytest exclusively, display full trace upon failure
* Address `DeprecationWarning` when using Python collections (#3909)
* Use correct group for maven site plugin (#3937)
* Jenkins CI is now using on-demand EC2 instances exclusively, due to unreliability of Spot instances (#3948)
* Better GPU performance logging (#3945)
* Fix GPU tests on machines with only 1 GPU (#4053)
* Eliminate CRAN check warnings and notes (#3988)
* Add unit tests for tree serialization (#3989)
* Add unit tests for tree fitting functions in `hist` (#4155)
* Add a unit test for `gpu_exact` algorithm (#4020)
* Correct JVM CMake GPU flag (#4071)
* Fix failing Travis CI on Mac (#4086)
* Speed up Jenkins by not compiling CMake (#4099)
* Analyze C++ and CUDA code using clang-tidy, as part of Jenkins CI pipeline (#4034)
* Fix broken R test: Install Homebrew GCC (#4142)
* Check for empty datasets in GPU unit tests (#4151)
* Fix Windows compilation (#4139)
* Comply with latest convention of cpplint (#4157)
* Fix a unit test in `gpu_hist` (#4158)
* Speed up data generation in Python tests (#4164)
### Usability Improvements
* Add link to [InfoWorld 2019 Technology of the Year Award](https://www.infoworld.com/article/3336072/application-development/infoworlds-2019-technology-of-the-year-award-winners.html) (#4116)
* Remove outdated AWS YARN tutorial (#3885)
* Document current limitation in number of features (#3886)
* Remove unnecessary warning when `gblinear` is selected (#3888)
* Document limitation of CSV parser: header not supported (#3934)
* Log training parameters in XGBoost4J-Spark (#4091)
* Clarify early stopping behavior in the scikit-learn interface (#3967)
* Clarify behavior of `max_depth` parameter (#4078)
* Revise Python docstrings for ranking task (#4121). In particular, weights must be per-group in learning-to-rank setting.
* Document parameter `num_parallel_tree` (#4022)
* Add Jenkins status badge (#4090)
* Warn users against using internal functions of `Booster` object (#4066)
* Reformat `benchmark_tree.py` to comply with Python style convention (#4126)
* Clarify a comment in `objectiveTrait` (#4174)
* Fix typos and broken links in documentation (#3890, #3872, #3902, #3919, #3975, #4027, #4156, #4167)
### Acknowledgement
**Contributors** (in no particular order): Jiaming Yuan (@trivialfis), Hyunsu Cho (@hcho3), Nan Zhu (@CodingCat), Rory Mitchell (@RAMitchell), Yanbo Liang (@yanboliang), Andy Adinets (@canonizer), Tong He (@hetong007), Yuan Tang (@terrytangyuan)
**First-time Contributors** (in no particular order): Jelle Zijlstra (@JelleZijlstra), Jiacheng Xu (@jiachengxu), @ajing, Kashif Rasul (@kashif), @theycallhimavi, Joey Gao (@pjgao), Prabakaran Kumaresshan (@nixphix), Huafeng Wang (@huafengw), @lyxthe, Sam Wilkinson (@scwilkinson), Tatsuhito Kato (@stabacov), Shayak Banerjee (@shayakbanerjee), Kodi Arfer (@Kodiologist), @KyleLi1985, Egor Smirnov (@SmirnovEgorRu), @tmitanitky, Pasha Stetsenko (@st-pasha), Kenichi Nagahara (@keni-chi), Abhai Kollara Dilip (@abhaikollara), Patrick Ford (@pford221), @hshujuan, Matthew Jones (@mt-jones), Thejaswi Rao (@teju85), Adam November (@anovember)
**First-time Reviewers** (in no particular order): Mingyang Hu (@mingyang), Theodore Vasiloudis (@thvasilo), Jakub Troszok (@troszok), Rong Ou (@rongou), @Denisevi4, Matthew Jones (@mt-jones), Jeff Kaplan (@jeffdk)
## v0.81 (2018.11.04)
### New feature: feature interaction constraints
* Users are now able to control which features (independent variables) are allowed to interact by specifying feature interaction constraints (#3466).
* [Tutorial](https://xgboost.readthedocs.io/en/release_0.81/tutorials/feature_interaction_constraint.html) is available, as well as [R](https://github.com/dmlc/xgboost/blob/9254c58e4dfff6a59dc0829a2ceb02e45ed17cd0/R-package/demo/interaction_constraints.R) and [Python](https://github.com/dmlc/xgboost/blob/9254c58e4dfff6a59dc0829a2ceb02e45ed17cd0/tests/python/test_interaction_constraints.py) examples.
### New feature: learning to rank using scikit-learn interface
* Learning to rank task is now available for the scikit-learn interface of the Python package (#3560, #3848). It is now possible to integrate the XGBoost ranking model into the scikit-learn learning pipeline.
* Examples of using `XGBRanker` class is found at [demo/rank/rank_sklearn.py](https://github.com/dmlc/xgboost/blob/24a268a2e3cb17302db3d72da8f04016b7d352d9/demo/rank/rank_sklearn.py).
### New feature: R interface for SHAP interactions
* SHAP (SHapley Additive exPlanations) is a unified approach to explain the output of any machine learning model. Previously, this feature was only available from the Python package; now it is available from the R package as well (#3636).
### New feature: GPU predictor now use multiple GPUs to predict
* GPU predictor is now able to utilize multiple GPUs at once to accelerate prediction (#3738)
### New feature: Scale distributed XGBoost to large-scale clusters
* Fix OS file descriptor limit assertion error on large cluster (#3835, dmlc/rabit#73) by replacing `select()` based AllReduce/Broadcast with `poll()` based implementation.
* Mitigate tracker "thundering herd" issue on large cluster. Add exponential backoff retry when workers connect to tracker.
* With this change, we were able to scale to 1.5k executors on a 12 billion row dataset after some tweaks here and there.
### New feature: Additional objective functions for GPUs
* New objective functions ported to GPU: `hinge`, `multi:softmax`, `multi:softprob`, `count:poisson`, `reg:gamma`, `"reg:tweedie`.
* With supported objectives, XGBoost will select the correct devices based on your system and `n_gpus` parameter.
### Major bug fix: learning to rank with XGBoost4J-Spark
* Previously, `repartitionForData` would shuffle data and lose ordering necessary for ranking task.
* To fix this issue, data points within each RDD partition is explicitly group by their group (query session) IDs (#3654). Also handle empty RDD partition carefully (#3750).
### Major bug fix: early stopping fixed in XGBoost4J-Spark
* Earlier implementation of early stopping had incorrect semantics and didn't let users to specify direction for optimizing (maximize / minimize)
* A parameter `maximize_evaluation_metrics` is defined so as to tell whether a metric should be maximized or minimized as part of early stopping criteria (#3808). Also early stopping now has correct semantics.
### API changes
* Column sampling by level (`colsample_bylevel`) is now functional for `hist` algorithm (#3635, #3862)
* GPU tag `gpu:` for regression objectives are now deprecated. XGBoost will select the correct devices automatically (#3643)
* Add `disable_default_eval_metric` parameter to disable default metric (#3606)
* Experimental AVX support for gradient computation is removed (#3752)
* XGBoost4J-Spark
- Add `rank:ndcg` and `rank:map` to supported objectives (#3697)
* Python package
- Add `callbacks` argument to `fit()` function of sciki-learn API (#3682)
- Add `XGBRanker` to scikit-learn interface (#3560, #3848)
- Add `validate_features` argument to `predict()` function of scikit-learn API (#3653)
- Allow scikit-learn grid search over parameters specified as keyword arguments (#3791)
- Add `coef_` and `intercept_` as properties of scikit-learn wrapper (#3855). Some scikit-learn functions expect these properties.
### Performance improvements
* Address very high GPU memory usage for large data (#3635)
* Fix performance regression within `EvaluateSplits()` of `gpu_hist` algorithm. (#3680)
### Bug-fixes
* Fix a problem in GPU quantile sketch with tiny instance weights. (#3628)
* Fix copy constructor for `HostDeviceVectorImpl` to prevent dangling pointers (#3657)
* Fix a bug in partitioned file loading (#3673)
* Fixed an uninitialized pointer in `gpu_hist` (#3703)
* Reshared data among GPUs when number of GPUs is changed (#3721)
* Add back `max_delta_step` to split evaluation (#3668)
* Do not round up integer thresholds for integer features in JSON dump (#3717)
* Use `dmlc::TemporaryDirectory` to handle temporaries in cross-platform way (#3783)
* Fix accuracy problem with `gpu_hist` when `min_child_weight` and `lambda` are set to 0 (#3793)
* Make sure that `tree_method` parameter is recognized and not silently ignored (#3849)
* XGBoost4J-Spark
- Make sure `thresholds` are considered when executing `predict()` method (#3577)
- Avoid losing precision when computing probabilities by converting to `Double` early (#3576)
- `getTreeLimit()` should return `Int` (#3602)
- Fix checkpoint serialization on HDFS (#3614)
- Throw `ControlThrowable` instead of `InterruptedException` so that it is properly re-thrown (#3632)
- Remove extraneous output to stdout (#3665)
- Allow specification of task type for custom objectives and evaluations (#3646)
- Fix distributed updater check (#3739)
- Fix issue when spark job execution thread cannot return before we execute `first()` (#3758)
* Python package
- Fix accessing `DMatrix.handle` before it is set (#3599)
- `XGBClassifier.predict()` should return margin scores when `output_margin` is set to true (#3651)
- Early stopping callback should maximize metric of form `NDCG@n-` (#3685)
- Preserve feature names when slicing `DMatrix` (#3766)
* R package
- Replace `nround` with `nrounds` to match actual parameter (#3592)
- Amend `xgb.createFolds` to handle classes of a single element (#3630)
- Fix buggy random generator and make `colsample_bytree` functional (#3781)
### Maintenance: testing, continuous integration, build system
* Add sanitizers tests to Travis CI (#3557)
* Add NumPy, Matplotlib, Graphviz as requirements for doc build (#3669)
* Comply with CRAN submission policy (#3660, #3728)
* Remove copy-paste error in JVM test suite (#3692)
* Disable flaky tests in `R-package/tests/testthat/test_update.R` (#3723)
* Make Python tests compatible with scikit-learn 0.20 release (#3731)
* Separate out restricted and unrestricted tasks, so that pull requests don't build downloadable artifacts (#3736)
* Add multi-GPU unit test environment (#3741)
* Allow plug-ins to be built by CMake (#3752)
* Test wheel compatibility on CPU containers for pull requests (#3762)
* Fix broken doc build due to Matplotlib 3.0 release (#3764)
* Produce `xgboost.so` for XGBoost-R on Mac OSX, so that `make install` works (#3767)
* Retry Jenkins CI tests up to 3 times to improve reliability (#3769, #3769, #3775, #3776, #3777)
* Add basic unit tests for `gpu_hist` algorithm (#3785)
* Fix Python environment for distributed unit tests (#3806)
* Test wheels on CUDA 10.0 container for compatibility (#3838)
* Fix JVM doc build (#3853)
### Maintenance: Refactor C++ code for legibility and maintainability
* Merge generic device helper functions into `GPUSet` class (#3626)
* Re-factor column sampling logic into `ColumnSampler` class (#3635, #3637)
* Replace `std::vector` with `HostDeviceVector` in `MetaInfo` and `SparsePage` (#3446)
* Simplify `DMatrix` class (#3395)
* De-duplicate CPU/GPU code using `Transform` class (#3643, #3751)
* Remove obsoleted `QuantileHistMaker` class (#3761)
* Remove obsoleted `NoConstraint` class (#3792)
### Other Features
* C++20-compliant Span class for safe pointer indexing (#3548, #3588)
* Add helper functions to manipulate multiple GPU devices (#3693)
* XGBoost4J-Spark
- Allow specifying host ip from the `xgboost-tracker.properties file` (#3833). This comes in handy when `hosts` files doesn't correctly define localhost.
### Usability Improvements
* Add reference to GitHub repository in `pom.xml` of JVM packages (#3589)
* Add R demo of multi-class classification (#3695)
* Document JSON dump functionality (#3600, #3603)
* Document CUDA requirement and lack of external memory for GPU algorithms (#3624)
* Document LambdaMART objectives, both pairwise and listwise (#3672)
* Document `aucpr` evaluation metric (#3687)
* Document gblinear parameters: `feature_selector` and `top_k` (#3780)
* Add instructions for using MinGW-built XGBoost with Python. (#3774)
* Removed nonexistent parameter `use_buffer` from documentation (#3610)
* Update Python API doc to include all classes and members (#3619, #3682)
* Fix typos and broken links in documentation (#3618, #3640, #3676, #3713, #3759, #3784, #3843, #3852)
* Binary classification demo should produce LIBSVM with 0-based indexing (#3652)
* Process data once for Python and CLI examples of learning to rank (#3666)
* Include full text of Apache 2.0 license in the repository (#3698)
* Save predictor parameters in model file (#3856)
* JVM packages
- Let users specify feature names when calling `getModelDump` and `getFeatureScore` (#3733)
- Warn the user about the lack of over-the-wire encryption (#3667)
- Fix errors in examples (#3719)
- Document choice of trackers (#3831)
- Document that vanilla Apache Spark is required (#3854)
* Python package
- Document that custom objective can't contain colon (:) (#3601)
- Show a better error message for failed library loading (#3690)
- Document that feature importance is unavailable for non-tree learners (#3765)
- Document behavior of `get_fscore()` for zero-importance features (#3763)
- Recommend pickling as the way to save `XGBClassifier` / `XGBRegressor` / `XGBRanker` (#3829)
* R package
- Enlarge variable importance plot to make it more visible (#3820)
### BREAKING CHANGES
* External memory page files have changed, breaking backwards compatibility for temporary storage used during external memory training. This only affects external memory users upgrading their xgboost version - we recommend clearing all `*.page` files before resuming training. Model serialization is unaffected.
### Known issues
* Quantile sketcher fails to produce any quantile for some edge cases (#2943)
* The `hist` algorithm leaks memory when used with learning rate decay callback (#3579)
* Using custom evaluation funciton together with early stopping causes assertion failure in XGBoost4J-Spark (#3595)
* Early stopping doesn't work with `gblinear` learner (#3789)
* Label and weight vectors are not reshared upon the change in number of GPUs (#3794). To get around this issue, delete the `DMatrix` object and re-load.
* The `DMatrix` Python objects are initialized with incorrect values when given array slices (#3841)
* The `gpu_id` parameter is broken and not yet properly supported (#3850)
### Acknowledgement
**Contributors** (in no particular order): Hyunsu Cho (@hcho3), Jiaming Yuan (@trivialfis), Nan Zhu (@CodingCat), Rory Mitchell (@RAMitchell), Andy Adinets (@canonizer), Vadim Khotilovich (@khotilov), Sergei Lebedev (@superbobry)
**First-time Contributors** (in no particular order): Matthew Tovbin (@tovbinm), Jakob Richter (@jakob-r), Grace Lam (@grace-lam), Grant W Schneider (@grantschneider), Andrew Thia (@BlueTea88), Sergei Chipiga (@schipiga), Joseph Bradley (@jkbradley), Chen Qin (@chenqin), Jerry Lin (@linjer), Dmitriy Rybalko (@rdtft), Michael Mui (@mmui), Takahiro Kojima (@515hikaru), Bruce Zhao (@BruceZhaoR), Wei Tian (@weitian), Saumya Bhatnagar (@Sam1301), Juzer Shakir (@JuzerShakir), Zhao Hang (@cleghom), Jonathan Friedman (@jontonsoup), Bruno Tremblay (@meztez), Boris Filippov (@frenzykryger), @Shiki-H, @mrgutkun, @gorogm, @htgeis, @jakehoare, @zengxy, @KOLANICH
**First-time Reviewers** (in no particular order): Nikita Titov (@StrikerRUS), Xiangrui Meng (@mengxr), Nirmal Borah (@Nirmal-Neel)
## v0.80 (2018.08.13)
* **JVM packages received a major upgrade**: To consolidate the APIs and improve the user experience, we refactored the design of XGBoost4J-Spark in a significant manner. (#3387)
- Consolidated APIs: It is now much easier to integrate XGBoost models into a Spark ML pipeline. Users can control behaviors like output leaf prediction results by setting corresponding column names. Training is now more consistent with other Estimators in Spark MLLIB: there is now one single method `fit()` to train decision trees.
- Better user experience: we refactored the parameters relevant modules in XGBoost4J-Spark to provide both camel-case (Spark ML style) and underscore (XGBoost style) parameters
- A brand-new tutorial is [available](https://xgboost.readthedocs.io/en/release_0.80/jvm/xgboost4j_spark_tutorial.html) for XGBoost4J-Spark.
- Latest API documentation is now hosted at https://xgboost.readthedocs.io/.
* XGBoost documentation now keeps track of multiple versions:
- Latest master: https://xgboost.readthedocs.io/en/latest
- 0.80 stable: https://xgboost.readthedocs.io/en/release_0.80
- 0.72 stable: https://xgboost.readthedocs.io/en/release_0.72
* Support for per-group weights in ranking objective (#3379)
* Fix inaccurate decimal parsing (#3546)
* New functionality
- Query ID column support in LIBSVM data files (#2749). This is convenient for performing ranking task in distributed setting.
- Hinge loss for binary classification (`binary:hinge`) (#3477)
- Ability to specify delimiter and instance weight column for CSV files (#3546)
- Ability to use 1-based indexing instead of 0-based (#3546)
* GPU support
- Quantile sketch, binning, and index compression are now performed on GPU, eliminating PCIe transfer for 'gpu_hist' algorithm (#3319, #3393)
- Upgrade to NCCL2 for multi-GPU training (#3404).
- Use shared memory atomics for faster training (#3384).
- Dynamically allocate GPU memory, to prevent large allocations for deep trees (#3519)
- Fix memory copy bug for large files (#3472)
* Python package
- Importing data from Python datatable (#3272)
- Pre-built binary wheels available for 64-bit Linux and Windows (#3424, #3443)
- Add new importance measures 'total_gain', 'total_cover' (#3498)
- Sklearn API now supports saving and loading models (#3192)
- Arbitrary cross validation fold indices (#3353)
- `predict()` function in Sklearn API uses `best_ntree_limit` if available, to make early stopping easier to use (#3445)
- Informational messages are now directed to Python's `print()` rather than standard output (#3438). This way, messages appear inside Jupyter notebooks.
* R package
- Oracle Solaris support, per CRAN policy (#3372)
* JVM packages
- Single-instance prediction (#3464)
- Pre-built JARs are now available from Maven Central (#3401)
- Add NULL pointer check (#3021)
- Consider `spark.task.cpus` when controlling parallelism (#3530)
- Handle missing values in prediction (#3529)
- Eliminate outputs of `System.out` (#3572)
* Refactored C++ DMatrix class for simplicity and de-duplication (#3301)
* Refactored C++ histogram facilities (#3564)
* Refactored constraints / regularization mechanism for split finding (#3335, #3429). Users may specify an elastic net (L2 + L1 regularization) on leaf weights as well as monotonic constraints on test nodes. The refactor will be useful for a future addition of feature interaction constraints.
* Statically link `libstdc++` for MinGW32 (#3430)
* Enable loading from `group`, `base_margin` and `weight` (see [here](http://xgboost.readthedocs.io/en/latest/tutorials/input_format.html#auxiliary-files-for-additional-information)) for Python, R, and JVM packages (#3431)
* Fix model saving for `count:possion` so that `max_delta_step` doesn't get truncated (#3515)
* Fix loading of sparse CSC matrix (#3553)
* Fix incorrect handling of `base_score` parameter for Tweedie regression (#3295)
## v0.72.1 (2018.07.08)
This version is only applicable for the Python package. The content is identical to that of v0.72.
## v0.72 (2018.06.01)
* Starting with this release, we plan to make a new release every two months. See #3252 for more details.
* Fix a pathological behavior (near-zero second-order gradients) in multiclass objective (#3304)
* Tree dumps now use high precision in storing floating-point values (#3298)
* Submodules `rabit` and `dmlc-core` have been brought up to date, bringing bug fixes (#3330, #3221).
* GPU support
- Continuous integration tests for GPU code (#3294, #3309)
- GPU accelerated coordinate descent algorithm (#3178)
- Abstract 1D vector class now works with multiple GPUs (#3287)
- Generate PTX code for most recent architecture (#3316)
- Fix a memory bug on NVIDIA K80 cards (#3293)
- Address performance instability for single-GPU, multi-core machines (#3324)
* Python package
- FreeBSD support (#3247)
- Validation of feature names in `Booster.predict()` is now optional (#3323)
* Updated Sklearn API
- Validation sets now support instance weights (#2354)
- `XGBClassifier.predict_proba()` should not support `output_margin` option. (#3343) See BREAKING CHANGES below.
* R package:
- Better handling of NULL in `print.xgb.Booster()` (#3338)
- Comply with CRAN policy by removing compiler warning suppression (#3329)
- Updated CRAN submission
* JVM packages
- JVM packages will now use the same versioning scheme as other packages (#3253)
- Update Spark to 2.3 (#3254)
- Add scripts to cross-build and deploy artifacts (#3276, #3307)
- Fix a compilation error for Scala 2.10 (#3332)
* BREAKING CHANGES
- `XGBClassifier.predict_proba()` no longer accepts paramter `output_margin`. The paramater makes no sense for `predict_proba()` because the method is to predict class probabilities, not raw margin scores.
## v0.71 (2018.04.11)
* This is a minor release, mainly motivated by issues concerning `pip install`, e.g. #2426, #3189, #3118, and #3194.
With this release, users of Linux and MacOS will be able to run `pip install` for the most part.
* Refactored linear booster class (`gblinear`), so as to support multiple coordinate descent updaters (#3103, #3134). See BREAKING CHANGES below.
* Fix slow training for multiclass classification with high number of classes (#3109)
* Fix a corner case in approximate quantile sketch (#3167). Applicable for 'hist' and 'gpu_hist' algorithms
* Fix memory leak in DMatrix (#3182)
* New functionality
- Better linear booster class (#3103, #3134)
- Pairwise SHAP interaction effects (#3043)
- Cox loss (#3043)
- AUC-PR metric for ranking task (#3172)
- Monotonic constraints for 'hist' algorithm (#3085)
* GPU support
- Create an abtract 1D vector class that moves data seamlessly between the main and GPU memory (#2935, #3116, #3068). This eliminates unnecessary PCIe data transfer during training time.
- Fix minor bugs (#3051, #3217)
- Fix compatibility error for CUDA 9.1 (#3218)
* Python package:
- Correctly handle parameter `verbose_eval=0` (#3115)
* R package:
- Eliminate segmentation fault on 32-bit Windows platform (#2994)
* JVM packages
- Fix a memory bug involving double-freeing Booster objects (#3005, #3011)
- Handle empty partition in predict (#3014)
- Update docs and unify terminology (#3024)
- Delete cache files after job finishes (#3022)
- Compatibility fixes for latest Spark versions (#3062, #3093)
* BREAKING CHANGES: Updated linear modelling algorithms. In particular L1/L2 regularisation penalties are now normalised to number of training examples. This makes the implementation consistent with sklearn/glmnet. L2 regularisation has also been removed from the intercept. To produce linear models with the old regularisation behaviour, the alpha/lambda regularisation parameters can be manually scaled by dividing them by the number of training examples.
## v0.7 (2017.12.30)
* **This version represents a major change from the last release (v0.6), which was released one year and half ago.**
* Updated Sklearn API
- Add compatibility layer for scikit-learn v0.18: `sklearn.cross_validation` now deprecated
- Updated to allow use of all XGBoost parameters via `**kwargs`.
- Updated `nthread` to `n_jobs` and `seed` to `random_state` (as per Sklearn convention); `nthread` and `seed` are now marked as deprecated
- Updated to allow choice of Booster (`gbtree`, `gblinear`, or `dart`)
- `XGBRegressor` now supports instance weights (specify `sample_weight` parameter)
- Pass `n_jobs` parameter to the `DMatrix` constructor
- Add `xgb_model` parameter to `fit` method, to allow continuation of training
* Refactored gbm to allow more friendly cache strategy
- Specialized some prediction routine
* Robust `DMatrix` construction from a sparse matrix
* Faster consturction of `DMatrix` from 2D NumPy matrices: elide copies, use of multiple threads
* Automatically remove nan from input data when it is sparse.
- This can solve some of user reported problem of istart != hist.size
* Fix the single-instance prediction function to obtain correct predictions
* Minor fixes
- Thread local variable is upgraded so it is automatically freed at thread exit.
- Fix saving and loading `count::poisson` models
- Fix CalcDCG to use base-2 logarithm
- Messages are now written to stderr instead of stdout
- Keep built-in evaluations while using customized evaluation functions
- Use `bst_float` consistently to minimize type conversion
- Copy the base margin when slicing `DMatrix`
- Evaluation metrics are now saved to the model file
- Use `int32_t` explicitly when serializing version
- In distributed training, synchronize the number of features after loading a data matrix.
* Migrate to C++11
- The current master version now requires C++11 enabled compiled(g++4.8 or higher)
* Predictor interface was factored out (in a manner similar to the updater interface).
* Makefile support for Solaris and ARM
* Test code coverage using Codecov
* Add CPP tests
* Add `Dockerfile` and `Jenkinsfile` to support continuous integration for GPU code
* New functionality
- Ability to adjust tree model's statistics to a new dataset without changing tree structures.
- Ability to extract feature contributions from individual predictions, as described in [here](http://blog.datadive.net/interpreting-random-forests/) and [here](https://arxiv.org/abs/1706.06060).
- Faster, histogram-based tree algorithm (`tree_method='hist'`) .
- GPU/CUDA accelerated tree algorithms (`tree_method='gpu_hist'` or `'gpu_exact'`), including the GPU-based predictor.
- Monotonic constraints: when other features are fixed, force the prediction to be monotonic increasing with respect to a certain specified feature.
- Faster gradient caculation using AVX SIMD
- Ability to export models in JSON format
- Support for Tweedie regression
- Additional dropout options for DART: binomial+1, epsilon
- Ability to update an existing model in-place: this is useful for many applications, such as determining feature importance
* Python package:
- New parameters:
- `learning_rates` in `cv()`
- `shuffle` in `mknfold()`
- `max_features` and `show_values` in `plot_importance()`
- `sample_weight` in `XGBRegressor.fit()`
- Support binary wheel builds
- Fix `MultiIndex` detection to support Pandas 0.21.0 and higher
- Support metrics and evaluation sets whose names contain `-`
- Support feature maps when plotting trees
- Compatibility fix for Python 2.6
- Call `print_evaluation` callback at last iteration
- Use appropriate integer types when calling native code, to prevent truncation and memory error
- Fix shared library loading on Mac OS X
* R package:
- New parameters:
- `silent` in `xgb.DMatrix()`
- `use_int_id` in `xgb.model.dt.tree()`
- `predcontrib` in `predict()`
- `monotone_constraints` in `xgb.train()`
- Default value of the `save_period` parameter in `xgboost()` changed to NULL (consistent with `xgb.train()`).
- It's possible to custom-build the R package with GPU acceleration support.
- Enable JVM build for Mac OS X and Windows
- Integration with AppVeyor CI
- Improved safety for garbage collection
- Store numeric attributes with higher precision
- Easier installation for devel version
- Improved `xgb.plot.tree()`
- Various minor fixes to improve user experience and robustness
- Register native code to pass CRAN check
- Updated CRAN submission
* JVM packages
- Add Spark pipeline persistence API
- Fix data persistence: loss evaluation on test data had wrongly used caches for training data.
- Clean external cache after training
- Implement early stopping
- Enable training of multiple models by distinguishing stage IDs
- Better Spark integration: support RDD / dataframe / dataset, integrate with Spark ML package
- XGBoost4j now supports ranking task
- Support training with missing data
- Refactor JVM package to separate regression and classification models to be consistent with other machine learning libraries
- Support XGBoost4j compilation on Windows
- Parameter tuning tool
- Publish source code for XGBoost4j to maven local repo
- Scala implementation of the Rabit tracker (drop-in replacement for the Java implementation)
- Better exception handling for the Rabit tracker
- Persist `num_class`, number of classes (for classification task)
- `XGBoostModel` now holds `BoosterParams`
- libxgboost4j is now part of CMake build
- Release `DMatrix` when no longer needed, to conserve memory
- Expose `baseMargin`, to allow initialization of boosting with predictions from an external model
- Support instance weights
- Use `SparkParallelismTracker` to prevent jobs from hanging forever
- Expose train-time evaluation metrics via `XGBoostModel.summary`
- Option to specify `host-ip` explicitly in the Rabit tracker
* Documentation
- Better math notation for gradient boosting
- Updated build instructions for Mac OS X
- Template for GitHub issues
- Add `CITATION` file for citing XGBoost in scientific writing
- Fix dropdown menu in xgboost.readthedocs.io
- Document `updater_seq` parameter
- Style fixes for Python documentation
- Links to additional examples and tutorials
- Clarify installation requirements
* Changes that break backward compatibility
- [#1519](https://github.com/dmlc/xgboost/pull/1519) XGBoost-spark no longer contains APIs for DMatrix; use the public booster interface instead.
- [#2476](https://github.com/dmlc/xgboost/pull/2476) `XGBoostModel.predict()` now has a different signature
## v0.6 (2016.07.29)
* Version 0.5 is skipped due to major improvements in the core
* Major refactor of core library.
- Goal: more flexible and modular code as a portable library.
- Switch to use of c++11 standard code.
- Random number generator defaults to ```std::mt19937```.
- Share the data loading pipeline and logging module from dmlc-core.
- Enable registry pattern to allow optionally plugin of objective, metric, tree constructor, data loader.
- Future plugin modules can be put into xgboost/plugin and register back to the library.
- Remove most of the raw pointers to smart ptrs, for RAII safety.
* Add official option to approximate algorithm `tree_method` to parameter.
- Change default behavior to switch to prefer faster algorithm.
- User will get a message when approximate algorithm is chosen.
* Change library name to libxgboost.so
* Backward compatiblity
- The binary buffer file is not backward compatible with previous version.
- The model file is backward compatible on 64 bit platforms.
* The model file is compatible between 64/32 bit platforms(not yet tested).
* External memory version and other advanced features will be exposed to R library as well on linux.
- Previously some of the features are blocked due to C++11 and threading limits.
- The windows version is still blocked due to Rtools do not support ```std::thread```.
* rabit and dmlc-core are maintained through git submodule
- Anyone can open PR to update these dependencies now.
* Improvements
- Rabit and xgboost libs are not thread-safe and use thread local PRNGs
- This could fix some of the previous problem which runs xgboost on multiple threads.
* JVM Package
- Enable xgboost4j for java and scala
- XGBoost distributed now runs on Flink and Spark.
* Support model attributes listing for meta data.
- https://github.com/dmlc/xgboost/pull/1198
- https://github.com/dmlc/xgboost/pull/1166
* Support callback API
- https://github.com/dmlc/xgboost/issues/892
- https://github.com/dmlc/xgboost/pull/1211
- https://github.com/dmlc/xgboost/pull/1264
* Support new booster DART(dropout in tree boosting)
- https://github.com/dmlc/xgboost/pull/1220
* Add CMake build system
- https://github.com/dmlc/xgboost/pull/1314
## v0.47 (2016.01.14)
* Changes in R library
- fixed possible problem of poisson regression.
- switched from 0 to NA for missing values.
- exposed access to additional model parameters.
* Changes in Python library
- throws exception instead of crash terminal when a parameter error happens.
- has importance plot and tree plot functions.
- accepts different learning rates for each boosting round.
- allows model training continuation from previously saved model.
- allows early stopping in CV.
- allows feval to return a list of tuples.
- allows eval_metric to handle additional format.
- improved compatibility in sklearn module.
- additional parameters added for sklearn wrapper.
- added pip installation functionality.
- supports more Pandas DataFrame dtypes.
- added best_ntree_limit attribute, in addition to best_score and best_iteration.
* Java api is ready for use
* Added more test cases and continuous integration to make each build more robust.
## v0.4 (2015.05.11)
* Distributed version of xgboost that runs on YARN, scales to billions of examples
* Direct save/load data and model from/to S3 and HDFS
* Feature importance visualization in R module, by Michael Benesty
* Predict leaf index
* Poisson regression for counts data
* Early stopping option in training
* Native save load support in R and python
- xgboost models now can be saved using save/load in R
- xgboost python model is now pickable
* sklearn wrapper is supported in python module
* Experimental External memory version
## v0.3 (2014.09.07)
* Faster tree construction module
- Allows subsample columns during tree construction via ```bst:col_samplebytree=ratio```
* Support for boosting from initial predictions
* Experimental version of LambdaRank
* Linear booster is now parallelized, using parallel coordinated descent.
* Add [Code Guide](src/README.md) for customizing objective function and evaluation
* Add R module
## v0.2x (2014.05.20)
* Python module
* Weighted samples instances
* Initial version of pairwise rank
## v0.1 (2014.03.26)
* Initial release

6
R-package/.Rbuildignore Normal file
View File

@@ -0,0 +1,6 @@
\.o$
\.so$
\.dll$
^.*\.Rproj$
^\.Rproj\.user$
README.md

34
R-package/CMakeLists.txt Normal file
View File

@@ -0,0 +1,34 @@
find_package(LibR REQUIRED)
message(STATUS "LIBR_CORE_LIBRARY " ${LIBR_CORE_LIBRARY})
file(GLOB_RECURSE R_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/*.cc
${CMAKE_CURRENT_LIST_DIR}/src/*.c)
# Use object library to expose symbols
add_library(xgboost-r OBJECT ${R_SOURCES})
set(R_DEFINITIONS
-DXGBOOST_STRICT_R_MODE=1
-DXGBOOST_CUSTOMIZE_GLOBAL_PRNG=1
-DDMLC_LOG_BEFORE_THROW=0
-DDMLC_DISABLE_STDIN=1
-DDMLC_LOG_CUSTOMIZE=1
-DRABIT_CUSTOMIZE_MSG_
-DRABIT_STRICT_CXX98_)
target_compile_definitions(xgboost-r
PRIVATE ${R_DEFINITIONS})
target_include_directories(xgboost-r
PRIVATE
${LIBR_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/dmlc-core/include
${PROJECT_SOURCE_DIR}/rabit/include)
set_target_properties(
xgboost-r PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
POSITION_INDEPENDENT_CODE ON)
set(XGBOOST_DEFINITIONS ${R_DEFINITIONS} PARENT_SCOPE)
set(XGBOOST_OBJ_SOURCES $<TARGET_OBJECTS:xgboost-r> PARENT_SCOPE)
set(LINKED_LIBRARIES_PRIVATE ${LINKED_LIBRARIES_PRIVATE} ${LIBR_CORE_LIBRARY} PARENT_SCOPE)

67
R-package/DESCRIPTION Normal file
View File

@@ -0,0 +1,67 @@
Package: xgboost
Type: Package
Title: Extreme Gradient Boosting
Version: 0.90.0.1
Date: 2019-05-18
Authors@R: c(
person("Tianqi", "Chen", role = c("aut"),
email = "tianqi.tchen@gmail.com"),
person("Tong", "He", role = c("aut", "cre"),
email = "hetong007@gmail.com"),
person("Michael", "Benesty", role = c("aut"),
email = "michael@benesty.fr"),
person("Vadim", "Khotilovich", role = c("aut"),
email = "khotilovich@gmail.com"),
person("Yuan", "Tang", role = c("aut"),
email = "terrytangyuan@gmail.com",
comment = c(ORCID = "0000-0001-5243-233X")),
person("Hyunsu", "Cho", role = c("aut"),
email = "chohyu01@cs.washington.edu"),
person("Kailong", "Chen", role = c("aut")),
person("Rory", "Mitchell", role = c("aut")),
person("Ignacio", "Cano", role = c("aut")),
person("Tianyi", "Zhou", role = c("aut")),
person("Mu", "Li", role = c("aut")),
person("Junyuan", "Xie", role = c("aut")),
person("Min", "Lin", role = c("aut")),
person("Yifeng", "Geng", role = c("aut")),
person("Yutian", "Li", role = c("aut")),
person("XGBoost contributors", role = c("cph"),
comment = "base XGBoost implementation")
)
Description: Extreme Gradient Boosting, which is an efficient implementation
of the gradient boosting framework from Chen & Guestrin (2016) <doi:10.1145/2939672.2939785>.
This package is its R interface. The package includes efficient linear
model solver and tree learning algorithms. The package can automatically
do parallel computation on a single machine which could be more than 10
times faster than existing gradient boosting packages. It supports
various objective functions, including regression, classification and ranking.
The package is made to be extensible, so that users are also allowed to define
their own objectives easily.
License: Apache License (== 2.0) | file LICENSE
URL: https://github.com/dmlc/xgboost
BugReports: https://github.com/dmlc/xgboost/issues
NeedsCompilation: yes
VignetteBuilder: knitr
Suggests:
knitr,
rmarkdown,
ggplot2 (>= 1.0.1),
DiagrammeR (>= 0.9.0),
Ckmeans.1d.dp (>= 3.3.1),
vcd (>= 1.3),
testthat,
lintr,
igraph (>= 1.0.1),
jsonlite,
float
Depends:
R (>= 3.3.0)
Imports:
Matrix (>= 1.1-0),
methods,
data.table (>= 1.9.6),
magrittr (>= 1.5),
stringi (>= 0.5.2)
RoxygenNote: 6.1.0
SystemRequirements: GNU make, C++11

13
R-package/LICENSE Normal file
View File

@@ -0,0 +1,13 @@
Copyright (c) 2014 by Tianqi Chen and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

86
R-package/NAMESPACE Normal file
View File

@@ -0,0 +1,86 @@
# Generated by roxygen2: do not edit by hand
S3method("[",xgb.DMatrix)
S3method("dimnames<-",xgb.DMatrix)
S3method(dim,xgb.DMatrix)
S3method(dimnames,xgb.DMatrix)
S3method(getinfo,xgb.DMatrix)
S3method(predict,xgb.Booster)
S3method(predict,xgb.Booster.handle)
S3method(print,xgb.Booster)
S3method(print,xgb.DMatrix)
S3method(print,xgb.cv.synchronous)
S3method(setinfo,xgb.DMatrix)
S3method(slice,xgb.DMatrix)
export("xgb.attr<-")
export("xgb.attributes<-")
export("xgb.parameters<-")
export(cb.cv.predict)
export(cb.early.stop)
export(cb.evaluation.log)
export(cb.gblinear.history)
export(cb.print.evaluation)
export(cb.reset.parameters)
export(cb.save.model)
export(getinfo)
export(setinfo)
export(slice)
export(xgb.Booster.complete)
export(xgb.DMatrix)
export(xgb.DMatrix.save)
export(xgb.attr)
export(xgb.attributes)
export(xgb.create.features)
export(xgb.cv)
export(xgb.dump)
export(xgb.gblinear.history)
export(xgb.ggplot.deepness)
export(xgb.ggplot.importance)
export(xgb.importance)
export(xgb.load)
export(xgb.model.dt.tree)
export(xgb.plot.deepness)
export(xgb.plot.importance)
export(xgb.plot.multi.trees)
export(xgb.plot.shap)
export(xgb.plot.tree)
export(xgb.save)
export(xgb.save.raw)
export(xgb.train)
export(xgboost)
import(methods)
importClassesFrom(Matrix,dgCMatrix)
importClassesFrom(Matrix,dgeMatrix)
importFrom(Matrix,colSums)
importFrom(Matrix,sparse.model.matrix)
importFrom(Matrix,sparseMatrix)
importFrom(Matrix,sparseVector)
importFrom(Matrix,t)
importFrom(data.table,":=")
importFrom(data.table,as.data.table)
importFrom(data.table,data.table)
importFrom(data.table,is.data.table)
importFrom(data.table,rbindlist)
importFrom(data.table,setkey)
importFrom(data.table,setkeyv)
importFrom(data.table,setnames)
importFrom(grDevices,rgb)
importFrom(graphics,barplot)
importFrom(graphics,grid)
importFrom(graphics,lines)
importFrom(graphics,par)
importFrom(graphics,points)
importFrom(graphics,title)
importFrom(magrittr,"%>%")
importFrom(stats,median)
importFrom(stats,predict)
importFrom(stringi,stri_detect_regex)
importFrom(stringi,stri_match_first_regex)
importFrom(stringi,stri_replace_all_regex)
importFrom(stringi,stri_replace_first_regex)
importFrom(stringi,stri_split_regex)
importFrom(utils,head)
importFrom(utils,object.size)
importFrom(utils,str)
importFrom(utils,tail)
useDynLib(xgboost, .registration = TRUE)

831
R-package/R/callbacks.R Normal file
View File

@@ -0,0 +1,831 @@
#' Callback closures for booster training.
#'
#' These are used to perform various service tasks either during boosting iterations or at the end.
#' This approach helps to modularize many of such tasks without bloating the main training methods,
#' and it offers .
#'
#' @details
#' By default, a callback function is run after each boosting iteration.
#' An R-attribute \code{is_pre_iteration} could be set for a callback to define a pre-iteration function.
#'
#' When a callback function has \code{finalize} parameter, its finalizer part will also be run after
#' the boosting is completed.
#'
#' WARNING: side-effects!!! Be aware that these callback functions access and modify things in
#' the environment from which they are called from, which is a fairly uncommon thing to do in R.
#'
#' To write a custom callback closure, make sure you first understand the main concepts about R environments.
#' Check either R documentation on \code{\link[base]{environment}} or the
#' \href{http://adv-r.had.co.nz/Environments.html}{Environments chapter} from the "Advanced R"
#' book by Hadley Wickham. Further, the best option is to read the code of some of the existing callbacks -
#' choose ones that do something similar to what you want to achieve. Also, you would need to get familiar
#' with the objects available inside of the \code{xgb.train} and \code{xgb.cv} internal environments.
#'
#' @seealso
#' \code{\link{cb.print.evaluation}},
#' \code{\link{cb.evaluation.log}},
#' \code{\link{cb.reset.parameters}},
#' \code{\link{cb.early.stop}},
#' \code{\link{cb.save.model}},
#' \code{\link{cb.cv.predict}},
#' \code{\link{xgb.train}},
#' \code{\link{xgb.cv}}
#'
#' @name callbacks
NULL
#
# Callbacks -------------------------------------------------------------------
#
#' Callback closure for printing the result of evaluation
#'
#' @param period results would be printed every number of periods
#' @param showsd whether standard deviations should be printed (when available)
#'
#' @details
#' The callback function prints the result of evaluation at every \code{period} iterations.
#' The initial and the last iteration's evaluations are always printed.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{bst_evaluation} (also \code{bst_evaluation_err} when available),
#' \code{iteration},
#' \code{begin_iteration},
#' \code{end_iteration}.
#'
#' @seealso
#' \code{\link{callbacks}}
#'
#' @export
cb.print.evaluation <- function(period = 1, showsd = TRUE) {
callback <- function(env = parent.frame()) {
if (length(env$bst_evaluation) == 0 ||
period == 0 ||
NVL(env$rank, 0) != 0 )
return()
i <- env$iteration
if ((i-1) %% period == 0 ||
i == env$begin_iteration ||
i == env$end_iteration) {
stdev <- if (showsd) env$bst_evaluation_err else NULL
msg <- format.eval.string(i, env$bst_evaluation, stdev)
cat(msg, '\n')
}
}
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.print.evaluation'
callback
}
#' Callback closure for logging the evaluation history
#'
#' @details
#' This callback function appends the current iteration evaluation results \code{bst_evaluation}
#' available in the calling parent frame to the \code{evaluation_log} list in a calling frame.
#'
#' The finalizer callback (called with \code{finalize = TURE} in the end) converts
#' the \code{evaluation_log} list into a final data.table.
#'
#' The iteration evaluation result \code{bst_evaluation} must be a named numeric vector.
#'
#' Note: in the column names of the final data.table, the dash '-' character is replaced with
#' the underscore '_' in order to make the column names more like regular R identifiers.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{evaluation_log},
#' \code{bst_evaluation},
#' \code{iteration}.
#'
#' @seealso
#' \code{\link{callbacks}}
#'
#' @export
cb.evaluation.log <- function() {
mnames <- NULL
init <- function(env) {
if (!is.list(env$evaluation_log))
stop("'evaluation_log' has to be a list")
mnames <<- names(env$bst_evaluation)
if (is.null(mnames) || any(mnames == ""))
stop("bst_evaluation must have non-empty names")
mnames <<- gsub('-', '_', names(env$bst_evaluation))
if(!is.null(env$bst_evaluation_err))
mnames <<- c(paste0(mnames, '_mean'), paste0(mnames, '_std'))
}
finalizer <- function(env) {
env$evaluation_log <- as.data.table(t(simplify2array(env$evaluation_log)))
setnames(env$evaluation_log, c('iter', mnames))
if(!is.null(env$bst_evaluation_err)) {
# rearrange col order from _mean,_mean,...,_std,_std,...
# to be _mean,_std,_mean,_std,...
len <- length(mnames)
means <- mnames[seq_len(len/2)]
stds <- mnames[(len/2 + 1):len]
cnames <- numeric(len)
cnames[c(TRUE, FALSE)] <- means
cnames[c(FALSE, TRUE)] <- stds
env$evaluation_log <- env$evaluation_log[, c('iter', cnames), with = FALSE]
}
}
callback <- function(env = parent.frame(), finalize = FALSE) {
if (is.null(mnames))
init(env)
if (finalize)
return(finalizer(env))
ev <- env$bst_evaluation
if(!is.null(env$bst_evaluation_err))
ev <- c(ev, env$bst_evaluation_err)
env$evaluation_log <- c(env$evaluation_log,
list(c(iter = env$iteration, ev)))
}
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.evaluation.log'
callback
}
#' Callback closure for resetting the booster's parameters at each iteration.
#'
#' @param new_params a list where each element corresponds to a parameter that needs to be reset.
#' Each element's value must be either a vector of values of length \code{nrounds}
#' to be set at each iteration,
#' or a function of two parameters \code{learning_rates(iteration, nrounds)}
#' which returns a new parameter value by using the current iteration number
#' and the total number of boosting rounds.
#'
#' @details
#' This is a "pre-iteration" callback function used to reset booster's parameters
#' at the beginning of each iteration.
#'
#' Note that when training is resumed from some previous model, and a function is used to
#' reset a parameter value, the \code{nrounds} argument in this function would be the
#' the number of boosting rounds in the current training.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{bst} or \code{bst_folds},
#' \code{iteration},
#' \code{begin_iteration},
#' \code{end_iteration}.
#'
#' @seealso
#' \code{\link{callbacks}}
#'
#' @export
cb.reset.parameters <- function(new_params) {
if (typeof(new_params) != "list")
stop("'new_params' must be a list")
pnames <- gsub("\\.", "_", names(new_params))
nrounds <- NULL
# run some checks in the begining
init <- function(env) {
nrounds <<- env$end_iteration - env$begin_iteration + 1
if (is.null(env$bst) && is.null(env$bst_folds))
stop("Parent frame has neither 'bst' nor 'bst_folds'")
# Some parameters are not allowed to be changed,
# since changing them would simply wreck some chaos
not_allowed <- pnames %in%
c('num_class', 'num_output_group', 'size_leaf_vector', 'updater_seq')
if (any(not_allowed))
stop('Parameters ', paste(pnames[not_allowed]), " cannot be changed during boosting.")
for (n in pnames) {
p <- new_params[[n]]
if (is.function(p)) {
if (length(formals(p)) != 2)
stop("Parameter '", n, "' is a function but not of two arguments")
} else if (is.numeric(p) || is.character(p)) {
if (length(p) != nrounds)
stop("Length of '", n, "' has to be equal to 'nrounds'")
} else {
stop("Parameter '", n, "' is not a function or a vector")
}
}
}
callback <- function(env = parent.frame()) {
if (is.null(nrounds))
init(env)
i <- env$iteration
pars <- lapply(new_params, function(p) {
if (is.function(p))
return(p(i, nrounds))
p[i]
})
if (!is.null(env$bst)) {
xgb.parameters(env$bst$handle) <- pars
} else {
for (fd in env$bst_folds)
xgb.parameters(fd$bst) <- pars
}
}
attr(callback, 'is_pre_iteration') <- TRUE
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.reset.parameters'
callback
}
#' Callback closure to activate the early stopping.
#'
#' @param stopping_rounds The number of rounds with no improvement in
#' the evaluation metric in order to stop the training.
#' @param maximize whether to maximize the evaluation metric
#' @param metric_name the name of an evaluation column to use as a criteria for early
#' stopping. If not set, the last column would be used.
#' Let's say the test data in \code{watchlist} was labelled as \code{dtest},
#' and one wants to use the AUC in test data for early stopping regardless of where
#' it is in the \code{watchlist}, then one of the following would need to be set:
#' \code{metric_name='dtest-auc'} or \code{metric_name='dtest_auc'}.
#' All dash '-' characters in metric names are considered equivalent to '_'.
#' @param verbose whether to print the early stopping information.
#'
#' @details
#' This callback function determines the condition for early stopping
#' by setting the \code{stop_condition = TRUE} flag in its calling frame.
#'
#' The following additional fields are assigned to the model's R object:
#' \itemize{
#' \item \code{best_score} the evaluation score at the best iteration
#' \item \code{best_iteration} at which boosting iteration the best score has occurred (1-based index)
#' \item \code{best_ntreelimit} to use with the \code{ntreelimit} parameter in \code{predict}.
#' It differs from \code{best_iteration} in multiclass or random forest settings.
#' }
#'
#' The Same values are also stored as xgb-attributes:
#' \itemize{
#' \item \code{best_iteration} is stored as a 0-based iteration index (for interoperability of binary models)
#' \item \code{best_msg} message string is also stored.
#' }
#'
#' At least one data element is required in the evaluation watchlist for early stopping to work.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{stop_condition},
#' \code{bst_evaluation},
#' \code{rank},
#' \code{bst} (or \code{bst_folds} and \code{basket}),
#' \code{iteration},
#' \code{begin_iteration},
#' \code{end_iteration},
#' \code{num_parallel_tree}.
#'
#' @seealso
#' \code{\link{callbacks}},
#' \code{\link{xgb.attr}}
#'
#' @export
cb.early.stop <- function(stopping_rounds, maximize = FALSE,
metric_name = NULL, verbose = TRUE) {
# state variables
best_iteration <- -1
best_ntreelimit <- -1
best_score <- Inf
best_msg <- NULL
metric_idx <- 1
init <- function(env) {
if (length(env$bst_evaluation) == 0)
stop("For early stopping, watchlist must have at least one element")
eval_names <- gsub('-', '_', names(env$bst_evaluation))
if (!is.null(metric_name)) {
metric_idx <<- which(gsub('-', '_', metric_name) == eval_names)
if (length(metric_idx) == 0)
stop("'metric_name' for early stopping is not one of the following:\n",
paste(eval_names, collapse = ' '), '\n')
}
if (is.null(metric_name) &&
length(env$bst_evaluation) > 1) {
metric_idx <<- length(eval_names)
if (verbose)
cat('Multiple eval metrics are present. Will use ',
eval_names[metric_idx], ' for early stopping.\n', sep = '')
}
metric_name <<- eval_names[metric_idx]
# maximize is usually NULL when not set in xgb.train and built-in metrics
if (is.null(maximize))
maximize <<- grepl('(_auc|_map|_ndcg)', metric_name)
if (verbose && NVL(env$rank, 0) == 0)
cat("Will train until ", metric_name, " hasn't improved in ",
stopping_rounds, " rounds.\n\n", sep = '')
best_iteration <<- 1
if (maximize) best_score <<- -Inf
env$stop_condition <- FALSE
if (!is.null(env$bst)) {
if (!inherits(env$bst, 'xgb.Booster'))
stop("'bst' in the parent frame must be an 'xgb.Booster'")
if (!is.null(best_score <- xgb.attr(env$bst$handle, 'best_score'))) {
best_score <<- as.numeric(best_score)
best_iteration <<- as.numeric(xgb.attr(env$bst$handle, 'best_iteration')) + 1
best_msg <<- as.numeric(xgb.attr(env$bst$handle, 'best_msg'))
} else {
xgb.attributes(env$bst$handle) <- list(best_iteration = best_iteration - 1,
best_score = best_score)
}
} else if (is.null(env$bst_folds) || is.null(env$basket)) {
stop("Parent frame has neither 'bst' nor ('bst_folds' and 'basket')")
}
}
finalizer <- function(env) {
if (!is.null(env$bst)) {
attr_best_score = as.numeric(xgb.attr(env$bst$handle, 'best_score'))
if (best_score != attr_best_score)
stop("Inconsistent 'best_score' values between the closure state: ", best_score,
" and the xgb.attr: ", attr_best_score)
env$bst$best_iteration = best_iteration
env$bst$best_ntreelimit = best_ntreelimit
env$bst$best_score = best_score
} else {
env$basket$best_iteration <- best_iteration
env$basket$best_ntreelimit <- best_ntreelimit
}
}
callback <- function(env = parent.frame(), finalize = FALSE) {
if (best_iteration < 0)
init(env)
if (finalize)
return(finalizer(env))
i <- env$iteration
score = env$bst_evaluation[metric_idx]
if (( maximize && score > best_score) ||
(!maximize && score < best_score)) {
best_msg <<- format.eval.string(i, env$bst_evaluation, env$bst_evaluation_err)
best_score <<- score
best_iteration <<- i
best_ntreelimit <<- best_iteration * env$num_parallel_tree
# save the property to attributes, so they will occur in checkpoint
if (!is.null(env$bst)) {
xgb.attributes(env$bst) <- list(
best_iteration = best_iteration - 1, # convert to 0-based index
best_score = best_score,
best_msg = best_msg,
best_ntreelimit = best_ntreelimit)
}
} else if (i - best_iteration >= stopping_rounds) {
env$stop_condition <- TRUE
env$end_iteration <- i
if (verbose && NVL(env$rank, 0) == 0)
cat("Stopping. Best iteration:\n", best_msg, "\n\n", sep = '')
}
}
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.early.stop'
callback
}
#' Callback closure for saving a model file.
#'
#' @param save_period save the model to disk after every
#' \code{save_period} iterations; 0 means save the model at the end.
#' @param save_name the name or path for the saved model file.
#' It can contain a \code{\link[base]{sprintf}} formatting specifier
#' to include the integer iteration number in the file name.
#' E.g., with \code{save_name} = 'xgboost_%04d.model',
#' the file saved at iteration 50 would be named "xgboost_0050.model".
#'
#' @details
#' This callback function allows to save an xgb-model file, either periodically after each \code{save_period}'s or at the end.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{bst},
#' \code{iteration},
#' \code{begin_iteration},
#' \code{end_iteration}.
#'
#' @seealso
#' \code{\link{callbacks}}
#'
#' @export
cb.save.model <- function(save_period = 0, save_name = "xgboost.model") {
if (save_period < 0)
stop("'save_period' cannot be negative")
callback <- function(env = parent.frame()) {
if (is.null(env$bst))
stop("'save_model' callback requires the 'bst' booster object in its calling frame")
if ((save_period > 0 && (env$iteration - env$begin_iteration) %% save_period == 0) ||
(save_period == 0 && env$iteration == env$end_iteration))
xgb.save(env$bst, sprintf(save_name, env$iteration))
}
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.save.model'
callback
}
#' Callback closure for returning cross-validation based predictions.
#'
#' @param save_models a flag for whether to save the folds' models.
#'
#' @details
#' This callback function saves predictions for all of the test folds,
#' and also allows to save the folds' models.
#'
#' It is a "finalizer" callback and it uses early stopping information whenever it is available,
#' thus it must be run after the early stopping callback if the early stopping is used.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{bst_folds},
#' \code{basket},
#' \code{data},
#' \code{end_iteration},
#' \code{params},
#' \code{num_parallel_tree},
#' \code{num_class}.
#'
#' @return
#' Predictions are returned inside of the \code{pred} element, which is either a vector or a matrix,
#' depending on the number of prediction outputs per data row. The order of predictions corresponds
#' to the order of rows in the original dataset. Note that when a custom \code{folds} list is
#' provided in \code{xgb.cv}, the predictions would only be returned properly when this list is a
#' non-overlapping list of k sets of indices, as in a standard k-fold CV. The predictions would not be
#' meaningful when user-provided folds have overlapping indices as in, e.g., random sampling splits.
#' When some of the indices in the training dataset are not included into user-provided \code{folds},
#' their prediction value would be \code{NA}.
#'
#' @seealso
#' \code{\link{callbacks}}
#'
#' @export
cb.cv.predict <- function(save_models = FALSE) {
finalizer <- function(env) {
if (is.null(env$basket) || is.null(env$bst_folds))
stop("'cb.cv.predict' callback requires 'basket' and 'bst_folds' lists in its calling frame")
N <- nrow(env$data)
pred <-
if (env$num_class > 1) {
matrix(NA_real_, N, env$num_class)
} else {
rep(NA_real_, N)
}
ntreelimit <- NVL(env$basket$best_ntreelimit,
env$end_iteration * env$num_parallel_tree)
if (NVL(env$params[['booster']], '') == 'gblinear') {
ntreelimit <- 0 # must be 0 for gblinear
}
for (fd in env$bst_folds) {
pr <- predict(fd$bst, fd$watchlist[[2]], ntreelimit = ntreelimit, reshape = TRUE)
if (is.matrix(pred)) {
pred[fd$index,] <- pr
} else {
pred[fd$index] <- pr
}
}
env$basket$pred <- pred
if (save_models) {
env$basket$models <- lapply(env$bst_folds, function(fd) {
xgb.attr(fd$bst, 'niter') <- env$end_iteration - 1
xgb.Booster.complete(xgb.handleToBooster(fd$bst), saveraw = TRUE)
})
}
}
callback <- function(env = parent.frame(), finalize = FALSE) {
if (finalize)
return(finalizer(env))
}
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.cv.predict'
callback
}
#' Callback closure for collecting the model coefficients history of a gblinear booster
#' during its training.
#'
#' @param sparse when set to FALSE/TURE, a dense/sparse matrix is used to store the result.
#' Sparse format is useful when one expects only a subset of coefficients to be non-zero,
#' when using the "thrifty" feature selector with fairly small number of top features
#' selected per iteration.
#'
#' @details
#' To keep things fast and simple, gblinear booster does not internally store the history of linear
#' model coefficients at each boosting iteration. This callback provides a workaround for storing
#' the coefficients' path, by extracting them after each training iteration.
#'
#' Callback function expects the following values to be set in its calling frame:
#' \code{bst} (or \code{bst_folds}).
#'
#' @return
#' Results are stored in the \code{coefs} element of the closure.
#' The \code{\link{xgb.gblinear.history}} convenience function provides an easy way to access it.
#' With \code{xgb.train}, it is either a dense of a sparse matrix.
#' While with \code{xgb.cv}, it is a list (an element per each fold) of such matrices.
#'
#' @seealso
#' \code{\link{callbacks}}, \code{\link{xgb.gblinear.history}}.
#'
#' @examples
#' #### Binary classification:
#' #
#' # In the iris dataset, it is hard to linearly separate Versicolor class from the rest
#' # without considering the 2nd order interactions:
#' require(magrittr)
#' x <- model.matrix(Species ~ .^2, iris)[,-1]
#' colnames(x)
#' dtrain <- xgb.DMatrix(scale(x), label = 1*(iris$Species == "versicolor"))
#' param <- list(booster = "gblinear", objective = "reg:logistic", eval_metric = "auc",
#' lambda = 0.0003, alpha = 0.0003, nthread = 2)
#' # For 'shotgun', which is a default linear updater, using high eta values may result in
#' # unstable behaviour in some datasets. With this simple dataset, however, the high learning
#' # rate does not break the convergence, but allows us to illustrate the typical pattern of
#' # "stochastic explosion" behaviour of this lock-free algorithm at early boosting iterations.
#' bst <- xgb.train(param, dtrain, list(tr=dtrain), nrounds = 200, eta = 1.,
#' callbacks = list(cb.gblinear.history()))
#' # Extract the coefficients' path and plot them vs boosting iteration number:
#' coef_path <- xgb.gblinear.history(bst)
#' matplot(coef_path, type = 'l')
#'
#' # With the deterministic coordinate descent updater, it is safer to use higher learning rates.
#' # Will try the classical componentwise boosting which selects a single best feature per round:
#' bst <- xgb.train(param, dtrain, list(tr=dtrain), nrounds = 200, eta = 0.8,
#' updater = 'coord_descent', feature_selector = 'thrifty', top_k = 1,
#' callbacks = list(cb.gblinear.history()))
#' xgb.gblinear.history(bst) %>% matplot(type = 'l')
#' # Componentwise boosting is known to have similar effect to Lasso regularization.
#' # Try experimenting with various values of top_k, eta, nrounds,
#' # as well as different feature_selectors.
#'
#' # For xgb.cv:
#' bst <- xgb.cv(param, dtrain, nfold = 5, nrounds = 100, eta = 0.8,
#' callbacks = list(cb.gblinear.history()))
#' # coefficients in the CV fold #3
#' xgb.gblinear.history(bst)[[3]] %>% matplot(type = 'l')
#'
#'
#' #### Multiclass classification:
#' #
#' dtrain <- xgb.DMatrix(scale(x), label = as.numeric(iris$Species) - 1)
#' param <- list(booster = "gblinear", objective = "multi:softprob", num_class = 3,
#' lambda = 0.0003, alpha = 0.0003, nthread = 2)
#' # For the default linear updater 'shotgun' it sometimes is helpful
#' # to use smaller eta to reduce instability
#' bst <- xgb.train(param, dtrain, list(tr=dtrain), nrounds = 70, eta = 0.5,
#' callbacks = list(cb.gblinear.history()))
#' # Will plot the coefficient paths separately for each class:
#' xgb.gblinear.history(bst, class_index = 0) %>% matplot(type = 'l')
#' xgb.gblinear.history(bst, class_index = 1) %>% matplot(type = 'l')
#' xgb.gblinear.history(bst, class_index = 2) %>% matplot(type = 'l')
#'
#' # CV:
#' bst <- xgb.cv(param, dtrain, nfold = 5, nrounds = 70, eta = 0.5,
#' callbacks = list(cb.gblinear.history(FALSE)))
#' # 1st forld of 1st class
#' xgb.gblinear.history(bst, class_index = 0)[[1]] %>% matplot(type = 'l')
#'
#' @export
cb.gblinear.history <- function(sparse=FALSE) {
coefs <- NULL
init <- function(env) {
if (!is.null(env$bst)) { # xgb.train:
coef_path <- list()
} else if (!is.null(env$bst_folds)) { # xgb.cv:
coef_path <- rep(list(), length(env$bst_folds))
} else stop("Parent frame has neither 'bst' nor 'bst_folds'")
}
# convert from list to (sparse) matrix
list2mat <- function(coef_list) {
if (sparse) {
coef_mat <- sparseMatrix(x = unlist(lapply(coef_list, slot, "x")),
i = unlist(lapply(coef_list, slot, "i")),
p = c(0, cumsum(sapply(coef_list, function(x) length(x@x)))),
dims = c(length(coef_list[[1]]), length(coef_list)))
return(t(coef_mat))
} else {
return(do.call(rbind, coef_list))
}
}
finalizer <- function(env) {
if (length(coefs) == 0)
return()
if (!is.null(env$bst)) { # # xgb.train:
coefs <<- list2mat(coefs)
} else { # xgb.cv:
# first lapply transposes the list
coefs <<- lapply(seq_along(coefs[[1]]), function(i) lapply(coefs, "[[", i)) %>%
lapply(function(x) list2mat(x))
}
}
extract.coef <- function(env) {
if (!is.null(env$bst)) { # # xgb.train:
cf <- as.numeric(grep('(booster|bias|weigh)', xgb.dump(env$bst), invert = TRUE, value = TRUE))
if (sparse) cf <- as(cf, "sparseVector")
} else { # xgb.cv:
cf <- vector("list", length(env$bst_folds))
for (i in seq_along(env$bst_folds)) {
dmp <- xgb.dump(xgb.handleToBooster(env$bst_folds[[i]]$bst))
cf[[i]] <- as.numeric(grep('(booster|bias|weigh)', dmp, invert = TRUE, value = TRUE))
if (sparse) cf[[i]] <- as(cf[[i]], "sparseVector")
}
}
cf
}
callback <- function(env = parent.frame(), finalize = FALSE) {
if (is.null(coefs)) init(env)
if (finalize) return(finalizer(env))
cf <- extract.coef(env)
coefs <<- c(coefs, list(cf))
}
attr(callback, 'call') <- match.call()
attr(callback, 'name') <- 'cb.gblinear.history'
callback
}
#' Extract gblinear coefficients history.
#'
#' A helper function to extract the matrix of linear coefficients' history
#' from a gblinear model created while using the \code{cb.gblinear.history()}
#' callback.
#'
#' @param model either an \code{xgb.Booster} or a result of \code{xgb.cv()}, trained
#' using the \code{cb.gblinear.history()} callback.
#' @param class_index zero-based class index to extract the coefficients for only that
#' specific class in a multinomial multiclass model. When it is NULL, all the
#' coefficients are returned. Has no effect in non-multiclass models.
#'
#' @return
#' For an \code{xgb.train} result, a matrix (either dense or sparse) with the columns
#' corresponding to iteration's coefficients (in the order as \code{xgb.dump()} would
#' return) and the rows corresponding to boosting iterations.
#'
#' For an \code{xgb.cv} result, a list of such matrices is returned with the elements
#' corresponding to CV folds.
#'
#' @export
xgb.gblinear.history <- function(model, class_index = NULL) {
if (!(inherits(model, "xgb.Booster") ||
inherits(model, "xgb.cv.synchronous")))
stop("model must be an object of either xgb.Booster or xgb.cv.synchronous class")
is_cv <- inherits(model, "xgb.cv.synchronous")
if (is.null(model[["callbacks"]]) || is.null(model$callbacks[["cb.gblinear.history"]]))
stop("model must be trained while using the cb.gblinear.history() callback")
if (!is_cv) {
# extract num_class & num_feat from the internal model
dmp <- xgb.dump(model)
if(length(dmp) < 2 || dmp[2] != "bias:")
stop("It does not appear to be a gblinear model")
dmp <- dmp[-c(1,2)]
n <- which(dmp == 'weight:')
if(length(n) != 1)
stop("It does not appear to be a gblinear model")
num_class <- n - 1
num_feat <- (length(dmp) - 4) / num_class
} else {
# in case of CV, the object is expected to have this info
if (model$params$booster != "gblinear")
stop("It does not appear to be a gblinear model")
num_class <- NVL(model$params$num_class, 1)
num_feat <- model$nfeatures
if (is.null(num_feat))
stop("This xgb.cv result does not have nfeatures info")
}
if (!is.null(class_index) &&
num_class > 1 &&
(class_index[1] < 0 || class_index[1] >= num_class))
stop("class_index has to be within [0,", num_class - 1, "]")
coef_path <- environment(model$callbacks$cb.gblinear.history)[["coefs"]]
if (!is.null(class_index) && num_class > 1) {
coef_path <- if (is.list(coef_path)) {
lapply(coef_path,
function(x) x[, seq(1 + class_index, by=num_class, length.out=num_feat)])
} else {
coef_path <- coef_path[, seq(1 + class_index, by=num_class, length.out=num_feat)]
}
}
coef_path
}
#
# Internal utility functions for callbacks ------------------------------------
#
# Format the evaluation metric string
format.eval.string <- function(iter, eval_res, eval_err = NULL) {
if (length(eval_res) == 0)
stop('no evaluation results')
enames <- names(eval_res)
if (is.null(enames))
stop('evaluation results must have names')
iter <- sprintf('[%d]\t', iter)
if (!is.null(eval_err)) {
if (length(eval_res) != length(eval_err))
stop('eval_res & eval_err lengths mismatch')
res <- paste0(sprintf("%s:%f+%f", enames, eval_res, eval_err), collapse = '\t')
} else {
res <- paste0(sprintf("%s:%f", enames, eval_res), collapse = '\t')
}
return(paste0(iter, res))
}
# Extract callback names from the list of callbacks
callback.names <- function(cb_list) {
unlist(lapply(cb_list, function(x) attr(x, 'name')))
}
# Extract callback calls from the list of callbacks
callback.calls <- function(cb_list) {
unlist(lapply(cb_list, function(x) attr(x, 'call')))
}
# Add a callback cb to the list and make sure that
# cb.early.stop and cb.cv.predict are at the end of the list
# with cb.cv.predict being the last (when present)
add.cb <- function(cb_list, cb) {
cb_list <- c(cb_list, cb)
names(cb_list) <- callback.names(cb_list)
if ('cb.early.stop' %in% names(cb_list)) {
cb_list <- c(cb_list, cb_list['cb.early.stop'])
# this removes only the first one
cb_list['cb.early.stop'] <- NULL
}
if ('cb.cv.predict' %in% names(cb_list)) {
cb_list <- c(cb_list, cb_list['cb.cv.predict'])
cb_list['cb.cv.predict'] <- NULL
}
cb_list
}
# Sort callbacks list into categories
categorize.callbacks <- function(cb_list) {
list(
pre_iter = Filter(function(x) {
pre <- attr(x, 'is_pre_iteration')
!is.null(pre) && pre
}, cb_list),
post_iter = Filter(function(x) {
pre <- attr(x, 'is_pre_iteration')
is.null(pre) || !pre
}, cb_list),
finalize = Filter(function(x) {
'finalize' %in% names(formals(x))
}, cb_list)
)
}
# Check whether all callback functions with names given by 'query_names' are present in the 'cb_list'.
has.callbacks <- function(cb_list, query_names) {
if (length(cb_list) < length(query_names))
return(FALSE)
if (!is.list(cb_list) ||
any(sapply(cb_list, class) != 'function')) {
stop('`cb_list` must be a list of callback functions')
}
cb_names <- callback.names(cb_list)
if (!is.character(cb_names) ||
length(cb_names) != length(cb_list) ||
any(cb_names == "")) {
stop('All callbacks in the `cb_list` must have a non-empty `name` attribute')
}
if (!is.character(query_names) ||
length(query_names) == 0 ||
any(query_names == "")) {
stop('query_names must be a non-empty vector of non-empty character names')
}
return(all(query_names %in% cb_names))
}

352
R-package/R/utils.R Normal file
View File

@@ -0,0 +1,352 @@
#
# This file is for the low level reuseable utility functions
# that are not supposed to be visibe to a user.
#
#
# General helper utilities ----------------------------------------------------
#
# SQL-style NVL shortcut.
NVL <- function(x, val) {
if (is.null(x))
return(val)
if (is.vector(x)) {
x[is.na(x)] <- val
return(x)
}
if (typeof(x) == 'closure')
return(x)
stop("typeof(x) == ", typeof(x), " is not supported by NVL")
}
#
# Low-level functions for boosting --------------------------------------------
#
# Merges booster params with whatever is provided in ...
# plus runs some checks
check.booster.params <- function(params, ...) {
if (typeof(params) != "list")
stop("params must be a list")
# in R interface, allow for '.' instead of '_' in parameter names
names(params) <- gsub("\\.", "_", names(params))
# merge parameters from the params and the dots-expansion
dot_params <- list(...)
names(dot_params) <- gsub("\\.", "_", names(dot_params))
if (length(intersect(names(params),
names(dot_params))) > 0)
stop("Same parameters in 'params' and in the call are not allowed. Please check your 'params' list.")
params <- c(params, dot_params)
# providing a parameter multiple times makes sense only for 'eval_metric'
name_freqs <- table(names(params))
multi_names <- setdiff(names(name_freqs[name_freqs > 1]), 'eval_metric')
if (length(multi_names) > 0) {
warning("The following parameters were provided multiple times:\n\t",
paste(multi_names, collapse = ', '), "\n Only the last value for each of them will be used.\n")
# While xgboost internals would choose the last value for a multiple-times parameter,
# enforce it here in R as well (b/c multi-parameters might be used further in R code,
# and R takes the 1st value when multiple elements with the same name are present in a list).
for (n in multi_names) {
del_idx <- which(n == names(params))
del_idx <- del_idx[-length(del_idx)]
params[[del_idx]] <- NULL
}
}
# for multiclass, expect num_class to be set
if (typeof(params[['objective']]) == "character" &&
substr(NVL(params[['objective']], 'x'), 1, 6) == 'multi:' &&
as.numeric(NVL(params[['num_class']], 0)) < 2) {
stop("'num_class' > 1 parameter must be set for multiclass classification")
}
# monotone_constraints parser
if (!is.null(params[['monotone_constraints']]) &&
typeof(params[['monotone_constraints']]) != "character") {
vec2str = paste(params[['monotone_constraints']], collapse = ',')
vec2str = paste0('(', vec2str, ')')
params[['monotone_constraints']] = vec2str
}
# interaction constraints parser (convert from list of column indices to string)
if (!is.null(params[['interaction_constraints']]) &&
typeof(params[['interaction_constraints']]) != "character"){
# check input class
if (class(params[['interaction_constraints']]) != 'list') stop('interaction_constraints should be class list')
if (!all(unique(sapply(params[['interaction_constraints']], class)) %in% c('numeric','integer'))) {
stop('interaction_constraints should be a list of numeric/integer vectors')
}
# recast parameter as string
interaction_constraints <- sapply(params[['interaction_constraints']], function(x) paste0('[', paste(x, collapse=','), ']'))
params[['interaction_constraints']] <- paste0('[', paste(interaction_constraints, collapse=','), ']')
}
return(params)
}
# Performs some checks related to custom objective function.
# WARNING: has side-effects and can modify 'params' and 'obj' in its calling frame
check.custom.obj <- function(env = parent.frame()) {
if (!is.null(env$params[['objective']]) && !is.null(env$obj))
stop("Setting objectives in 'params' and 'obj' at the same time is not allowed")
if (!is.null(env$obj) && typeof(env$obj) != 'closure')
stop("'obj' must be a function")
# handle the case when custom objective function was provided through params
if (!is.null(env$params[['objective']]) &&
typeof(env$params$objective) == 'closure') {
env$obj <- env$params$objective
env$params$objective <- NULL
}
}
# Performs some checks related to custom evaluation function.
# WARNING: has side-effects and can modify 'params' and 'feval' in its calling frame
check.custom.eval <- function(env = parent.frame()) {
if (!is.null(env$params[['eval_metric']]) && !is.null(env$feval))
stop("Setting evaluation metrics in 'params' and 'feval' at the same time is not allowed")
if (!is.null(env$feval) && typeof(env$feval) != 'closure')
stop("'feval' must be a function")
# handle a situation when custom eval function was provided through params
if (!is.null(env$params[['eval_metric']]) &&
typeof(env$params$eval_metric) == 'closure') {
env$feval <- env$params$eval_metric
env$params$eval_metric <- NULL
}
# require maximize to be set when custom feval and early stopping are used together
if (!is.null(env$feval) &&
is.null(env$maximize) && (
!is.null(env$early_stopping_rounds) ||
has.callbacks(env$callbacks, 'cb.early.stop')))
stop("Please set 'maximize' to indicate whether the evaluation metric needs to be maximized or not")
}
# Update a booster handle for an iteration with dtrain data
xgb.iter.update <- function(booster_handle, dtrain, iter, obj = NULL) {
if (!identical(class(booster_handle), "xgb.Booster.handle")) {
stop("booster_handle must be of xgb.Booster.handle class")
}
if (!inherits(dtrain, "xgb.DMatrix")) {
stop("dtrain must be of xgb.DMatrix class")
}
if (is.null(obj)) {
.Call(XGBoosterUpdateOneIter_R, booster_handle, as.integer(iter), dtrain)
} else {
pred <- predict(booster_handle, dtrain)
gpair <- obj(pred, dtrain)
.Call(XGBoosterBoostOneIter_R, booster_handle, dtrain, gpair$grad, gpair$hess)
}
return(TRUE)
}
# Evaluate one iteration.
# Returns a named vector of evaluation metrics
# with the names in a 'datasetname-metricname' format.
xgb.iter.eval <- function(booster_handle, watchlist, iter, feval = NULL) {
if (!identical(class(booster_handle), "xgb.Booster.handle"))
stop("class of booster_handle must be xgb.Booster.handle")
if (length(watchlist) == 0)
return(NULL)
evnames <- names(watchlist)
if (is.null(feval)) {
msg <- .Call(XGBoosterEvalOneIter_R, booster_handle, as.integer(iter), watchlist, as.list(evnames))
msg <- stri_split_regex(msg, '(\\s+|:|\\s+)')[[1]][-1]
res <- as.numeric(msg[c(FALSE,TRUE)]) # even indices are the values
names(res) <- msg[c(TRUE,FALSE)] # odds are the names
} else {
res <- sapply(seq_along(watchlist), function(j) {
w <- watchlist[[j]]
preds <- predict(booster_handle, w) # predict using all trees
eval_res <- feval(preds, w)
out <- eval_res$value
names(out) <- paste0(evnames[j], "-", eval_res$metric)
out
})
}
return(res)
}
#
# Helper functions for cross validation ---------------------------------------
#
# Generates random (stratified if needed) CV folds
generate.cv.folds <- function(nfold, nrows, stratified, label, params) {
# cannot do it for rank
if (exists('objective', where = params) &&
is.character(params$objective) &&
strtrim(params$objective, 5) == 'rank:') {
stop("\n\tAutomatic generation of CV-folds is not implemented for ranking!\n",
"\tConsider providing pre-computed CV-folds through the 'folds=' parameter.\n")
}
# shuffle
rnd_idx <- sample.int(nrows)
if (stratified &&
length(label) == length(rnd_idx)) {
y <- label[rnd_idx]
# WARNING: some heuristic logic is employed to identify classification setting!
# - For classification, need to convert y labels to factor before making the folds,
# and then do stratification by factor levels.
# - For regression, leave y numeric and do stratification by quantiles.
if (exists('objective', where = params) &&
is.character(params$objective)) {
# If 'objective' provided in params, assume that y is a classification label
# unless objective is reg:squarederror
if (params$objective != 'reg:squarederror')
y <- factor(y)
} else {
# If no 'objective' given in params, it means that user either wants to
# use the default 'reg:squarederror' objective or has provided a custom
# obj function. Here, assume classification setting when y has 5 or less
# unique values:
if (length(unique(y)) <= 5)
y <- factor(y)
}
folds <- xgb.createFolds(y, nfold)
} else {
# make simple non-stratified folds
kstep <- length(rnd_idx) %/% nfold
folds <- list()
for (i in seq_len(nfold - 1)) {
folds[[i]] <- rnd_idx[seq_len(kstep)]
rnd_idx <- rnd_idx[-seq_len(kstep)]
}
folds[[nfold]] <- rnd_idx
}
return(folds)
}
# Creates CV folds stratified by the values of y.
# It was borrowed from caret::createFolds and simplified
# by always returning an unnamed list of fold indices.
xgb.createFolds <- function(y, k = 10)
{
if (is.numeric(y)) {
## Group the numeric data based on their magnitudes
## and sample within those groups.
## When the number of samples is low, we may have
## issues further slicing the numeric data into
## groups. The number of groups will depend on the
## ratio of the number of folds to the sample size.
## At most, we will use quantiles. If the sample
## is too small, we just do regular unstratified
## CV
cuts <- floor(length(y) / k)
if (cuts < 2) cuts <- 2
if (cuts > 5) cuts <- 5
y <- cut(y,
unique(stats::quantile(y, probs = seq(0, 1, length = cuts))),
include.lowest = TRUE)
}
if (k < length(y)) {
## reset levels so that the possible levels and
## the levels in the vector are the same
y <- factor(as.character(y))
numInClass <- table(y)
foldVector <- vector(mode = "integer", length(y))
## For each class, balance the fold allocation as far
## as possible, then resample the remainder.
## The final assignment of folds is also randomized.
for (i in seq_along(numInClass)) {
## create a vector of integers from 1:k as many times as possible without
## going over the number of samples in the class. Note that if the number
## of samples in a class is less than k, nothing is producd here.
seqVector <- rep(seq_len(k), numInClass[i] %/% k)
## add enough random integers to get length(seqVector) == numInClass[i]
if (numInClass[i] %% k > 0) seqVector <- c(seqVector, sample.int(k, numInClass[i] %% k))
## shuffle the integers for fold assignment and assign to this classes's data
## seqVector[sample.int(length(seqVector))] is used to handle length(seqVector) == 1
foldVector[y == dimnames(numInClass)$y[i]] <- seqVector[sample.int(length(seqVector))]
}
} else {
foldVector <- seq(along = y)
}
out <- split(seq(along = y), foldVector)
names(out) <- NULL
out
}
#
# Deprectaion notice utilities ------------------------------------------------
#
#' Deprecation notices.
#'
#' At this time, some of the parameter names were changed in order to make the code style more uniform.
#' The deprecated parameters would be removed in the next release.
#'
#' To see all the current deprecated and new parameters, check the \code{xgboost:::depr_par_lut} table.
#'
#' A deprecation warning is shown when any of the deprecated parameters is used in a call.
#' An additional warning is shown when there was a partial match to a deprecated parameter
#' (as R is able to partially match parameter names).
#'
#' @name xgboost-deprecated
NULL
# Lookup table for the deprecated parameters bookkeeping
depr_par_lut <- matrix(c(
'print.every.n', 'print_every_n',
'early.stop.round', 'early_stopping_rounds',
'training.data', 'data',
'with.stats', 'with_stats',
'numberOfClusters', 'n_clusters',
'features.keep', 'features_keep',
'plot.height','plot_height',
'plot.width','plot_width',
'n_first_tree', 'trees',
'dummy', 'DUMMY'
), ncol = 2, byrow = TRUE)
colnames(depr_par_lut) <- c('old', 'new')
# Checks the dot-parameters for deprecated names
# (including partial matching), gives a deprecation warning,
# and sets new parameters to the old parameters' values within its parent frame.
# WARNING: has side-effects
check.deprecation <- function(..., env = parent.frame()) {
pars <- list(...)
# exact and partial matches
all_match <- pmatch(names(pars), depr_par_lut[,1])
# indices of matched pars' names
idx_pars <- which(!is.na(all_match))
if (length(idx_pars) == 0) return()
# indices of matched LUT rows
idx_lut <- all_match[idx_pars]
# which of idx_lut were the exact matches?
ex_match <- depr_par_lut[idx_lut,1] %in% names(pars)
for (i in seq_along(idx_pars)) {
pars_par <- names(pars)[idx_pars[i]]
old_par <- depr_par_lut[idx_lut[i], 1]
new_par <- depr_par_lut[idx_lut[i], 2]
if (!ex_match[i]) {
warning("'", pars_par, "' was partially matched to '", old_par,"'")
}
.Deprecated(new_par, old = old_par, package = 'xgboost')
if (new_par != 'NULL') {
eval(parse(text = paste(new_par, '<-', pars[[pars_par]])), envir = env)
}
}
}

642
R-package/R/xgb.Booster.R Normal file
View File

@@ -0,0 +1,642 @@
# Construct an internal xgboost Booster and return a handle to it.
# internal utility function
xgb.Booster.handle <- function(params = list(), cachelist = list(), modelfile = NULL) {
if (typeof(cachelist) != "list" ||
!all(vapply(cachelist, inherits, logical(1), what = 'xgb.DMatrix'))) {
stop("cachelist must be a list of xgb.DMatrix objects")
}
handle <- .Call(XGBoosterCreate_R, cachelist)
if (!is.null(modelfile)) {
if (typeof(modelfile) == "character") {
.Call(XGBoosterLoadModel_R, handle, modelfile[1])
} else if (typeof(modelfile) == "raw") {
.Call(XGBoosterLoadModelFromRaw_R, handle, modelfile)
} else if (inherits(modelfile, "xgb.Booster")) {
bst <- xgb.Booster.complete(modelfile, saveraw = TRUE)
.Call(XGBoosterLoadModelFromRaw_R, handle, bst$raw)
} else {
stop("modelfile must be either character filename, or raw booster dump, or xgb.Booster object")
}
}
class(handle) <- "xgb.Booster.handle"
if (length(params) > 0) {
xgb.parameters(handle) <- params
}
return(handle)
}
# Convert xgb.Booster.handle to xgb.Booster
# internal utility function
xgb.handleToBooster <- function(handle, raw = NULL) {
bst <- list(handle = handle, raw = raw)
class(bst) <- "xgb.Booster"
return(bst)
}
# Check whether xgb.Booster.handle is null
# internal utility function
is.null.handle <- function(handle) {
if (is.null(handle)) return(TRUE)
if (!identical(class(handle), "xgb.Booster.handle"))
stop("argument type must be xgb.Booster.handle")
if (.Call(XGCheckNullPtr_R, handle))
return(TRUE)
return(FALSE)
}
# Return a verified to be valid handle out of either xgb.Booster.handle or xgb.Booster
# internal utility function
xgb.get.handle <- function(object) {
handle <- switch(class(object)[1],
xgb.Booster = object$handle,
xgb.Booster.handle = object,
stop("argument must be of either xgb.Booster or xgb.Booster.handle class")
)
if (is.null.handle(handle)) {
stop("invalid xgb.Booster.handle")
}
handle
}
#' Restore missing parts of an incomplete xgb.Booster object.
#'
#' It attempts to complete an \code{xgb.Booster} object by restoring either its missing
#' raw model memory dump (when it has no \code{raw} data but its \code{xgb.Booster.handle} is valid)
#' or its missing internal handle (when its \code{xgb.Booster.handle} is not valid
#' but it has a raw Booster memory dump).
#'
#' @param object object of class \code{xgb.Booster}
#' @param saveraw a flag indicating whether to append \code{raw} Booster memory dump data
#' when it doesn't already exist.
#'
#' @details
#'
#' While this method is primarily for internal use, it might be useful in some practical situations.
#'
#' E.g., when an \code{xgb.Booster} model is saved as an R object and then is loaded as an R object,
#' its handle (pointer) to an internal xgboost model would be invalid. The majority of xgboost methods
#' should still work for such a model object since those methods would be using
#' \code{xgb.Booster.complete} internally. However, one might find it to be more efficient to call the
#' \code{xgb.Booster.complete} function explicitly once after loading a model as an R-object.
#' That would prevent further repeated implicit reconstruction of an internal booster model.
#'
#' @return
#' An object of \code{xgb.Booster} class.
#'
#' @examples
#'
#' data(agaricus.train, package='xgboost')
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#' saveRDS(bst, "xgb.model.rds")
#'
#' bst1 <- readRDS("xgb.model.rds")
#' if (file.exists("xgb.model.rds")) file.remove("xgb.model.rds")
#' # the handle is invalid:
#' print(bst1$handle)
#'
#' bst1 <- xgb.Booster.complete(bst1)
#' # now the handle points to a valid internal booster model:
#' print(bst1$handle)
#'
#' @export
xgb.Booster.complete <- function(object, saveraw = TRUE) {
if (!inherits(object, "xgb.Booster"))
stop("argument type must be xgb.Booster")
if (is.null.handle(object$handle)) {
object$handle <- xgb.Booster.handle(modelfile = object$raw)
} else {
if (is.null(object$raw) && saveraw)
object$raw <- xgb.save.raw(object$handle)
}
return(object)
}
#' Predict method for eXtreme Gradient Boosting model
#'
#' Predicted values based on either xgboost model or model handle object.
#'
#' @param object Object of class \code{xgb.Booster} or \code{xgb.Booster.handle}
#' @param newdata takes \code{matrix}, \code{dgCMatrix}, local data file or \code{xgb.DMatrix}.
#' @param missing Missing is only used when input is dense matrix. Pick a float value that represents
#' missing values in data (e.g., sometimes 0 or some other extreme value is used).
#' @param outputmargin whether the prediction should be returned in the for of original untransformed
#' sum of predictions from boosting iterations' results. E.g., setting \code{outputmargin=TRUE} for
#' logistic regression would result in predictions for log-odds instead of probabilities.
#' @param ntreelimit limit the number of model's trees or boosting iterations used in prediction (see Details).
#' It will use all the trees by default (\code{NULL} value).
#' @param predleaf whether predict leaf index.
#' @param predcontrib whether to return feature contributions to individual predictions (see Details).
#' @param approxcontrib whether to use a fast approximation for feature contributions (see Details).
#' @param predinteraction whether to return contributions of feature interactions to individual predictions (see Details).
#' @param reshape whether to reshape the vector of predictions to a matrix form when there are several
#' prediction outputs per case. This option has no effect when either of predleaf, predcontrib,
#' or predinteraction flags is TRUE.
#' @param ... Parameters passed to \code{predict.xgb.Booster}
#'
#' @details
#' Note that \code{ntreelimit} is not necessarily equal to the number of boosting iterations
#' and it is not necessarily equal to the number of trees in a model.
#' E.g., in a random forest-like model, \code{ntreelimit} would limit the number of trees.
#' But for multiclass classification, while there are multiple trees per iteration,
#' \code{ntreelimit} limits the number of boosting iterations.
#'
#' Also note that \code{ntreelimit} would currently do nothing for predictions from gblinear,
#' since gblinear doesn't keep its boosting history.
#'
#' One possible practical applications of the \code{predleaf} option is to use the model
#' as a generator of new features which capture non-linearity and interactions,
#' e.g., as implemented in \code{\link{xgb.create.features}}.
#'
#' Setting \code{predcontrib = TRUE} allows to calculate contributions of each feature to
#' individual predictions. For "gblinear" booster, feature contributions are simply linear terms
#' (feature_beta * feature_value). For "gbtree" booster, feature contributions are SHAP
#' values (Lundberg 2017) that sum to the difference between the expected output
#' of the model and the current prediction (where the hessian weights are used to compute the expectations).
#' Setting \code{approxcontrib = TRUE} approximates these values following the idea explained
#' in \url{http://blog.datadive.net/interpreting-random-forests/}.
#'
#' With \code{predinteraction = TRUE}, SHAP values of contributions of interaction of each pair of features
#' are computed. Note that this operation might be rather expensive in terms of compute and memory.
#' Since it quadratically depends on the number of features, it is recommended to perform selection
#' of the most important features first. See below about the format of the returned results.
#'
#' @return
#' For regression or binary classification, it returns a vector of length \code{nrows(newdata)}.
#' For multiclass classification, either a \code{num_class * nrows(newdata)} vector or
#' a \code{(nrows(newdata), num_class)} dimension matrix is returned, depending on
#' the \code{reshape} value.
#'
#' When \code{predleaf = TRUE}, the output is a matrix object with the
#' number of columns corresponding to the number of trees.
#'
#' When \code{predcontrib = TRUE} and it is not a multiclass setting, the output is a matrix object with
#' \code{num_features + 1} columns. The last "+ 1" column in a matrix corresponds to bias.
#' For a multiclass case, a list of \code{num_class} elements is returned, where each element is
#' such a matrix. The contribution values are on the scale of untransformed margin
#' (e.g., for binary classification would mean that the contributions are log-odds deviations from bias).
#'
#' When \code{predinteraction = TRUE} and it is not a multiclass setting, the output is a 3d array with
#' dimensions \code{c(nrow, num_features + 1, num_features + 1)}. The off-diagonal (in the last two dimensions)
#' elements represent different features interaction contributions. The array is symmetric WRT the last
#' two dimensions. The "+ 1" columns corresponds to bias. Summing this array along the last dimension should
#' produce practically the same result as predict with \code{predcontrib = TRUE}.
#' For a multiclass case, a list of \code{num_class} elements is returned, where each element is
#' such an array.
#'
#' @seealso
#' \code{\link{xgb.train}}.
#'
#' @references
#'
#' Scott M. Lundberg, Su-In Lee, "A Unified Approach to Interpreting Model Predictions", NIPS Proceedings 2017, \url{https://arxiv.org/abs/1705.07874}
#'
#' Scott M. Lundberg, Su-In Lee, "Consistent feature attribution for tree ensembles", \url{https://arxiv.org/abs/1706.06060}
#'
#' @examples
#' ## binary classification:
#'
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#' train <- agaricus.train
#' test <- agaricus.test
#'
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 0.5, nthread = 2, nrounds = 5, objective = "binary:logistic")
#' # use all trees by default
#' pred <- predict(bst, test$data)
#' # use only the 1st tree
#' pred1 <- predict(bst, test$data, ntreelimit = 1)
#'
#' # Predicting tree leafs:
#' # the result is an nsamples X ntrees matrix
#' pred_leaf <- predict(bst, test$data, predleaf = TRUE)
#' str(pred_leaf)
#'
#' # Predicting feature contributions to predictions:
#' # the result is an nsamples X (nfeatures + 1) matrix
#' pred_contr <- predict(bst, test$data, predcontrib = TRUE)
#' str(pred_contr)
#' # verify that contributions' sums are equal to log-odds of predictions (up to float precision):
#' summary(rowSums(pred_contr) - qlogis(pred))
#' # for the 1st record, let's inspect its features that had non-zero contribution to prediction:
#' contr1 <- pred_contr[1,]
#' contr1 <- contr1[-length(contr1)] # drop BIAS
#' contr1 <- contr1[contr1 != 0] # drop non-contributing features
#' contr1 <- contr1[order(abs(contr1))] # order by contribution magnitude
#' old_mar <- par("mar")
#' par(mar = old_mar + c(0,7,0,0))
#' barplot(contr1, horiz = TRUE, las = 2, xlab = "contribution to prediction in log-odds")
#' par(mar = old_mar)
#'
#'
#' ## multiclass classification in iris dataset:
#'
#' lb <- as.numeric(iris$Species) - 1
#' num_class <- 3
#' set.seed(11)
#' bst <- xgboost(data = as.matrix(iris[, -5]), label = lb,
#' max_depth = 4, eta = 0.5, nthread = 2, nrounds = 10, subsample = 0.5,
#' objective = "multi:softprob", num_class = num_class)
#' # predict for softmax returns num_class probability numbers per case:
#' pred <- predict(bst, as.matrix(iris[, -5]))
#' str(pred)
#' # reshape it to a num_class-columns matrix
#' pred <- matrix(pred, ncol=num_class, byrow=TRUE)
#' # convert the probabilities to softmax labels
#' pred_labels <- max.col(pred) - 1
#' # the following should result in the same error as seen in the last iteration
#' sum(pred_labels != lb)/length(lb)
#'
#' # compare that to the predictions from softmax:
#' set.seed(11)
#' bst <- xgboost(data = as.matrix(iris[, -5]), label = lb,
#' max_depth = 4, eta = 0.5, nthread = 2, nrounds = 10, subsample = 0.5,
#' objective = "multi:softmax", num_class = num_class)
#' pred <- predict(bst, as.matrix(iris[, -5]))
#' str(pred)
#' all.equal(pred, pred_labels)
#' # prediction from using only 5 iterations should result
#' # in the same error as seen in iteration 5:
#' pred5 <- predict(bst, as.matrix(iris[, -5]), ntreelimit=5)
#' sum(pred5 != lb)/length(lb)
#'
#'
#' ## random forest-like model of 25 trees for binary classification:
#'
#' set.seed(11)
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 5,
#' nthread = 2, nrounds = 1, objective = "binary:logistic",
#' num_parallel_tree = 25, subsample = 0.6, colsample_bytree = 0.1)
#' # Inspect the prediction error vs number of trees:
#' lb <- test$label
#' dtest <- xgb.DMatrix(test$data, label=lb)
#' err <- sapply(1:25, function(n) {
#' pred <- predict(bst, dtest, ntreelimit=n)
#' sum((pred > 0.5) != lb)/length(lb)
#' })
#' plot(err, type='l', ylim=c(0,0.1), xlab='#trees')
#'
#' @rdname predict.xgb.Booster
#' @export
predict.xgb.Booster <- function(object, newdata, missing = NA, outputmargin = FALSE, ntreelimit = NULL,
predleaf = FALSE, predcontrib = FALSE, approxcontrib = FALSE, predinteraction = FALSE,
reshape = FALSE, ...) {
object <- xgb.Booster.complete(object, saveraw = FALSE)
if (!inherits(newdata, "xgb.DMatrix"))
newdata <- xgb.DMatrix(newdata, missing = missing)
if (!is.null(object[["feature_names"]]) &&
!is.null(colnames(newdata)) &&
!identical(object[["feature_names"]], colnames(newdata)))
stop("Feature names stored in `object` and `newdata` are different!")
if (is.null(ntreelimit))
ntreelimit <- NVL(object$best_ntreelimit, 0)
if (NVL(object$params[['booster']], '') == 'gblinear')
ntreelimit <- 0
if (ntreelimit < 0)
stop("ntreelimit cannot be negative")
option <- 0L + 1L * as.logical(outputmargin) + 2L * as.logical(predleaf) + 4L * as.logical(predcontrib) +
8L * as.logical(approxcontrib) + 16L * as.logical(predinteraction)
ret <- .Call(XGBoosterPredict_R, object$handle, newdata, option[1], as.integer(ntreelimit))
n_ret <- length(ret)
n_row <- nrow(newdata)
npred_per_case <- n_ret / n_row
if (n_ret %% n_row != 0)
stop("prediction length ", n_ret, " is not multiple of nrows(newdata) ", n_row)
if (predleaf) {
ret <- if (n_ret == n_row) {
matrix(ret, ncol = 1)
} else {
matrix(ret, nrow = n_row, byrow = TRUE)
}
} else if (predcontrib) {
n_col1 <- ncol(newdata) + 1
n_group <- npred_per_case / n_col1
cnames <- if (!is.null(colnames(newdata))) c(colnames(newdata), "BIAS") else NULL
ret <- if (n_ret == n_row) {
matrix(ret, ncol = 1, dimnames = list(NULL, cnames))
} else if (n_group == 1) {
matrix(ret, nrow = n_row, byrow = TRUE, dimnames = list(NULL, cnames))
} else {
arr <- array(ret, c(n_col1, n_group, n_row),
dimnames = list(cnames, NULL, NULL)) %>% aperm(c(2,3,1)) # [group, row, col]
lapply(seq_len(n_group), function(g) arr[g,,])
}
} else if (predinteraction) {
n_col1 <- ncol(newdata) + 1
n_group <- npred_per_case / n_col1^2
cnames <- if (!is.null(colnames(newdata))) c(colnames(newdata), "BIAS") else NULL
ret <- if (n_ret == n_row) {
matrix(ret, ncol = 1, dimnames = list(NULL, cnames))
} else if (n_group == 1) {
array(ret, c(n_col1, n_col1, n_row), dimnames = list(cnames, cnames, NULL)) %>% aperm(c(3,1,2))
} else {
arr <- array(ret, c(n_col1, n_col1, n_group, n_row),
dimnames = list(cnames, cnames, NULL, NULL)) %>% aperm(c(3,4,1,2)) # [group, row, col1, col2]
lapply(seq_len(n_group), function(g) arr[g,,,])
}
} else if (reshape && npred_per_case > 1) {
ret <- matrix(ret, nrow = n_row, byrow = TRUE)
}
return(ret)
}
#' @rdname predict.xgb.Booster
#' @export
predict.xgb.Booster.handle <- function(object, ...) {
bst <- xgb.handleToBooster(object)
ret <- predict(bst, ...)
return(ret)
}
#' Accessors for serializable attributes of a model.
#'
#' These methods allow to manipulate the key-value attribute strings of an xgboost model.
#'
#' @param object Object of class \code{xgb.Booster} or \code{xgb.Booster.handle}.
#' @param name a non-empty character string specifying which attribute is to be accessed.
#' @param value a value of an attribute for \code{xgb.attr<-}; for \code{xgb.attributes<-}
#' it's a list (or an object coercible to a list) with the names of attributes to set
#' and the elements corresponding to attribute values.
#' Non-character values are converted to character.
#' When attribute value is not a scalar, only the first index is used.
#' Use \code{NULL} to remove an attribute.
#'
#' @details
#' The primary purpose of xgboost model attributes is to store some meta-data about the model.
#' Note that they are a separate concept from the object attributes in R.
#' Specifically, they refer to key-value strings that can be attached to an xgboost model,
#' stored together with the model's binary representation, and accessed later
#' (from R or any other interface).
#' In contrast, any R-attribute assigned to an R-object of \code{xgb.Booster} class
#' would not be saved by \code{xgb.save} because an xgboost model is an external memory object
#' and its serialization is handled externally.
#' Also, setting an attribute that has the same name as one of xgboost's parameters wouldn't
#' change the value of that parameter for a model.
#' Use \code{\link{xgb.parameters<-}} to set or change model parameters.
#'
#' The attribute setters would usually work more efficiently for \code{xgb.Booster.handle}
#' than for \code{xgb.Booster}, since only just a handle (pointer) would need to be copied.
#' That would only matter if attributes need to be set many times.
#' Note, however, that when feeding a handle of an \code{xgb.Booster} object to the attribute setters,
#' the raw model cache of an \code{xgb.Booster} object would not be automatically updated,
#' and it would be user's responsibility to call \code{xgb.save.raw} to update it.
#'
#' The \code{xgb.attributes<-} setter either updates the existing or adds one or several attributes,
#' but it doesn't delete the other existing attributes.
#'
#' @return
#' \code{xgb.attr} returns either a string value of an attribute
#' or \code{NULL} if an attribute wasn't stored in a model.
#'
#' \code{xgb.attributes} returns a list of all attribute stored in a model
#' or \code{NULL} if a model has no stored attributes.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#'
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#'
#' xgb.attr(bst, "my_attribute") <- "my attribute value"
#' print(xgb.attr(bst, "my_attribute"))
#' xgb.attributes(bst) <- list(a = 123, b = "abc")
#'
#' xgb.save(bst, 'xgb.model')
#' bst1 <- xgb.load('xgb.model')
#' if (file.exists('xgb.model')) file.remove('xgb.model')
#' print(xgb.attr(bst1, "my_attribute"))
#' print(xgb.attributes(bst1))
#'
#' # deletion:
#' xgb.attr(bst1, "my_attribute") <- NULL
#' print(xgb.attributes(bst1))
#' xgb.attributes(bst1) <- list(a = NULL, b = NULL)
#' print(xgb.attributes(bst1))
#'
#' @rdname xgb.attr
#' @export
xgb.attr <- function(object, name) {
if (is.null(name) || nchar(as.character(name[1])) == 0) stop("invalid attribute name")
handle <- xgb.get.handle(object)
.Call(XGBoosterGetAttr_R, handle, as.character(name[1]))
}
#' @rdname xgb.attr
#' @export
`xgb.attr<-` <- function(object, name, value) {
if (is.null(name) || nchar(as.character(name[1])) == 0) stop("invalid attribute name")
handle <- xgb.get.handle(object)
if (!is.null(value)) {
# Coerce the elements to be scalar strings.
# Q: should we warn user about non-scalar elements?
if (is.numeric(value[1])) {
value <- format(value[1], digits = 17)
} else {
value <- as.character(value[1])
}
}
.Call(XGBoosterSetAttr_R, handle, as.character(name[1]), value)
if (is(object, 'xgb.Booster') && !is.null(object$raw)) {
object$raw <- xgb.save.raw(object$handle)
}
object
}
#' @rdname xgb.attr
#' @export
xgb.attributes <- function(object) {
handle <- xgb.get.handle(object)
attr_names <- .Call(XGBoosterGetAttrNames_R, handle)
if (is.null(attr_names)) return(NULL)
res <- lapply(attr_names, function(x) {
.Call(XGBoosterGetAttr_R, handle, x)
})
names(res) <- attr_names
res
}
#' @rdname xgb.attr
#' @export
`xgb.attributes<-` <- function(object, value) {
a <- as.list(value)
if (is.null(names(a)) || any(nchar(names(a)) == 0)) {
stop("attribute names cannot be empty strings")
}
# Coerce the elements to be scalar strings.
# Q: should we warn a user about non-scalar elements?
a <- lapply(a, function(x) {
if (is.null(x)) return(NULL)
if (is.numeric(x[1])) {
format(x[1], digits = 17)
} else {
as.character(x[1])
}
})
handle <- xgb.get.handle(object)
for (i in seq_along(a)) {
.Call(XGBoosterSetAttr_R, handle, names(a[i]), a[[i]])
}
if (is(object, 'xgb.Booster') && !is.null(object$raw)) {
object$raw <- xgb.save.raw(object$handle)
}
object
}
#' Accessors for model parameters.
#'
#' Only the setter for xgboost parameters is currently implemented.
#'
#' @param object Object of class \code{xgb.Booster} or \code{xgb.Booster.handle}.
#' @param value a list (or an object coercible to a list) with the names of parameters to set
#' and the elements corresponding to parameter values.
#'
#' @details
#' Note that the setter would usually work more efficiently for \code{xgb.Booster.handle}
#' than for \code{xgb.Booster}, since only just a handle would need to be copied.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#'
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#'
#' xgb.parameters(bst) <- list(eta = 0.1)
#'
#' @rdname xgb.parameters
#' @export
`xgb.parameters<-` <- function(object, value) {
if (length(value) == 0) return(object)
p <- as.list(value)
if (is.null(names(p)) || any(nchar(names(p)) == 0)) {
stop("parameter names cannot be empty strings")
}
names(p) <- gsub("\\.", "_", names(p))
p <- lapply(p, function(x) as.character(x)[1])
handle <- xgb.get.handle(object)
for (i in seq_along(p)) {
.Call(XGBoosterSetParam_R, handle, names(p[i]), p[[i]])
}
if (is(object, 'xgb.Booster') && !is.null(object$raw)) {
object$raw <- xgb.save.raw(object$handle)
}
object
}
# Extract the number of trees in a model.
# TODO: either add a getter to C-interface, or simply set an 'ntree' attribute after each iteration.
# internal utility function
xgb.ntree <- function(bst) {
length(grep('^booster', xgb.dump(bst)))
}
#' Print xgb.Booster
#'
#' Print information about xgb.Booster.
#'
#' @param x an xgb.Booster object
#' @param verbose whether to print detailed data (e.g., attribute values)
#' @param ... not currently used
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#' attr(bst, 'myattr') <- 'memo'
#'
#' print(bst)
#' print(bst, verbose=TRUE)
#'
#' @method print xgb.Booster
#' @export
print.xgb.Booster <- function(x, verbose = FALSE, ...) {
cat('##### xgb.Booster\n')
valid_handle <- !is.null.handle(x$handle)
if (!valid_handle)
cat("Handle is invalid! Suggest using xgb.Booster.complete\n")
cat('raw: ')
if (!is.null(x$raw)) {
cat(format(object.size(x$raw), units = "auto"), '\n')
} else {
cat('NULL\n')
}
if (!is.null(x$call)) {
cat('call:\n ')
print(x$call)
}
if (!is.null(x$params)) {
cat('params (as set within xgb.train):\n')
cat( ' ',
paste(names(x$params),
paste0('"', unlist(x$params), '"'),
sep = ' = ', collapse = ', '), '\n', sep = '')
}
# TODO: need an interface to access all the xgboosts parameters
attrs <- character(0)
if (valid_handle)
attrs <- xgb.attributes(x)
if (length(attrs) > 0) {
cat('xgb.attributes:\n')
if (verbose) {
cat( paste(paste0(' ',names(attrs)),
paste0('"', unlist(attrs), '"'),
sep = ' = ', collapse = '\n'), '\n', sep = '')
} else {
cat(' ', paste(names(attrs), collapse = ', '), '\n', sep = '')
}
}
if (!is.null(x$callbacks) && length(x$callbacks) > 0) {
cat('callbacks:\n')
lapply(callback.calls(x$callbacks), function(x) {
cat(' ')
print(x)
})
}
if (!is.null(x$feature_names))
cat('# of features:', length(x$feature_names), '\n')
cat('niter: ', x$niter, '\n', sep = '')
# TODO: uncomment when faster xgb.ntree is implemented
#cat('ntree: ', xgb.ntree(x), '\n', sep='')
for (n in setdiff(names(x), c('handle', 'raw', 'call', 'params', 'callbacks',
'evaluation_log','niter','feature_names'))) {
if (is.atomic(x[[n]])) {
cat(n, ':', x[[n]], '\n', sep = ' ')
} else {
cat(n, ':\n\t', sep = ' ')
print(x[[n]])
}
}
if (!is.null(x$evaluation_log)) {
cat('evaluation_log:\n')
print(x$evaluation_log, row.names = FALSE, topn = 2)
}
invisible(x)
}

367
R-package/R/xgb.DMatrix.R Normal file
View File

@@ -0,0 +1,367 @@
#' Construct xgb.DMatrix object
#'
#' Construct xgb.DMatrix object from either a dense matrix, a sparse matrix, or a local file.
#' Supported input file formats are either a libsvm text file or a binary file that was created previously by
#' \code{\link{xgb.DMatrix.save}}).
#'
#' @param data a \code{matrix} object (either numeric or integer), a \code{dgCMatrix} object, or a character
#' string representing a filename.
#' @param info a named list of additional information to store in the \code{xgb.DMatrix} object.
#' See \code{\link{setinfo}} for the specific allowed kinds of
#' @param missing a float value to represents missing values in data (used only when input is a dense matrix).
#' It is useful when a 0 or some other extreme value represents missing values in data.
#' @param silent whether to suppress printing an informational message after loading from a file.
#' @param ... the \code{info} data could be passed directly as parameters, without creating an \code{info} list.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#' xgb.DMatrix.save(dtrain, 'xgb.DMatrix.data')
#' dtrain <- xgb.DMatrix('xgb.DMatrix.data')
#' if (file.exists('xgb.DMatrix.data')) file.remove('xgb.DMatrix.data')
#' @export
xgb.DMatrix <- function(data, info = list(), missing = NA, silent = FALSE, ...) {
cnames <- NULL
if (typeof(data) == "character") {
if (length(data) > 1)
stop("'data' has class 'character' and length ", length(data),
".\n 'data' accepts either a numeric matrix or a single filename.")
handle <- .Call(XGDMatrixCreateFromFile_R, data, as.integer(silent))
} else if (is.matrix(data)) {
handle <- .Call(XGDMatrixCreateFromMat_R, data, missing)
cnames <- colnames(data)
} else if (inherits(data, "dgCMatrix")) {
handle <- .Call(XGDMatrixCreateFromCSC_R, data@p, data@i, data@x, nrow(data))
cnames <- colnames(data)
} else {
stop("xgb.DMatrix does not support construction from ", typeof(data))
}
dmat <- handle
attributes(dmat) <- list(.Dimnames = list(NULL, cnames), class = "xgb.DMatrix")
info <- append(info, list(...))
for (i in seq_along(info)) {
p <- info[i]
setinfo(dmat, names(p), p[[1]])
}
return(dmat)
}
# get dmatrix from data, label
# internal helper method
xgb.get.DMatrix <- function(data, label = NULL, missing = NA, weight = NULL) {
if (inherits(data, "dgCMatrix") || is.matrix(data)) {
if (is.null(label)) {
stop("label must be provided when data is a matrix")
}
dtrain <- xgb.DMatrix(data, label = label, missing = missing)
if (!is.null(weight)){
setinfo(dtrain, "weight", weight)
}
} else {
if (!is.null(label)) {
warning("xgboost: label will be ignored.")
}
if (is.character(data)) {
dtrain <- xgb.DMatrix(data[1])
} else if (inherits(data, "xgb.DMatrix")) {
dtrain <- data
} else if (inherits(data, "data.frame")) {
stop("xgboost doesn't support data.frame as input. Convert it to matrix first.")
} else {
stop("xgboost: invalid input data")
}
}
return (dtrain)
}
#' Dimensions of xgb.DMatrix
#'
#' Returns a vector of numbers of rows and of columns in an \code{xgb.DMatrix}.
#' @param x Object of class \code{xgb.DMatrix}
#'
#' @details
#' Note: since \code{nrow} and \code{ncol} internally use \code{dim}, they can also
#' be directly used with an \code{xgb.DMatrix} object.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#'
#' stopifnot(nrow(dtrain) == nrow(train$data))
#' stopifnot(ncol(dtrain) == ncol(train$data))
#' stopifnot(all(dim(dtrain) == dim(train$data)))
#'
#' @export
dim.xgb.DMatrix <- function(x) {
c(.Call(XGDMatrixNumRow_R, x), .Call(XGDMatrixNumCol_R, x))
}
#' Handling of column names of \code{xgb.DMatrix}
#'
#' Only column names are supported for \code{xgb.DMatrix}, thus setting of
#' row names would have no effect and returned row names would be NULL.
#'
#' @param x object of class \code{xgb.DMatrix}
#' @param value a list of two elements: the first one is ignored
#' and the second one is column names
#'
#' @details
#' Generic \code{dimnames} methods are used by \code{colnames}.
#' Since row names are irrelevant, it is recommended to use \code{colnames} directly.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#' dimnames(dtrain)
#' colnames(dtrain)
#' colnames(dtrain) <- make.names(1:ncol(train$data))
#' print(dtrain, verbose=TRUE)
#'
#' @rdname dimnames.xgb.DMatrix
#' @export
dimnames.xgb.DMatrix <- function(x) {
attr(x, '.Dimnames')
}
#' @rdname dimnames.xgb.DMatrix
#' @export
`dimnames<-.xgb.DMatrix` <- function(x, value) {
if (!is.list(value) || length(value) != 2L)
stop("invalid 'dimnames' given: must be a list of two elements")
if (!is.null(value[[1L]]))
stop("xgb.DMatrix does not have rownames")
if (is.null(value[[2]])) {
attr(x, '.Dimnames') <- NULL
return(x)
}
if (ncol(x) != length(value[[2]]))
stop("can't assign ", length(value[[2]]), " colnames to a ",
ncol(x), " column xgb.DMatrix")
attr(x, '.Dimnames') <- value
x
}
#' Get information of an xgb.DMatrix object
#'
#' Get information of an xgb.DMatrix object
#' @param object Object of class \code{xgb.DMatrix}
#' @param name the name of the information field to get (see details)
#' @param ... other parameters
#'
#' @details
#' The \code{name} field can be one of the following:
#'
#' \itemize{
#' \item \code{label}: label Xgboost learn from ;
#' \item \code{weight}: to do a weight rescale ;
#' \item \code{base_margin}: base margin is the base prediction Xgboost will boost from ;
#' \item \code{nrow}: number of rows of the \code{xgb.DMatrix}.
#'
#' }
#'
#' \code{group} can be setup by \code{setinfo} but can't be retrieved by \code{getinfo}.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#'
#' labels <- getinfo(dtrain, 'label')
#' setinfo(dtrain, 'label', 1-labels)
#'
#' labels2 <- getinfo(dtrain, 'label')
#' stopifnot(all(labels2 == 1-labels))
#' @rdname getinfo
#' @export
getinfo <- function(object, ...) UseMethod("getinfo")
#' @rdname getinfo
#' @export
getinfo.xgb.DMatrix <- function(object, name, ...) {
if (typeof(name) != "character" ||
length(name) != 1 ||
!name %in% c('label', 'weight', 'base_margin', 'nrow')) {
stop("getinfo: name must be one of the following\n",
" 'label', 'weight', 'base_margin', 'nrow'")
}
if (name != "nrow"){
ret <- .Call(XGDMatrixGetInfo_R, object, name)
} else {
ret <- nrow(object)
}
if (length(ret) == 0) return(NULL)
return(ret)
}
#' Set information of an xgb.DMatrix object
#'
#' Set information of an xgb.DMatrix object
#'
#' @param object Object of class "xgb.DMatrix"
#' @param name the name of the field to get
#' @param info the specific field of information to set
#' @param ... other parameters
#'
#' @details
#' The \code{name} field can be one of the following:
#'
#' \itemize{
#' \item \code{label}: label Xgboost learn from ;
#' \item \code{weight}: to do a weight rescale ;
#' \item \code{base_margin}: base margin is the base prediction Xgboost will boost from ;
#' \item \code{group}: number of rows in each group (to use with \code{rank:pairwise} objective).
#' }
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#'
#' labels <- getinfo(dtrain, 'label')
#' setinfo(dtrain, 'label', 1-labels)
#' labels2 <- getinfo(dtrain, 'label')
#' stopifnot(all.equal(labels2, 1-labels))
#' @rdname setinfo
#' @export
setinfo <- function(object, ...) UseMethod("setinfo")
#' @rdname setinfo
#' @export
setinfo.xgb.DMatrix <- function(object, name, info, ...) {
if (name == "label") {
if (length(info) != nrow(object))
stop("The length of labels must equal to the number of rows in the input data")
.Call(XGDMatrixSetInfo_R, object, name, as.numeric(info))
return(TRUE)
}
if (name == "weight") {
if (length(info) != nrow(object))
stop("The length of weights must equal to the number of rows in the input data")
.Call(XGDMatrixSetInfo_R, object, name, as.numeric(info))
return(TRUE)
}
if (name == "base_margin") {
# if (length(info)!=nrow(object))
# stop("The length of base margin must equal to the number of rows in the input data")
.Call(XGDMatrixSetInfo_R, object, name, as.numeric(info))
return(TRUE)
}
if (name == "group") {
if (sum(info) != nrow(object))
stop("The sum of groups must equal to the number of rows in the input data")
.Call(XGDMatrixSetInfo_R, object, name, as.integer(info))
return(TRUE)
}
stop("setinfo: unknown info name ", name)
return(FALSE)
}
#' Get a new DMatrix containing the specified rows of
#' original xgb.DMatrix object
#'
#' Get a new DMatrix containing the specified rows of
#' original xgb.DMatrix object
#'
#' @param object Object of class "xgb.DMatrix"
#' @param idxset a integer vector of indices of rows needed
#' @param colset currently not used (columns subsetting is not available)
#' @param ... other parameters (currently not used)
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#'
#' dsub <- slice(dtrain, 1:42)
#' labels1 <- getinfo(dsub, 'label')
#' dsub <- dtrain[1:42, ]
#' labels2 <- getinfo(dsub, 'label')
#' all.equal(labels1, labels2)
#'
#' @rdname slice.xgb.DMatrix
#' @export
slice <- function(object, ...) UseMethod("slice")
#' @rdname slice.xgb.DMatrix
#' @export
slice.xgb.DMatrix <- function(object, idxset, ...) {
if (!inherits(object, "xgb.DMatrix")) {
stop("object must be xgb.DMatrix")
}
ret <- .Call(XGDMatrixSliceDMatrix_R, object, idxset)
attr_list <- attributes(object)
nr <- nrow(object)
len <- sapply(attr_list, NROW)
ind <- which(len == nr)
if (length(ind) > 0) {
nms <- names(attr_list)[ind]
for (i in seq_along(ind)) {
obj_attr <- attr(object, nms[i])
if (NCOL(obj_attr) > 1) {
attr(ret, nms[i]) <- obj_attr[idxset,]
} else {
attr(ret, nms[i]) <- obj_attr[idxset]
}
}
}
return(structure(ret, class = "xgb.DMatrix"))
}
#' @rdname slice.xgb.DMatrix
#' @export
`[.xgb.DMatrix` <- function(object, idxset, colset = NULL) {
slice(object, idxset)
}
#' Print xgb.DMatrix
#'
#' Print information about xgb.DMatrix.
#' Currently it displays dimensions and presence of info-fields and colnames.
#'
#' @param x an xgb.DMatrix object
#' @param verbose whether to print colnames (when present)
#' @param ... not currently used
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#'
#' dtrain
#' print(dtrain, verbose=TRUE)
#'
#' @method print xgb.DMatrix
#' @export
print.xgb.DMatrix <- function(x, verbose = FALSE, ...) {
cat('xgb.DMatrix dim:', nrow(x), 'x', ncol(x), ' info: ')
infos <- c()
if(length(getinfo(x, 'label')) > 0) infos <- 'label'
if(length(getinfo(x, 'weight')) > 0) infos <- c(infos, 'weight')
if(length(getinfo(x, 'base_margin')) > 0) infos <- c(infos, 'base_margin')
if (length(infos) == 0) infos <- 'NA'
cat(infos)
cnames <- colnames(x)
cat(' colnames:')
if (verbose & !is.null(cnames)) {
cat("\n'")
cat(cnames, sep = "','")
cat("'")
} else {
if (is.null(cnames)) cat(' no')
else cat(' yes')
}
cat("\n")
invisible(x)
}

View File

@@ -0,0 +1,24 @@
#' Save xgb.DMatrix object to binary file
#'
#' Save xgb.DMatrix object to binary file
#'
#' @param dmatrix the \code{xgb.DMatrix} object
#' @param fname the name of the file to write.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' dtrain <- xgb.DMatrix(train$data, label=train$label)
#' xgb.DMatrix.save(dtrain, 'xgb.DMatrix.data')
#' dtrain <- xgb.DMatrix('xgb.DMatrix.data')
#' if (file.exists('xgb.DMatrix.data')) file.remove('xgb.DMatrix.data')
#' @export
xgb.DMatrix.save <- function(dmatrix, fname) {
if (typeof(fname) != "character")
stop("fname must be character")
if (!inherits(dmatrix, "xgb.DMatrix"))
stop("dmatrix must be xgb.DMatrix")
.Call(XGDMatrixSaveBinary_R, dmatrix, fname[1], 0L)
return(TRUE)
}

View File

@@ -0,0 +1,87 @@
#' Create new features from a previously learned model
#'
#' May improve the learning by adding new features to the training data based on the decision trees from a previously learned model.
#'
#' @param model decision tree boosting model learned on the original data
#' @param data original data (usually provided as a \code{dgCMatrix} matrix)
#' @param ... currently not used
#'
#' @return \code{dgCMatrix} matrix including both the original data and the new features.
#'
#' @details
#' This is the function inspired from the paragraph 3.1 of the paper:
#'
#' \strong{Practical Lessons from Predicting Clicks on Ads at Facebook}
#'
#' \emph{(Xinran He, Junfeng Pan, Ou Jin, Tianbing Xu, Bo Liu, Tao Xu, Yan, xin Shi, Antoine Atallah, Ralf Herbrich, Stuart Bowers,
#' Joaquin Quinonero Candela)}
#'
#' International Workshop on Data Mining for Online Advertising (ADKDD) - August 24, 2014
#'
#' \url{https://research.fb.com/publications/practical-lessons-from-predicting-clicks-on-ads-at-facebook/}.
#'
#' Extract explaining the method:
#'
#' "We found that boosted decision trees are a powerful and very
#' convenient way to implement non-linear and tuple transformations
#' of the kind we just described. We treat each individual
#' tree as a categorical feature that takes as value the
#' index of the leaf an instance ends up falling in. We use
#' 1-of-K coding of this type of features.
#'
#' For example, consider the boosted tree model in Figure 1 with 2 subtrees,
#' where the first subtree has 3 leafs and the second 2 leafs. If an
#' instance ends up in leaf 2 in the first subtree and leaf 1 in
#' second subtree, the overall input to the linear classifier will
#' be the binary vector \code{[0, 1, 0, 1, 0]}, where the first 3 entries
#' correspond to the leaves of the first subtree and last 2 to
#' those of the second subtree.
#'
#' [...]
#'
#' We can understand boosted decision tree
#' based transformation as a supervised feature encoding that
#' converts a real-valued vector into a compact binary-valued
#' vector. A traversal from root node to a leaf node represents
#' a rule on certain features."
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#' dtrain <- xgb.DMatrix(data = agaricus.train$data, label = agaricus.train$label)
#' dtest <- xgb.DMatrix(data = agaricus.test$data, label = agaricus.test$label)
#'
#' param <- list(max_depth=2, eta=1, silent=1, objective='binary:logistic')
#' nrounds = 4
#'
#' bst = xgb.train(params = param, data = dtrain, nrounds = nrounds, nthread = 2)
#'
#' # Model accuracy without new features
#' accuracy.before <- sum((predict(bst, agaricus.test$data) >= 0.5) == agaricus.test$label) /
#' length(agaricus.test$label)
#'
#' # Convert previous features to one hot encoding
#' new.features.train <- xgb.create.features(model = bst, agaricus.train$data)
#' new.features.test <- xgb.create.features(model = bst, agaricus.test$data)
#'
#' # learning with new features
#' new.dtrain <- xgb.DMatrix(data = new.features.train, label = agaricus.train$label)
#' new.dtest <- xgb.DMatrix(data = new.features.test, label = agaricus.test$label)
#' watchlist <- list(train = new.dtrain)
#' bst <- xgb.train(params = param, data = new.dtrain, nrounds = nrounds, nthread = 2)
#'
#' # Model accuracy with new features
#' accuracy.after <- sum((predict(bst, new.dtest) >= 0.5) == agaricus.test$label) /
#' length(agaricus.test$label)
#'
#' # Here the accuracy was already good and is now perfect.
#' cat(paste("The accuracy was", accuracy.before, "before adding leaf features and it is now",
#' accuracy.after, "!\n"))
#'
#' @export
xgb.create.features <- function(model, data, ...){
check.deprecation(...)
pred_with_leaf <- predict(model, data, predleaf = TRUE)
cols <- lapply(as.data.frame(pred_with_leaf), factor)
cbind(data, sparse.model.matrix( ~ . -1, cols))
}

305
R-package/R/xgb.cv.R Normal file
View File

@@ -0,0 +1,305 @@
#' Cross Validation
#'
#' The cross validation function of xgboost
#'
#' @param params the list of parameters. Commonly used ones are:
#' \itemize{
#' \item \code{objective} objective function, common ones are
#' \itemize{
#' \item \code{reg:squarederror} Regression with squared loss
#' \item \code{binary:logistic} logistic regression for classification
#' }
#' \item \code{eta} step size of each boosting step
#' \item \code{max_depth} maximum depth of the tree
#' \item \code{nthread} number of thread used in training, if not set, all threads are used
#' }
#'
#' See \code{\link{xgb.train}} for further details.
#' See also demo/ for walkthrough example in R.
#' @param data takes an \code{xgb.DMatrix}, \code{matrix}, or \code{dgCMatrix} as the input.
#' @param nrounds the max number of iterations
#' @param nfold the original dataset is randomly partitioned into \code{nfold} equal size subsamples.
#' @param label vector of response values. Should be provided only when data is an R-matrix.
#' @param missing is only used when input is a dense matrix. By default is set to NA, which means
#' that NA values should be considered as 'missing' by the algorithm.
#' Sometimes, 0 or other extreme value might be used to represent missing values.
#' @param prediction A logical value indicating whether to return the test fold predictions
#' from each CV model. This parameter engages the \code{\link{cb.cv.predict}} callback.
#' @param showsd \code{boolean}, whether to show standard deviation of cross validation
#' @param metrics, list of evaluation metrics to be used in cross validation,
#' when it is not specified, the evaluation metric is chosen according to objective function.
#' Possible options are:
#' \itemize{
#' \item \code{error} binary classification error rate
#' \item \code{rmse} Rooted mean square error
#' \item \code{logloss} negative log-likelihood function
#' \item \code{auc} Area under curve
#' \item \code{aucpr} Area under PR curve
#' \item \code{merror} Exact matching error, used to evaluate multi-class classification
#' }
#' @param obj customized objective function. Returns gradient and second order
#' gradient with given prediction and dtrain.
#' @param feval customized evaluation function. Returns
#' \code{list(metric='metric-name', value='metric-value')} with given
#' prediction and dtrain.
#' @param stratified a \code{boolean} indicating whether sampling of folds should be stratified
#' by the values of outcome labels.
#' @param folds \code{list} provides a possibility to use a list of pre-defined CV folds
#' (each element must be a vector of test fold's indices). When folds are supplied,
#' the \code{nfold} and \code{stratified} parameters are ignored.
#' @param verbose \code{boolean}, print the statistics during the process
#' @param print_every_n Print each n-th iteration evaluation messages when \code{verbose>0}.
#' Default is 1 which means all messages are printed. This parameter is passed to the
#' \code{\link{cb.print.evaluation}} callback.
#' @param early_stopping_rounds If \code{NULL}, the early stopping function is not triggered.
#' If set to an integer \code{k}, training with a validation set will stop if the performance
#' doesn't improve for \code{k} rounds.
#' Setting this parameter engages the \code{\link{cb.early.stop}} callback.
#' @param maximize If \code{feval} and \code{early_stopping_rounds} are set,
#' then this parameter must be set as well.
#' When it is \code{TRUE}, it means the larger the evaluation score the better.
#' This parameter is passed to the \code{\link{cb.early.stop}} callback.
#' @param callbacks a list of callback functions to perform various task during boosting.
#' See \code{\link{callbacks}}. Some of the callbacks are automatically created depending on the
#' parameters' values. User can provide either existing or their own callback methods in order
#' to customize the training process.
#' @param ... other parameters to pass to \code{params}.
#'
#' @details
#' The original sample is randomly partitioned into \code{nfold} equal size subsamples.
#'
#' Of the \code{nfold} subsamples, a single subsample is retained as the validation data for testing the model, and the remaining \code{nfold - 1} subsamples are used as training data.
#'
#' The cross-validation process is then repeated \code{nrounds} times, with each of the \code{nfold} subsamples used exactly once as the validation data.
#'
#' All observations are used for both training and validation.
#'
#' Adapted from \url{http://en.wikipedia.org/wiki/Cross-validation_\%28statistics\%29#k-fold_cross-validation}
#'
#' @return
#' An object of class \code{xgb.cv.synchronous} with the following elements:
#' \itemize{
#' \item \code{call} a function call.
#' \item \code{params} parameters that were passed to the xgboost library. Note that it does not
#' capture parameters changed by the \code{\link{cb.reset.parameters}} callback.
#' \item \code{callbacks} callback functions that were either automatically assigned or
#' explicitly passed.
#' \item \code{evaluation_log} evaluation history stored as a \code{data.table} with the
#' first column corresponding to iteration number and the rest corresponding to the
#' CV-based evaluation means and standard deviations for the training and test CV-sets.
#' It is created by the \code{\link{cb.evaluation.log}} callback.
#' \item \code{niter} number of boosting iterations.
#' \item \code{nfeatures} number of features in training data.
#' \item \code{folds} the list of CV folds' indices - either those passed through the \code{folds}
#' parameter or randomly generated.
#' \item \code{best_iteration} iteration number with the best evaluation metric value
#' (only available with early stopping).
#' \item \code{best_ntreelimit} the \code{ntreelimit} value corresponding to the best iteration,
#' which could further be used in \code{predict} method
#' (only available with early stopping).
#' \item \code{pred} CV prediction values available when \code{prediction} is set.
#' It is either vector or matrix (see \code{\link{cb.cv.predict}}).
#' \item \code{models} a liost of the CV folds' models. It is only available with the explicit
#' setting of the \code{cb.cv.predict(save_models = TRUE)} callback.
#' }
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
#' cv <- xgb.cv(data = dtrain, nrounds = 3, nthread = 2, nfold = 5, metrics = list("rmse","auc"),
#' max_depth = 3, eta = 1, objective = "binary:logistic")
#' print(cv)
#' print(cv, verbose=TRUE)
#'
#' @export
xgb.cv <- function(params=list(), data, nrounds, nfold, label = NULL, missing = NA,
prediction = FALSE, showsd = TRUE, metrics=list(),
obj = NULL, feval = NULL, stratified = TRUE, folds = NULL,
verbose = TRUE, print_every_n=1L,
early_stopping_rounds = NULL, maximize = NULL, callbacks = list(), ...) {
check.deprecation(...)
params <- check.booster.params(params, ...)
# TODO: should we deprecate the redundant 'metrics' parameter?
for (m in metrics)
params <- c(params, list("eval_metric" = m))
check.custom.obj()
check.custom.eval()
#if (is.null(params[['eval_metric']]) && is.null(feval))
# stop("Either 'eval_metric' or 'feval' must be provided for CV")
# Check the labels
if ( (inherits(data, 'xgb.DMatrix') && is.null(getinfo(data, 'label'))) ||
(!inherits(data, 'xgb.DMatrix') && is.null(label)))
stop("Labels must be provided for CV either through xgb.DMatrix, or through 'label=' when 'data' is matrix")
# CV folds
if(!is.null(folds)) {
if(!is.list(folds) || length(folds) < 2)
stop("'folds' must be a list with 2 or more elements that are vectors of indices for each CV-fold")
nfold <- length(folds)
} else {
if (nfold <= 1)
stop("'nfold' must be > 1")
folds <- generate.cv.folds(nfold, nrow(data), stratified, label, params)
}
# Potential TODO: sequential CV
#if (strategy == 'sequential')
# stop('Sequential CV strategy is not yet implemented')
# verbosity & evaluation printing callback:
params <- c(params, list(silent = 1))
print_every_n <- max( as.integer(print_every_n), 1L)
if (!has.callbacks(callbacks, 'cb.print.evaluation') && verbose) {
callbacks <- add.cb(callbacks, cb.print.evaluation(print_every_n, showsd = showsd))
}
# evaluation log callback: always is on in CV
evaluation_log <- list()
if (!has.callbacks(callbacks, 'cb.evaluation.log')) {
callbacks <- add.cb(callbacks, cb.evaluation.log())
}
# Early stopping callback
stop_condition <- FALSE
if (!is.null(early_stopping_rounds) &&
!has.callbacks(callbacks, 'cb.early.stop')) {
callbacks <- add.cb(callbacks, cb.early.stop(early_stopping_rounds,
maximize = maximize, verbose = verbose))
}
# CV-predictions callback
if (prediction &&
!has.callbacks(callbacks, 'cb.cv.predict')) {
callbacks <- add.cb(callbacks, cb.cv.predict(save_models = FALSE))
}
# Sort the callbacks into categories
cb <- categorize.callbacks(callbacks)
# create the booster-folds
dall <- xgb.get.DMatrix(data, label, missing)
bst_folds <- lapply(seq_along(folds), function(k) {
dtest <- slice(dall, folds[[k]])
dtrain <- slice(dall, unlist(folds[-k]))
handle <- xgb.Booster.handle(params, list(dtrain, dtest))
list(dtrain = dtrain, bst = handle, watchlist = list(train = dtrain, test=dtest), index = folds[[k]])
})
rm(dall)
# a "basket" to collect some results from callbacks
basket <- list()
# extract parameters that can affect the relationship b/w #trees and #iterations
num_class <- max(as.numeric(NVL(params[['num_class']], 1)), 1)
num_parallel_tree <- max(as.numeric(NVL(params[['num_parallel_tree']], 1)), 1)
# those are fixed for CV (no training continuation)
begin_iteration <- 1
end_iteration <- nrounds
# synchronous CV boosting: run CV folds' models within each iteration
for (iteration in begin_iteration:end_iteration) {
for (f in cb$pre_iter) f()
msg <- lapply(bst_folds, function(fd) {
xgb.iter.update(fd$bst, fd$dtrain, iteration - 1, obj)
xgb.iter.eval(fd$bst, fd$watchlist, iteration - 1, feval)
})
msg <- simplify2array(msg)
bst_evaluation <- rowMeans(msg)
bst_evaluation_err <- sqrt(rowMeans(msg^2) - bst_evaluation^2)
for (f in cb$post_iter) f()
if (stop_condition) break
}
for (f in cb$finalize) f(finalize = TRUE)
# the CV result
ret <- list(
call = match.call(),
params = params,
callbacks = callbacks,
evaluation_log = evaluation_log,
niter = end_iteration,
nfeatures = ncol(data),
folds = folds
)
ret <- c(ret, basket)
class(ret) <- 'xgb.cv.synchronous'
invisible(ret)
}
#' Print xgb.cv result
#'
#' Prints formatted results of \code{xgb.cv}.
#'
#' @param x an \code{xgb.cv.synchronous} object
#' @param verbose whether to print detailed data
#' @param ... passed to \code{data.table.print}
#'
#' @details
#' When not verbose, it would only print the evaluation results,
#' including the best iteration (when available).
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' train <- agaricus.train
#' cv <- xgb.cv(data = train$data, label = train$label, nfold = 5, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#' print(cv)
#' print(cv, verbose=TRUE)
#'
#' @rdname print.xgb.cv
#' @method print xgb.cv.synchronous
#' @export
print.xgb.cv.synchronous <- function(x, verbose = FALSE, ...) {
cat('##### xgb.cv ', length(x$folds), '-folds\n', sep = '')
if (verbose) {
if (!is.null(x$call)) {
cat('call:\n ')
print(x$call)
}
if (!is.null(x$params)) {
cat('params (as set within xgb.cv):\n')
cat( ' ',
paste(names(x$params),
paste0('"', unlist(x$params), '"'),
sep = ' = ', collapse = ', '), '\n', sep = '')
}
if (!is.null(x$callbacks) && length(x$callbacks) > 0) {
cat('callbacks:\n')
lapply(callback.calls(x$callbacks), function(x) {
cat(' ')
print(x)
})
}
for (n in c('niter', 'best_iteration', 'best_ntreelimit')) {
if (is.null(x[[n]]))
next
cat(n, ': ', x[[n]], '\n', sep = '')
}
if (!is.null(x$pred)) {
cat('pred:\n')
str(x$pred)
}
}
if (verbose)
cat('evaluation_log:\n')
print(x$evaluation_log, row.names = FALSE, ...)
if (!is.null(x$best_iteration)) {
cat('Best iteration:\n')
print(x$evaluation_log[x$best_iteration], row.names = FALSE, ...)
}
invisible(x)
}

72
R-package/R/xgb.dump.R Normal file
View File

@@ -0,0 +1,72 @@
#' Dump an xgboost model in text format.
#'
#' Dump an xgboost model in text format.
#'
#' @param model the model object.
#' @param fname the name of the text file where to save the model text dump.
#' If not provided or set to \code{NULL}, the model is returned as a \code{character} vector.
#' @param fmap feature map file representing feature types.
#' Detailed description could be found at
#' \url{https://github.com/dmlc/xgboost/wiki/Binary-Classification#dump-model}.
#' See demo/ for walkthrough example in R, and
#' \url{https://github.com/dmlc/xgboost/blob/master/demo/data/featmap.txt}
#' for example Format.
#' @param with_stats whether to dump some additional statistics about the splits.
#' When this option is on, the model dump contains two additional values:
#' gain is the approximate loss function gain we get in each split;
#' cover is the sum of second order gradient in each node.
#' @param dump_format either 'text' or 'json' format could be specified.
#' @param ... currently not used
#'
#' @return
#' If fname is not provided or set to \code{NULL} the function will return the model
#' as a \code{character} vector. Otherwise it will return \code{TRUE}.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#' train <- agaricus.train
#' test <- agaricus.test
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#' # save the model in file 'xgb.model.dump'
#' dump_path = file.path(tempdir(), 'model.dump')
#' xgb.dump(bst, dump_path, with_stats = TRUE)
#'
#' # print the model without saving it to a file
#' print(xgb.dump(bst, with_stats = TRUE))
#'
#' # print in JSON format:
#' cat(xgb.dump(bst, with_stats = TRUE, dump_format='json'))
#'
#' @export
xgb.dump <- function(model, fname = NULL, fmap = "", with_stats=FALSE,
dump_format = c("text", "json"), ...) {
check.deprecation(...)
dump_format <- match.arg(dump_format)
if (!inherits(model, "xgb.Booster"))
stop("model: argument must be of type xgb.Booster")
if (!(is.null(fname) || is.character(fname)))
stop("fname: argument must be a character string (when provided)")
if (!(is.null(fmap) || is.character(fmap)))
stop("fmap: argument must be a character string (when provided)")
model <- xgb.Booster.complete(model)
model_dump <- .Call(XGBoosterDumpModel_R, model$handle, NVL(fmap, "")[1], as.integer(with_stats),
as.character(dump_format))
if (is.null(fname))
model_dump <- stri_replace_all_regex(model_dump, '\t', '')
if (dump_format == "text")
model_dump <- unlist(stri_split_regex(model_dump, '\n'))
model_dump <- grep('^\\s*$', model_dump, invert = TRUE, value = TRUE)
if (is.null(fname)) {
return(model_dump)
} else {
writeLines(model_dump, fname[1])
return(TRUE)
}
}

135
R-package/R/xgb.ggplot.R Normal file
View File

@@ -0,0 +1,135 @@
# ggplot backend for the xgboost plotting facilities
#' @rdname xgb.plot.importance
#' @export
xgb.ggplot.importance <- function(importance_matrix = NULL, top_n = NULL, measure = NULL,
rel_to_first = FALSE, n_clusters = c(1:10), ...) {
importance_matrix <- xgb.plot.importance(importance_matrix, top_n = top_n, measure = measure,
rel_to_first = rel_to_first, plot = FALSE, ...)
if (!requireNamespace("ggplot2", quietly = TRUE)) {
stop("ggplot2 package is required", call. = FALSE)
}
if (!requireNamespace("Ckmeans.1d.dp", quietly = TRUE)) {
stop("Ckmeans.1d.dp package is required", call. = FALSE)
}
clusters <- suppressWarnings(
Ckmeans.1d.dp::Ckmeans.1d.dp(importance_matrix$Importance, n_clusters)
)
importance_matrix[, Cluster := as.character(clusters$cluster)]
plot <-
ggplot2::ggplot(importance_matrix,
ggplot2::aes(x = factor(Feature, levels = rev(Feature)), y = Importance, width = 0.5),
environment = environment()) +
ggplot2::geom_bar(ggplot2::aes(fill = Cluster), stat = "identity", position = "identity") +
ggplot2::coord_flip() +
ggplot2::xlab("Features") +
ggplot2::ggtitle("Feature importance") +
ggplot2::theme(plot.title = ggplot2::element_text(lineheight = .9, face = "bold"),
panel.grid.major.y = ggplot2::element_blank())
return(plot)
}
#' @rdname xgb.plot.deepness
#' @export
xgb.ggplot.deepness <- function(model = NULL, which = c("2x1", "max.depth", "med.depth", "med.weight")) {
if (!requireNamespace("ggplot2", quietly = TRUE))
stop("ggplot2 package is required for plotting the graph deepness.", call. = FALSE)
which <- match.arg(which)
dt_depths <- xgb.plot.deepness(model = model, plot = FALSE)
dt_summaries <- dt_depths[, .(.N, Cover = mean(Cover)), Depth]
setkey(dt_summaries, 'Depth')
if (which == "2x1") {
p1 <-
ggplot2::ggplot(dt_summaries) +
ggplot2::geom_bar(ggplot2::aes(x = Depth, y = N), stat = "Identity") +
ggplot2::xlab("") +
ggplot2::ylab("Number of leafs") +
ggplot2::ggtitle("Model complexity") +
ggplot2::theme(
plot.title = ggplot2::element_text(lineheight = 0.9, face = "bold"),
panel.grid.major.y = ggplot2::element_blank(),
axis.ticks = ggplot2::element_blank(),
axis.text.x = ggplot2::element_blank()
)
p2 <-
ggplot2::ggplot(dt_summaries) +
ggplot2::geom_bar(ggplot2::aes(x = Depth, y = Cover), stat = "Identity") +
ggplot2::xlab("Leaf depth") +
ggplot2::ylab("Weighted cover")
multiplot(p1, p2, cols = 1)
return(invisible(list(p1, p2)))
} else if (which == "max.depth") {
p <-
ggplot2::ggplot(dt_depths[, max(Depth), Tree]) +
ggplot2::geom_jitter(ggplot2::aes(x = Tree, y = V1),
height = 0.15, alpha=0.4, size=3, stroke=0) +
ggplot2::xlab("tree #") +
ggplot2::ylab("Max tree leaf depth")
return(p)
} else if (which == "med.depth") {
p <-
ggplot2::ggplot(dt_depths[, median(as.numeric(Depth)), Tree]) +
ggplot2::geom_jitter(ggplot2::aes(x = Tree, y = V1),
height = 0.15, alpha=0.4, size=3, stroke=0) +
ggplot2::xlab("tree #") +
ggplot2::ylab("Median tree leaf depth")
return(p)
} else if (which == "med.weight") {
p <-
ggplot2::ggplot(dt_depths[, median(abs(Weight)), Tree]) +
ggplot2::geom_point(ggplot2::aes(x = Tree, y = V1),
alpha=0.4, size=3, stroke=0) +
ggplot2::xlab("tree #") +
ggplot2::ylab("Median absolute leaf weight")
return(p)
}
}
# Plot multiple ggplot graph aligned by rows and columns.
# ... the plots
# cols number of columns
# internal utility function
multiplot <- function(..., cols = 1) {
plots <- list(...)
num_plots = length(plots)
layout <- matrix(seq(1, cols * ceiling(num_plots / cols)),
ncol = cols, nrow = ceiling(num_plots / cols))
if (num_plots == 1) {
print(plots[[1]])
} else {
grid::grid.newpage()
grid::pushViewport(grid::viewport(layout = grid::grid.layout(nrow(layout), ncol(layout))))
for (i in 1:num_plots) {
# Get the i,j matrix positions of the regions that contain this subplot
matchidx <- as.data.table(which(layout == i, arr.ind = TRUE))
print(
plots[[i]], vp = grid::viewport(
layout.pos.row = matchidx$row,
layout.pos.col = matchidx$col
)
)
}
}
}
globalVariables(c(
"Cluster", "ggplot", "aes", "geom_bar", "coord_flip", "xlab", "ylab", "ggtitle", "theme",
"element_blank", "element_text", "V1", "Weight"
))

View File

@@ -0,0 +1,139 @@
#' Importance of features in a model.
#'
#' Creates a \code{data.table} of feature importances in a model.
#'
#' @param feature_names character vector of feature names. If the model already
#' contains feature names, those would be used when \code{feature_names=NULL} (default value).
#' Non-null \code{feature_names} could be provided to override those in the model.
#' @param model object of class \code{xgb.Booster}.
#' @param trees (only for the gbtree booster) an integer vector of tree indices that should be included
#' into the importance calculation. If set to \code{NULL}, all trees of the model are parsed.
#' It could be useful, e.g., in multiclass classification to get feature importances
#' for each class separately. IMPORTANT: the tree index in xgboost models
#' is zero-based (e.g., use \code{trees = 0:4} for first 5 trees).
#' @param data deprecated.
#' @param label deprecated.
#' @param target deprecated.
#'
#' @details
#'
#' This function works for both linear and tree models.
#'
#' For linear models, the importance is the absolute magnitude of linear coefficients.
#' For that reason, in order to obtain a meaningful ranking by importance for a linear model,
#' the features need to be on the same scale (which you also would want to do when using either
#' L1 or L2 regularization).
#'
#' @return
#'
#' For a tree model, a \code{data.table} with the following columns:
#' \itemize{
#' \item \code{Features} names of the features used in the model;
#' \item \code{Gain} represents fractional contribution of each feature to the model based on
#' the total gain of this feature's splits. Higher percentage means a more important
#' predictive feature.
#' \item \code{Cover} metric of the number of observation related to this feature;
#' \item \code{Frequency} percentage representing the relative number of times
#' a feature have been used in trees.
#' }
#'
#' A linear model's importance \code{data.table} has the following columns:
#' \itemize{
#' \item \code{Features} names of the features used in the model;
#' \item \code{Weight} the linear coefficient of this feature;
#' \item \code{Class} (only for multiclass models) class label.
#' }
#'
#' If \code{feature_names} is not provided and \code{model} doesn't have \code{feature_names},
#' index of the features will be used instead. Because the index is extracted from the model dump
#' (based on C++ code), it starts at 0 (as in C/C++ or Python) instead of 1 (usual in R).
#'
#' @examples
#'
#' # binomial classification using gbtree:
#' data(agaricus.train, package='xgboost')
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#' xgb.importance(model = bst)
#'
#' # binomial classification using gblinear:
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, booster = "gblinear",
#' eta = 0.3, nthread = 1, nrounds = 20, objective = "binary:logistic")
#' xgb.importance(model = bst)
#'
#' # multiclass classification using gbtree:
#' nclass <- 3
#' nrounds <- 10
#' mbst <- xgboost(data = as.matrix(iris[, -5]), label = as.numeric(iris$Species) - 1,
#' max_depth = 3, eta = 0.2, nthread = 2, nrounds = nrounds,
#' objective = "multi:softprob", num_class = nclass)
#' # all classes clumped together:
#' xgb.importance(model = mbst)
#' # inspect importances separately for each class:
#' xgb.importance(model = mbst, trees = seq(from=0, by=nclass, length.out=nrounds))
#' xgb.importance(model = mbst, trees = seq(from=1, by=nclass, length.out=nrounds))
#' xgb.importance(model = mbst, trees = seq(from=2, by=nclass, length.out=nrounds))
#'
#' # multiclass classification using gblinear:
#' mbst <- xgboost(data = scale(as.matrix(iris[, -5])), label = as.numeric(iris$Species) - 1,
#' booster = "gblinear", eta = 0.2, nthread = 1, nrounds = 15,
#' objective = "multi:softprob", num_class = nclass)
#' xgb.importance(model = mbst)
#'
#' @export
xgb.importance <- function(feature_names = NULL, model = NULL, trees = NULL,
data = NULL, label = NULL, target = NULL){
if (!(is.null(data) && is.null(label) && is.null(target)))
warning("xgb.importance: parameters 'data', 'label' and 'target' are deprecated")
if (!inherits(model, "xgb.Booster"))
stop("model: must be an object of class xgb.Booster")
if (is.null(feature_names) && !is.null(model$feature_names))
feature_names <- model$feature_names
if (!(is.null(feature_names) || is.character(feature_names)))
stop("feature_names: Has to be a character vector")
model_text_dump <- xgb.dump(model = model, with_stats = TRUE)
# linear model
if(model_text_dump[2] == "bias:"){
weights <- which(model_text_dump == "weight:") %>%
{model_text_dump[(. + 1):length(model_text_dump)]} %>%
as.numeric
num_class <- NVL(model$params$num_class, 1)
if(is.null(feature_names))
feature_names <- seq(to = length(weights) / num_class) - 1
if (length(feature_names) * num_class != length(weights))
stop("feature_names length does not match the number of features used in the model")
result <- if (num_class == 1) {
data.table(Feature = feature_names, Weight = weights)[order(-abs(Weight))]
} else {
data.table(Feature = rep(feature_names, each = num_class),
Weight = weights,
Class = seq_len(num_class) - 1)[order(Class, -abs(Weight))]
}
} else {
# tree model
result <- xgb.model.dt.tree(feature_names = feature_names,
text = model_text_dump,
trees = trees)[
Feature != "Leaf", .(Gain = sum(Quality),
Cover = sum(Cover),
Frequency = .N), by = Feature][
,`:=`(Gain = Gain / sum(Gain),
Cover = Cover / sum(Cover),
Frequency = Frequency / sum(Frequency))][
order(Gain, decreasing = TRUE)]
}
result
}
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(c(".", ".N", "Gain", "Cover", "Frequency", "Feature", "Class"))

47
R-package/R/xgb.load.R Normal file
View File

@@ -0,0 +1,47 @@
#' Load xgboost model from binary file
#'
#' Load xgboost model from the binary model file.
#'
#' @param modelfile the name of the binary input file.
#'
#' @details
#' The input file is expected to contain a model saved in an xgboost-internal binary format
#' using either \code{\link{xgb.save}} or \code{\link{cb.save.model}} in R, or using some
#' appropriate methods from other xgboost interfaces. E.g., a model trained in Python and
#' saved from there in xgboost format, could be loaded from R.
#'
#' Note: a model saved as an R-object, has to be loaded using corresponding R-methods,
#' not \code{xgb.load}.
#'
#' @return
#' An object of \code{xgb.Booster} class.
#'
#' @seealso
#' \code{\link{xgb.save}}, \code{\link{xgb.Booster.complete}}.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#' train <- agaricus.train
#' test <- agaricus.test
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
#' xgb.save(bst, 'xgb.model')
#' bst <- xgb.load('xgb.model')
#' if (file.exists('xgb.model')) file.remove('xgb.model')
#' pred <- predict(bst, test$data)
#' @export
xgb.load <- function(modelfile) {
if (is.null(modelfile))
stop("xgb.load: modelfile cannot be NULL")
handle <- xgb.Booster.handle(modelfile = modelfile)
# re-use modelfile if it is raw so we do not need to serialize
if (typeof(modelfile) == "raw") {
bst <- xgb.handleToBooster(handle, modelfile)
} else {
bst <- xgb.handleToBooster(handle, NULL)
}
bst <- xgb.Booster.complete(bst, saveraw = TRUE)
return(bst)
}

View File

@@ -0,0 +1,159 @@
#' Parse a boosted tree model text dump
#'
#' Parse a boosted tree model text dump into a \code{data.table} structure.
#'
#' @param feature_names character vector of feature names. If the model already
#' contains feature names, those would be used when \code{feature_names=NULL} (default value).
#' Non-null \code{feature_names} could be provided to override those in the model.
#' @param model object of class \code{xgb.Booster}
#' @param text \code{character} vector previously generated by the \code{xgb.dump}
#' function (where parameter \code{with_stats = TRUE} should have been set).
#' \code{text} takes precedence over \code{model}.
#' @param trees an integer vector of tree indices that should be parsed.
#' If set to \code{NULL}, all trees of the model are parsed.
#' It could be useful, e.g., in multiclass classification to get only
#' the trees of one certain class. IMPORTANT: the tree index in xgboost models
#' is zero-based (e.g., use \code{trees = 0:4} for first 5 trees).
#' @param use_int_id a logical flag indicating whether nodes in columns "Yes", "No", "Missing" should be
#' represented as integers (when FALSE) or as "Tree-Node" character strings (when FALSE).
#' @param ... currently not used.
#'
#' @return
#' A \code{data.table} with detailed information about model trees' nodes.
#'
#' The columns of the \code{data.table} are:
#'
#' \itemize{
#' \item \code{Tree}: integer ID of a tree in a model (zero-based index)
#' \item \code{Node}: integer ID of a node in a tree (zero-based index)
#' \item \code{ID}: character identifier of a node in a model (only when \code{use_int_id=FALSE})
#' \item \code{Feature}: for a branch node, it's a feature id or name (when available);
#' for a leaf note, it simply labels it as \code{'Leaf'}
#' \item \code{Split}: location of the split for a branch node (split condition is always "less than")
#' \item \code{Yes}: ID of the next node when the split condition is met
#' \item \code{No}: ID of the next node when the split condition is not met
#' \item \code{Missing}: ID of the next node when branch value is missing
#' \item \code{Quality}: either the split gain (change in loss) or the leaf value
#' \item \code{Cover}: metric related to the number of observation either seen by a split
#' or collected by a leaf during training.
#' }
#'
#' When \code{use_int_id=FALSE}, columns "Yes", "No", and "Missing" point to model-wide node identifiers
#' in the "ID" column. When \code{use_int_id=TRUE}, those columns point to node identifiers from
#' the corresponding trees in the "Node" column.
#'
#' @examples
#' # Basic use:
#'
#' data(agaricus.train, package='xgboost')
#'
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
#'
#' (dt <- xgb.model.dt.tree(colnames(agaricus.train$data), bst))
#'
#' # This bst model already has feature_names stored with it, so those would be used when
#' # feature_names is not set:
#' (dt <- xgb.model.dt.tree(model = bst))
#'
#' # How to match feature names of splits that are following a current 'Yes' branch:
#'
#' merge(dt, dt[, .(ID, Y.Feature=Feature)], by.x='Yes', by.y='ID', all.x=TRUE)[order(Tree,Node)]
#'
#' @export
xgb.model.dt.tree <- function(feature_names = NULL, model = NULL, text = NULL,
trees = NULL, use_int_id = FALSE, ...){
check.deprecation(...)
if (!inherits(model, "xgb.Booster") && !is.character(text)) {
stop("Either 'model' must be an object of class xgb.Booster\n",
" or 'text' must be a character vector with the result of xgb.dump\n",
" (or NULL if 'model' was provided).")
}
if (is.null(feature_names) && !is.null(model) && !is.null(model$feature_names))
feature_names <- model$feature_names
if (!(is.null(feature_names) || is.character(feature_names))) {
stop("feature_names: must be a character vector")
}
if (!(is.null(trees) || is.numeric(trees))) {
stop("trees: must be a vector of integers.")
}
if (is.null(text)){
text <- xgb.dump(model = model, with_stats = TRUE)
}
if (length(text) < 2 ||
sum(stri_detect_regex(text, 'yes=(\\d+),no=(\\d+)')) < 1) {
stop("Non-tree model detected! This function can only be used with tree models.")
}
position <- which(!is.na(stri_match_first_regex(text, "booster")))
add.tree.id <- function(node, tree) if (use_int_id) node else paste(tree, node, sep = "-")
anynumber_regex <- "[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?"
td <- data.table(t = text)
td[position, Tree := 1L]
td[, Tree := cumsum(ifelse(is.na(Tree), 0L, Tree)) - 1L]
if (is.null(trees)) {
trees <- 0:max(td$Tree)
} else {
trees <- trees[trees >= 0 & trees <= max(td$Tree)]
}
td <- td[Tree %in% trees & !grepl('^booster', t)]
td[, Node := stri_match_first_regex(t, "(\\d+):")[,2] %>% as.integer ]
if (!use_int_id) td[, ID := add.tree.id(Node, Tree)]
td[, isLeaf := !is.na(stri_match_first_regex(t, "leaf"))]
# parse branch lines
branch_rx <- paste0("f(\\d+)<(", anynumber_regex, ")\\] yes=(\\d+),no=(\\d+),missing=(\\d+),",
"gain=(", anynumber_regex, "),cover=(", anynumber_regex, ")")
branch_cols <- c("Feature", "Split", "Yes", "No", "Missing", "Quality", "Cover")
td[isLeaf == FALSE,
(branch_cols) := {
# skip some indices with spurious capture groups from anynumber_regex
xtr <- stri_match_first_regex(t, branch_rx)[, c(2,3,5,6,7,8,10), drop = FALSE]
xtr[, 3:5] <- add.tree.id(xtr[, 3:5], Tree)
lapply(seq_len(ncol(xtr)), function(i) xtr[,i])
}]
# assign feature_names when available
if (!is.null(feature_names)) {
if (length(feature_names) <= max(as.numeric(td$Feature), na.rm = TRUE))
stop("feature_names has less elements than there are features used in the model")
td[isLeaf == FALSE, Feature := feature_names[as.numeric(Feature) + 1] ]
}
# parse leaf lines
leaf_rx <- paste0("leaf=(", anynumber_regex, "),cover=(", anynumber_regex, ")")
leaf_cols <- c("Feature", "Quality", "Cover")
td[isLeaf == TRUE,
(leaf_cols) := {
xtr <- stri_match_first_regex(t, leaf_rx)[, c(2,4)]
c("Leaf", lapply(seq_len(ncol(xtr)), function(i) xtr[,i]))
}]
# convert some columns to numeric
numeric_cols <- c("Split", "Quality", "Cover")
td[, (numeric_cols) := lapply(.SD, as.numeric), .SDcols = numeric_cols]
if (use_int_id) {
int_cols <- c("Yes", "No", "Missing")
td[, (int_cols) := lapply(.SD, as.integer), .SDcols = int_cols]
}
td[, t := NULL]
td[, isLeaf := NULL]
td[order(Tree, Node)]
}
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(c("Tree", "Node", "ID", "Feature", "t", "isLeaf",".SD", ".SDcols"))

View File

@@ -0,0 +1,150 @@
#' Plot model trees deepness
#'
#' Visualizes distributions related to depth of tree leafs.
#' \code{xgb.plot.deepness} uses base R graphics, while \code{xgb.ggplot.deepness} uses the ggplot backend.
#'
#' @param model either an \code{xgb.Booster} model generated by the \code{xgb.train} function
#' or a data.table result of the \code{xgb.model.dt.tree} function.
#' @param plot (base R barplot) whether a barplot should be produced.
#' If FALSE, only a data.table is returned.
#' @param which which distribution to plot (see details).
#' @param ... other parameters passed to \code{barplot} or \code{plot}.
#'
#' @details
#'
#' When \code{which="2x1"}, two distributions with respect to the leaf depth
#' are plotted on top of each other:
#' \itemize{
#' \item the distribution of the number of leafs in a tree model at a certain depth;
#' \item the distribution of average weighted number of observations ("cover")
#' ending up in leafs at certain depth.
#' }
#' Those could be helpful in determining sensible ranges of the \code{max_depth}
#' and \code{min_child_weight} parameters.
#'
#' When \code{which="max.depth"} or \code{which="med.depth"}, plots of either maximum or median depth
#' per tree with respect to tree number are created. And \code{which="med.weight"} allows to see how
#' a tree's median absolute leaf weight changes through the iterations.
#'
#' This function was inspired by the blog post
#' \url{https://github.com/aysent/random-forest-leaf-visualization}.
#'
#' @return
#'
#' Other than producing plots (when \code{plot=TRUE}), the \code{xgb.plot.deepness} function
#' silently returns a processed data.table where each row corresponds to a terminal leaf in a tree model,
#' and contains information about leaf's depth, cover, and weight (which is used in calculating predictions).
#'
#' The \code{xgb.ggplot.deepness} silently returns either a list of two ggplot graphs when \code{which="2x1"}
#' or a single ggplot graph for the other \code{which} options.
#'
#' @seealso
#'
#' \code{\link{xgb.train}}, \code{\link{xgb.model.dt.tree}}.
#'
#' @examples
#'
#' data(agaricus.train, package='xgboost')
#'
#' # Change max_depth to a higher number to get a more significant result
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 6,
#' eta = 0.1, nthread = 2, nrounds = 50, objective = "binary:logistic",
#' subsample = 0.5, min_child_weight = 2)
#'
#' xgb.plot.deepness(bst)
#' xgb.ggplot.deepness(bst)
#'
#' xgb.plot.deepness(bst, which='max.depth', pch=16, col=rgb(0,0,1,0.3), cex=2)
#'
#' xgb.plot.deepness(bst, which='med.weight', pch=16, col=rgb(0,0,1,0.3), cex=2)
#'
#' @rdname xgb.plot.deepness
#' @export
xgb.plot.deepness <- function(model = NULL, which = c("2x1", "max.depth", "med.depth", "med.weight"),
plot = TRUE, ...) {
if (!(inherits(model, "xgb.Booster") || is.data.table(model)))
stop("model: Has to be either an xgb.Booster model generaged by the xgb.train function\n",
"or a data.table result of the xgb.importance function")
if (!requireNamespace("igraph", quietly = TRUE))
stop("igraph package is required for plotting the graph deepness.", call. = FALSE)
which <- match.arg(which)
dt_tree <- model
if (inherits(model, "xgb.Booster"))
dt_tree <- xgb.model.dt.tree(model = model)
if (!all(c("Feature", "Tree", "ID", "Yes", "No", "Cover") %in% colnames(dt_tree)))
stop("Model tree columns are not as expected!\n",
" Note that this function works only for tree models.")
dt_depths <- merge(get.leaf.depth(dt_tree), dt_tree[, .(ID, Cover, Weight = Quality)], by = "ID")
setkeyv(dt_depths, c("Tree", "ID"))
# count by depth levels, and also calculate average cover at a depth
dt_summaries <- dt_depths[, .(.N, Cover = mean(Cover)), Depth]
setkey(dt_summaries, "Depth")
if (plot) {
if (which == "2x1") {
op <- par(no.readonly = TRUE)
par(mfrow = c(2,1),
oma = c(3,1,3,1) + 0.1,
mar = c(1,4,1,0) + 0.1)
dt_summaries[, barplot(N, border = NA, ylab = 'Number of leafs', ...)]
dt_summaries[, barplot(Cover, border = NA, ylab = "Weighted cover", names.arg = Depth, ...)]
title("Model complexity", xlab = "Leaf depth", outer = TRUE, line = 1)
par(op)
} else if (which == "max.depth") {
dt_depths[, max(Depth), Tree][
, plot(jitter(V1, amount = 0.1) ~ Tree, ylab = 'Max tree leaf depth', xlab = "tree #", ...)]
} else if (which == "med.depth") {
dt_depths[, median(as.numeric(Depth)), Tree][
, plot(jitter(V1, amount = 0.1) ~ Tree, ylab = 'Median tree leaf depth', xlab = "tree #", ...)]
} else if (which == "med.weight") {
dt_depths[, median(abs(Weight)), Tree][
, plot(V1 ~ Tree, ylab = 'Median absolute leaf weight', xlab = "tree #", ...)]
}
}
invisible(dt_depths)
}
# Extract path depths from root to leaf
# from data.table containing the nodes and edges of the trees.
# internal utility function
get.leaf.depth <- function(dt_tree) {
# extract tree graph's edges
dt_edges <- rbindlist(list(
dt_tree[Feature != "Leaf", .(ID, To = Yes, Tree)],
dt_tree[Feature != "Leaf", .(ID, To = No, Tree)]
))
# whether "To" is a leaf:
dt_edges <-
merge(dt_edges,
dt_tree[Feature == "Leaf", .(ID, Leaf = TRUE)],
all.x = TRUE, by.x = "To", by.y = "ID")
dt_edges[is.na(Leaf), Leaf := FALSE]
dt_edges[, {
graph <- igraph::graph_from_data_frame(.SD[,.(ID, To)])
# min(ID) in a tree is a root node
paths_tmp <- igraph::shortest_paths(graph, from = min(ID), to = To[Leaf == TRUE])
# list of paths to each leaf in a tree
paths <- lapply(paths_tmp$vpath, names)
# combine into a resulting path lengths table for a tree
data.table(Depth = sapply(paths, length), ID = To[Leaf == TRUE])
}, by = Tree]
}
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(
c(
".N", "N", "Depth", "Quality", "Cover", "Tree", "ID", "Yes", "No", "Feature", "Leaf", "Weight"
)
)

View File

@@ -0,0 +1,125 @@
#' Plot feature importance as a bar graph
#'
#' Represents previously calculated feature importance as a bar graph.
#' \code{xgb.plot.importance} uses base R graphics, while \code{xgb.ggplot.importance} uses the ggplot backend.
#'
#' @param importance_matrix a \code{data.table} returned by \code{\link{xgb.importance}}.
#' @param top_n maximal number of top features to include into the plot.
#' @param measure the name of importance measure to plot.
#' When \code{NULL}, 'Gain' would be used for trees and 'Weight' would be used for gblinear.
#' @param rel_to_first whether importance values should be represented as relative to the highest ranked feature.
#' See Details.
#' @param left_margin (base R barplot) allows to adjust the left margin size to fit feature names.
#' When it is NULL, the existing \code{par('mar')} is used.
#' @param cex (base R barplot) passed as \code{cex.names} parameter to \code{barplot}.
#' @param plot (base R barplot) whether a barplot should be produced.
#' If FALSE, only a data.table is returned.
#' @param n_clusters (ggplot only) a \code{numeric} vector containing the min and the max range
#' of the possible number of clusters of bars.
#' @param ... other parameters passed to \code{barplot} (except horiz, border, cex.names, names.arg, and las).
#'
#' @details
#' The graph represents each feature as a horizontal bar of length proportional to the importance of a feature.
#' Features are shown ranked in a decreasing importance order.
#' It works for importances from both \code{gblinear} and \code{gbtree} models.
#'
#' When \code{rel_to_first = FALSE}, the values would be plotted as they were in \code{importance_matrix}.
#' For gbtree model, that would mean being normalized to the total of 1
#' ("what is feature's importance contribution relative to the whole model?").
#' For linear models, \code{rel_to_first = FALSE} would show actual values of the coefficients.
#' Setting \code{rel_to_first = TRUE} allows to see the picture from the perspective of
#' "what is feature's importance contribution relative to the most important feature?"
#'
#' The ggplot-backend method also performs 1-D clustering of the importance values,
#' with bar colors corresponding to different clusters that have somewhat similar importance values.
#'
#' @return
#' The \code{xgb.plot.importance} function creates a \code{barplot} (when \code{plot=TRUE})
#' and silently returns a processed data.table with \code{n_top} features sorted by importance.
#'
#' The \code{xgb.ggplot.importance} function returns a ggplot graph which could be customized afterwards.
#' E.g., to change the title of the graph, add \code{+ ggtitle("A GRAPH NAME")} to the result.
#'
#' @seealso
#' \code{\link[graphics]{barplot}}.
#'
#' @examples
#' data(agaricus.train)
#'
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 3,
#' eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
#'
#' importance_matrix <- xgb.importance(colnames(agaricus.train$data), model = bst)
#'
#' xgb.plot.importance(importance_matrix, rel_to_first = TRUE, xlab = "Relative importance")
#'
#' (gg <- xgb.ggplot.importance(importance_matrix, measure = "Frequency", rel_to_first = TRUE))
#' gg + ggplot2::ylab("Frequency")
#'
#' @rdname xgb.plot.importance
#' @export
xgb.plot.importance <- function(importance_matrix = NULL, top_n = NULL, measure = NULL,
rel_to_first = FALSE, left_margin = 10, cex = NULL, plot = TRUE, ...) {
check.deprecation(...)
if (!is.data.table(importance_matrix)) {
stop("importance_matrix: must be a data.table")
}
imp_names <- colnames(importance_matrix)
if (is.null(measure)) {
if (all(c("Feature", "Gain") %in% imp_names)) {
measure <- "Gain"
} else if (all(c("Feature", "Weight") %in% imp_names)) {
measure <- "Weight"
} else {
stop("Importance matrix column names are not as expected!")
}
} else {
if (!measure %in% imp_names)
stop("Invalid `measure`")
if (!"Feature" %in% imp_names)
stop("Importance matrix column names are not as expected!")
}
# also aggregate, just in case when the values were not yet summed up by feature
importance_matrix <- importance_matrix[, Importance := sum(get(measure)), by = Feature]
# make sure it's ordered
importance_matrix <- importance_matrix[order(-abs(Importance))]
if (!is.null(top_n)) {
top_n <- min(top_n, nrow(importance_matrix))
importance_matrix <- head(importance_matrix, top_n)
}
if (rel_to_first) {
importance_matrix[, Importance := Importance/max(abs(Importance))]
}
if (is.null(cex)) {
cex <- 2.5/log2(1 + nrow(importance_matrix))
}
if (plot) {
op <- par(no.readonly = TRUE)
mar <- op$mar
if (!is.null(left_margin))
mar[2] <- left_margin
par(mar = mar)
# reverse the order of rows to have the highest ranked at the top
importance_matrix[nrow(importance_matrix):1,
barplot(Importance, horiz = TRUE, border = NA, cex.names = cex,
names.arg = Feature, las = 1, ...)]
grid(NULL, NA)
# redraw over the grid
importance_matrix[nrow(importance_matrix):1,
barplot(Importance, horiz = TRUE, border = NA, add = TRUE)]
par(op)
}
invisible(importance_matrix)
}
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(c("Feature", "Importance"))

View File

@@ -0,0 +1,148 @@
#' Project all trees on one tree and plot it
#'
#' Visualization of the ensemble of trees as a single collective unit.
#'
#' @param model produced by the \code{xgb.train} function.
#' @param feature_names names of each feature as a \code{character} vector.
#' @param features_keep number of features to keep in each position of the multi trees.
#' @param plot_width width in pixels of the graph to produce
#' @param plot_height height in pixels of the graph to produce
#' @param render a logical flag for whether the graph should be rendered (see Value).
#' @param ... currently not used
#'
#' @details
#'
#' This function tries to capture the complexity of a gradient boosted tree model
#' in a cohesive way by compressing an ensemble of trees into a single tree-graph representation.
#' The goal is to improve the interpretability of a model generally seen as black box.
#'
#' Note: this function is applicable to tree booster-based models only.
#'
#' It takes advantage of the fact that the shape of a binary tree is only defined by
#' its depth (therefore, in a boosting model, all trees have similar shape).
#'
#' Moreover, the trees tend to reuse the same features.
#'
#' The function projects each tree onto one, and keeps for each position the
#' \code{features_keep} first features (based on the Gain per feature measure).
#'
#' This function is inspired by this blog post:
#' \url{https://wellecks.wordpress.com/2015/02/21/peering-into-the-black-box-visualizing-lambdamart/}
#'
#' @return
#'
#' When \code{render = TRUE}:
#' returns a rendered graph object which is an \code{htmlwidget} of class \code{grViz}.
#' Similar to ggplot objects, it needs to be printed to see it when not running from command line.
#'
#' When \code{render = FALSE}:
#' silently returns a graph object which is of DiagrammeR's class \code{dgr_graph}.
#' This could be useful if one wants to modify some of the graph attributes
#' before rendering the graph with \code{\link[DiagrammeR]{render_graph}}.
#'
#' @examples
#'
#' data(agaricus.train, package='xgboost')
#'
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 15,
#' eta = 1, nthread = 2, nrounds = 30, objective = "binary:logistic",
#' min_child_weight = 50, verbose = 0)
#'
#' p <- xgb.plot.multi.trees(model = bst, features_keep = 3)
#' print(p)
#'
#' \dontrun{
#' # Below is an example of how to save this plot to a file.
#' # Note that for `export_graph` to work, the DiagrammeRsvg and rsvg packages must also be installed.
#' library(DiagrammeR)
#' gr <- xgb.plot.multi.trees(model=bst, features_keep = 3, render=FALSE)
#' export_graph(gr, 'tree.pdf', width=1500, height=600)
#' }
#'
#' @export
xgb.plot.multi.trees <- function(model, feature_names = NULL, features_keep = 5, plot_width = NULL, plot_height = NULL,
render = TRUE, ...){
check.deprecation(...)
tree.matrix <- xgb.model.dt.tree(feature_names = feature_names, model = model)
# first number of the path represents the tree, then the following numbers are related to the path to follow
# root init
root.nodes <- tree.matrix[stri_detect_regex(ID, "\\d+-0"), ID]
tree.matrix[ID %in% root.nodes, abs.node.position := root.nodes]
precedent.nodes <- root.nodes
while(tree.matrix[,sum(is.na(abs.node.position))] > 0) {
yes.row.nodes <- tree.matrix[abs.node.position %in% precedent.nodes & !is.na(Yes)]
no.row.nodes <- tree.matrix[abs.node.position %in% precedent.nodes & !is.na(No)]
yes.nodes.abs.pos <- yes.row.nodes[, abs.node.position] %>% paste0("_0")
no.nodes.abs.pos <- no.row.nodes[, abs.node.position] %>% paste0("_1")
tree.matrix[ID %in% yes.row.nodes[, Yes], abs.node.position := yes.nodes.abs.pos]
tree.matrix[ID %in% no.row.nodes[, No], abs.node.position := no.nodes.abs.pos]
precedent.nodes <- c(yes.nodes.abs.pos, no.nodes.abs.pos)
}
tree.matrix[!is.na(Yes), Yes := paste0(abs.node.position, "_0")]
tree.matrix[!is.na(No), No := paste0(abs.node.position, "_1")]
remove.tree <- . %>% stri_replace_first_regex(pattern = "^\\d+-", replacement = "")
tree.matrix[,`:=`(abs.node.position = remove.tree(abs.node.position),
Yes = remove.tree(Yes),
No = remove.tree(No))]
nodes.dt <- tree.matrix[
, .(Quality = sum(Quality))
, by = .(abs.node.position, Feature)
][, .(Text = paste0(Feature[1:min(length(Feature), features_keep)],
" (",
format(Quality[1:min(length(Quality), features_keep)], digits=5),
")") %>%
paste0(collapse = "\n"))
, by = abs.node.position]
edges.dt <- tree.matrix[Feature != "Leaf", .(abs.node.position, Yes)] %>%
list(tree.matrix[Feature != "Leaf",.(abs.node.position, No)]) %>%
rbindlist() %>%
setnames(c("From", "To")) %>%
.[, .N, .(From, To)] %>%
.[, N:=NULL]
nodes <- DiagrammeR::create_node_df(
n = nrow(nodes.dt),
label = nodes.dt[,Text]
)
edges <- DiagrammeR::create_edge_df(
from = match(edges.dt[,From], nodes.dt[,abs.node.position]),
to = match(edges.dt[,To], nodes.dt[,abs.node.position]),
rel = "leading_to")
graph <- DiagrammeR::create_graph(
nodes_df = nodes,
edges_df = edges,
attr_theme = NULL
) %>%
DiagrammeR::add_global_graph_attrs(
attr_type = "graph",
attr = c("layout", "rankdir"),
value = c("dot", "LR")
) %>%
DiagrammeR::add_global_graph_attrs(
attr_type = "node",
attr = c("color", "fillcolor", "style", "shape", "fontname"),
value = c("DimGray", "beige", "filled", "rectangle", "Helvetica")
) %>%
DiagrammeR::add_global_graph_attrs(
attr_type = "edge",
attr = c("color", "arrowsize", "arrowhead", "fontname"),
value = c("DimGray", "1.5", "vee", "Helvetica"))
if (!render) return(invisible(graph))
DiagrammeR::render_graph(graph, width = plot_width, height = plot_height)
}
globalVariables(c(".N", "N", "From", "To", "Text", "Feature", "no.nodes.abs.pos",
"ID", "Yes", "No", "Tree", "yes.nodes.abs.pos", "abs.node.position"))

218
R-package/R/xgb.plot.shap.R Normal file
View File

@@ -0,0 +1,218 @@
#' SHAP contribution dependency plots
#'
#' Visualizing the SHAP feature contribution to prediction dependencies on feature value.
#'
#' @param data data as a \code{matrix} or \code{dgCMatrix}.
#' @param shap_contrib a matrix of SHAP contributions that was computed earlier for the above
#' \code{data}. When it is NULL, it is computed internally using \code{model} and \code{data}.
#' @param features a vector of either column indices or of feature names to plot. When it is NULL,
#' feature importance is calculated, and \code{top_n} high ranked features are taken.
#' @param top_n when \code{features} is NULL, top_n [1, 100] most important features in a model are taken.
#' @param model an \code{xgb.Booster} model. It has to be provided when either \code{shap_contrib}
#' or \code{features} is missing.
#' @param trees passed to \code{\link{xgb.importance}} when \code{features = NULL}.
#' @param target_class is only relevant for multiclass models. When it is set to a 0-based class index,
#' only SHAP contributions for that specific class are used.
#' If it is not set, SHAP importances are averaged over all classes.
#' @param approxcontrib passed to \code{\link{predict.xgb.Booster}} when \code{shap_contrib = NULL}.
#' @param subsample a random fraction of data points to use for plotting. When it is NULL,
#' it is set so that up to 100K data points are used.
#' @param n_col a number of columns in a grid of plots.
#' @param col color of the scatterplot markers.
#' @param pch scatterplot marker.
#' @param discrete_n_uniq a maximal number of unique values in a feature to consider it as discrete.
#' @param discrete_jitter an \code{amount} parameter of jitter added to discrete features' positions.
#' @param ylab a y-axis label in 1D plots.
#' @param plot_NA whether the contributions of cases with missing values should also be plotted.
#' @param col_NA a color of marker for missing value contributions.
#' @param pch_NA a marker type for NA values.
#' @param pos_NA a relative position of the x-location where NA values are shown:
#' \code{min(x) + (max(x) - min(x)) * pos_NA}.
#' @param plot_loess whether to plot loess-smoothed curves. The smoothing is only done for features with
#' more than 5 distinct values.
#' @param col_loess a color to use for the loess curves.
#' @param span_loess the \code{span} parameter in \code{\link[stats]{loess}}'s call.
#' @param which whether to do univariate or bivariate plotting. NOTE: only 1D is implemented so far.
#' @param plot whether a plot should be drawn. If FALSE, only a lits of matrices is returned.
#' @param ... other parameters passed to \code{plot}.
#'
#' @details
#'
#' These scatterplots represent how SHAP feature contributions depend of feature values.
#' The similarity to partial dependency plots is that they also give an idea for how feature values
#' affect predictions. However, in partial dependency plots, we usually see marginal dependencies
#' of model prediction on feature value, while SHAP contribution dependency plots display the estimated
#' contributions of a feature to model prediction for each individual case.
#'
#' When \code{plot_loess = TRUE} is set, feature values are rounded to 3 significant digits and
#' weighted LOESS is computed and plotted, where weights are the numbers of data points
#' at each rounded value.
#'
#' Note: SHAP contributions are shown on the scale of model margin. E.g., for a logistic binomial objective,
#' the margin is prediction before a sigmoidal transform into probability-like values.
#' Also, since SHAP stands for "SHapley Additive exPlanation" (model prediction = sum of SHAP
#' contributions for all features + bias), depending on the objective used, transforming SHAP
#' contributions for a feature from the marginal to the prediction space is not necessarily
#' a meaningful thing to do.
#'
#' @return
#'
#' In addition to producing plots (when \code{plot=TRUE}), it silently returns a list of two matrices:
#' \itemize{
#' \item \code{data} the values of selected features;
#' \item \code{shap_contrib} the contributions of selected features.
#' }
#'
#' @references
#'
#' Scott M. Lundberg, Su-In Lee, "A Unified Approach to Interpreting Model Predictions", NIPS Proceedings 2017, \url{https://arxiv.org/abs/1705.07874}
#'
#' Scott M. Lundberg, Su-In Lee, "Consistent feature attribution for tree ensembles", \url{https://arxiv.org/abs/1706.06060}
#'
#' @examples
#'
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#'
#' bst <- xgboost(agaricus.train$data, agaricus.train$label, nrounds = 50,
#' eta = 0.1, max_depth = 3, subsample = .5,
#' method = "hist", objective = "binary:logistic", nthread = 2, verbose = 0)
#'
#' xgb.plot.shap(agaricus.test$data, model = bst, features = "odor=none")
#' contr <- predict(bst, agaricus.test$data, predcontrib = TRUE)
#' xgb.plot.shap(agaricus.test$data, contr, model = bst, top_n = 12, n_col = 3)
#'
#' # multiclass example - plots for each class separately:
#' nclass <- 3
#' nrounds <- 20
#' x <- as.matrix(iris[, -5])
#' set.seed(123)
#' is.na(x[sample(nrow(x) * 4, 30)]) <- TRUE # introduce some missing values
#' mbst <- xgboost(data = x, label = as.numeric(iris$Species) - 1, nrounds = nrounds,
#' max_depth = 2, eta = 0.3, subsample = .5, nthread = 2,
#' objective = "multi:softprob", num_class = nclass, verbose = 0)
#' trees0 <- seq(from=0, by=nclass, length.out=nrounds)
#' col <- rgb(0, 0, 1, 0.5)
#' xgb.plot.shap(x, model = mbst, trees = trees0, target_class = 0, top_n = 4,
#' n_col = 2, col = col, pch = 16, pch_NA = 17)
#' xgb.plot.shap(x, model = mbst, trees = trees0 + 1, target_class = 1, top_n = 4,
#' n_col = 2, col = col, pch = 16, pch_NA = 17)
#' xgb.plot.shap(x, model = mbst, trees = trees0 + 2, target_class = 2, top_n = 4,
#' n_col = 2, col = col, pch = 16, pch_NA = 17)
#'
#' @rdname xgb.plot.shap
#' @export
xgb.plot.shap <- function(data, shap_contrib = NULL, features = NULL, top_n = 1, model = NULL,
trees = NULL, target_class = NULL, approxcontrib = FALSE,
subsample = NULL, n_col = 1, col = rgb(0, 0, 1, 0.2), pch = '.',
discrete_n_uniq = 5, discrete_jitter = 0.01, ylab = "SHAP",
plot_NA = TRUE, col_NA = rgb(0.7, 0, 1, 0.6), pch_NA = '.', pos_NA = 1.07,
plot_loess = TRUE, col_loess = 2, span_loess = 0.5,
which = c("1d", "2d"), plot = TRUE, ...) {
if (!is.matrix(data) && !inherits(data, "dgCMatrix"))
stop("data: must be either matrix or dgCMatrix")
if (is.null(shap_contrib) && (is.null(model) || !inherits(model, "xgb.Booster")))
stop("when shap_contrib is not provided, one must provide an xgb.Booster model")
if (is.null(features) && (is.null(model) || !inherits(model, "xgb.Booster")))
stop("when features are not provided, one must provide an xgb.Booster model to rank the features")
if (!is.null(shap_contrib) &&
(!is.matrix(shap_contrib) || nrow(shap_contrib) != nrow(data) || ncol(shap_contrib) != ncol(data) + 1))
stop("shap_contrib is not compatible with the provided data")
nsample <- if (is.null(subsample)) min(100000, nrow(data)) else as.integer(subsample * nrow(data))
idx <- sample(1:nrow(data), nsample)
data <- data[idx,]
if (is.null(shap_contrib)) {
shap_contrib <- predict(model, data, predcontrib = TRUE, approxcontrib = approxcontrib)
} else {
shap_contrib <- shap_contrib[idx,]
}
which <- match.arg(which)
if (which == "2d")
stop("2D plots are not implemented yet")
if (is.null(features)) {
imp <- xgb.importance(model = model, trees = trees)
top_n <- as.integer(top_n[1])
if (top_n < 1 && top_n > 100)
stop("top_n: must be an integer within [1, 100]")
features <- imp$Feature[1:min(top_n, NROW(imp))]
}
if (is.character(features)) {
if (is.null(colnames(data)))
stop("Either provide `data` with column names or provide `features` as column indices")
features <- match(features, colnames(data))
}
if (n_col > length(features)) n_col <- length(features)
if (is.list(shap_contrib)) { # multiclass: either choose a class or merge
shap_contrib <- if (!is.null(target_class)) shap_contrib[[target_class + 1]]
else Reduce("+", lapply(shap_contrib, abs))
}
shap_contrib <- shap_contrib[, features, drop = FALSE]
data <- data[, features, drop = FALSE]
cols <- colnames(data)
if (is.null(cols)) cols <- colnames(shap_contrib)
if (is.null(cols)) cols <- paste0('X', 1:ncol(data))
colnames(data) <- cols
colnames(shap_contrib) <- cols
if (plot && which == "1d") {
op <- par(mfrow = c(ceiling(length(features) / n_col), n_col),
oma = c(0,0,0,0) + 0.2,
mar = c(3.5,3.5,0,0) + 0.1,
mgp = c(1.7, 0.6, 0))
for (f in cols) {
ord <- order(data[, f])
x <- data[, f][ord]
y <- shap_contrib[, f][ord]
x_lim <- range(x, na.rm = TRUE)
y_lim <- range(y, na.rm = TRUE)
do_na <- plot_NA && any(is.na(x))
if (do_na) {
x_range <- diff(x_lim)
loc_na <- min(x, na.rm = TRUE) + x_range * pos_NA
x_lim <- range(c(x_lim, loc_na))
}
x_uniq <- unique(x)
x2plot <- x
# add small jitter for discrete features with <= 5 distinct values
if (length(x_uniq) <= discrete_n_uniq)
x2plot <- jitter(x, amount = discrete_jitter * min(diff(x_uniq), na.rm = TRUE))
plot(x2plot, y, pch = pch, xlab = f, col = col, xlim = x_lim, ylim = y_lim, ylab = ylab, ...)
grid()
if (plot_loess) {
# compress x to 3 digits, and mean-aggredate y
zz <- data.table(x = signif(x, 3), y)[, .(.N, y=mean(y)), x]
if (nrow(zz) <= 5) {
lines(zz$x, zz$y, col = col_loess)
} else {
lo <- stats::loess(y ~ x, data = zz, weights = zz$N, span = span_loess)
zz$y_lo <- predict(lo, zz, type = "link")
lines(zz$x, zz$y_lo, col = col_loess)
}
}
if (do_na) {
i_na <- which(is.na(x))
x_na <- rep(loc_na, length(i_na))
x_na <- jitter(x_na, amount = x_range * 0.01)
points(x_na, y[i_na], pch = pch_NA, col = col_NA)
}
}
par(op)
}
if (plot && which == "2d") {
# TODO
warning("Bivariate plotting is currently not available.")
}
invisible(list(data = data, shap_contrib = shap_contrib))
}

138
R-package/R/xgb.plot.tree.R Normal file
View File

@@ -0,0 +1,138 @@
#' Plot a boosted tree model
#'
#' Read a tree model text dump and plot the model.
#'
#' @param feature_names names of each feature as a \code{character} vector.
#' @param model produced by the \code{xgb.train} function.
#' @param trees an integer vector of tree indices that should be visualized.
#' If set to \code{NULL}, all trees of the model are included.
#' IMPORTANT: the tree index in xgboost model is zero-based
#' (e.g., use \code{trees = 0:2} for the first 3 trees in a model).
#' @param plot_width the width of the diagram in pixels.
#' @param plot_height the height of the diagram in pixels.
#' @param render a logical flag for whether the graph should be rendered (see Value).
#' @param show_node_id a logical flag for whether to show node id's in the graph.
#' @param ... currently not used.
#'
#' @details
#'
#' The content of each node is organised that way:
#'
#' \itemize{
#' \item Feature name.
#' \item \code{Cover}: The sum of second order gradient of training data classified to the leaf.
#' If it is square loss, this simply corresponds to the number of instances seen by a split
#' or collected by a leaf during training.
#' The deeper in the tree a node is, the lower this metric will be.
#' \item \code{Gain} (for split nodes): the information gain metric of a split
#' (corresponds to the importance of the node in the model).
#' \item \code{Value} (for leafs): the margin value that the leaf may contribute to prediction.
#' }
#' The tree root nodes also indicate the Tree index (0-based).
#'
#' The "Yes" branches are marked by the "< split_value" label.
#' The branches that also used for missing values are marked as bold
#' (as in "carrying extra capacity").
#'
#' This function uses \href{http://www.graphviz.org/}{GraphViz} as a backend of DiagrammeR.
#'
#' @return
#'
#' When \code{render = TRUE}:
#' returns a rendered graph object which is an \code{htmlwidget} of class \code{grViz}.
#' Similar to ggplot objects, it needs to be printed to see it when not running from command line.
#'
#' When \code{render = FALSE}:
#' silently returns a graph object which is of DiagrammeR's class \code{dgr_graph}.
#' This could be useful if one wants to modify some of the graph attributes
#' before rendering the graph with \code{\link[DiagrammeR]{render_graph}}.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#'
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 3,
#' eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
#' # plot all the trees
#' xgb.plot.tree(model = bst)
#' # plot only the first tree and display the node ID:
#' xgb.plot.tree(model = bst, trees = 0, show_node_id = TRUE)
#'
#' \dontrun{
#' # Below is an example of how to save this plot to a file.
#' # Note that for `export_graph` to work, the DiagrammeRsvg and rsvg packages must also be installed.
#' library(DiagrammeR)
#' gr <- xgb.plot.tree(model=bst, trees=0:1, render=FALSE)
#' export_graph(gr, 'tree.pdf', width=1500, height=1900)
#' export_graph(gr, 'tree.png', width=1500, height=1900)
#' }
#'
#' @export
xgb.plot.tree <- function(feature_names = NULL, model = NULL, trees = NULL, plot_width = NULL, plot_height = NULL,
render = TRUE, show_node_id = FALSE, ...){
check.deprecation(...)
if (!inherits(model, "xgb.Booster")) {
stop("model: Has to be an object of class xgb.Booster")
}
if (!requireNamespace("DiagrammeR", quietly = TRUE)) {
stop("DiagrammeR package is required for xgb.plot.tree", call. = FALSE)
}
dt <- xgb.model.dt.tree(feature_names = feature_names, model = model, trees = trees)
dt[, label:= paste0(Feature, "\nCover: ", Cover, ifelse(Feature == "Leaf", "\nValue: ", "\nGain: "), Quality)]
if (show_node_id)
dt[, label := paste0(ID, ": ", label)]
dt[Node == 0, label := paste0("Tree ", Tree, "\n", label)]
dt[, shape:= "rectangle"][Feature == "Leaf", shape:= "oval"]
dt[, filledcolor:= "Beige"][Feature == "Leaf", filledcolor:= "Khaki"]
# in order to draw the first tree on top:
dt <- dt[order(-Tree)]
nodes <- DiagrammeR::create_node_df(
n = nrow(dt),
ID = dt$ID,
label = dt$label,
fillcolor = dt$filledcolor,
shape = dt$shape,
data = dt$Feature,
fontcolor = "black")
edges <- DiagrammeR::create_edge_df(
from = match(dt[Feature != "Leaf", c(ID)] %>% rep(2), dt$ID),
to = match(dt[Feature != "Leaf", c(Yes, No)], dt$ID),
label = dt[Feature != "Leaf", paste("<", Split)] %>%
c(rep("", nrow(dt[Feature != "Leaf"]))),
style = dt[Feature != "Leaf", ifelse(Missing == Yes, "bold", "solid")] %>%
c(dt[Feature != "Leaf", ifelse(Missing == No, "bold", "solid")]),
rel = "leading_to")
graph <- DiagrammeR::create_graph(
nodes_df = nodes,
edges_df = edges,
attr_theme = NULL
) %>%
DiagrammeR::add_global_graph_attrs(
attr_type = "graph",
attr = c("layout", "rankdir"),
value = c("dot", "LR")
) %>%
DiagrammeR::add_global_graph_attrs(
attr_type = "node",
attr = c("color", "style", "fontname"),
value = c("DimGray", "filled", "Helvetica")
) %>%
DiagrammeR::add_global_graph_attrs(
attr_type = "edge",
attr = c("color", "arrowsize", "arrowhead", "fontname"),
value = c("DimGray", "1.5", "vee", "Helvetica"))
if (!render) return(invisible(graph))
DiagrammeR::render_graph(graph, width = plot_width, height = plot_height)
}
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(c("Feature", "ID", "Cover", "Quality", "Split", "Yes", "No", "Missing", ".", "shape", "filledcolor", "label"))

43
R-package/R/xgb.save.R Normal file
View File

@@ -0,0 +1,43 @@
#' Save xgboost model to binary file
#'
#' Save xgboost model to a file in binary format.
#'
#' @param model model object of \code{xgb.Booster} class.
#' @param fname name of the file to write.
#'
#' @details
#' This methods allows to save a model in an xgboost-internal binary format which is universal
#' among the various xgboost interfaces. In R, the saved model file could be read-in later
#' using either the \code{\link{xgb.load}} function or the \code{xgb_model} parameter
#' of \code{\link{xgb.train}}.
#'
#' Note: a model can also be saved as an R-object (e.g., by using \code{\link[base]{readRDS}}
#' or \code{\link[base]{save}}). However, it would then only be compatible with R, and
#' corresponding R-methods would need to be used to load it.
#'
#' @seealso
#' \code{\link{xgb.load}}, \code{\link{xgb.Booster.complete}}.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#' train <- agaricus.train
#' test <- agaricus.test
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
#' xgb.save(bst, 'xgb.model')
#' bst <- xgb.load('xgb.model')
#' if (file.exists('xgb.model')) file.remove('xgb.model')
#' pred <- predict(bst, test$data)
#' @export
xgb.save <- function(model, fname) {
if (typeof(fname) != "character")
stop("fname must be character")
if (!inherits(model, "xgb.Booster")) {
stop("model must be xgb.Booster.",
if (inherits(model, "xgb.DMatrix")) " Use xgb.DMatrix.save to save an xgb.DMatrix object." else "")
}
model <- xgb.Booster.complete(model, saveraw = FALSE)
.Call(XGBoosterSaveModel_R, model$handle, fname[1])
return(TRUE)
}

View File

@@ -0,0 +1,23 @@
#' Save xgboost model to R's raw vector,
#' user can call xgb.load to load the model back from raw vector
#'
#' Save xgboost model from xgboost or xgb.train
#'
#' @param model the model object.
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' data(agaricus.test, package='xgboost')
#' train <- agaricus.train
#' test <- agaricus.test
#' bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
#' eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
#' raw <- xgb.save.raw(bst)
#' bst <- xgb.load(raw)
#' pred <- predict(bst, test$data)
#'
#' @export
xgb.save.raw <- function(model) {
model <- xgb.get.handle(model)
.Call(XGBoosterModelToRaw_R, model)
}

372
R-package/R/xgb.train.R Normal file
View File

@@ -0,0 +1,372 @@
#' eXtreme Gradient Boosting Training
#'
#' \code{xgb.train} is an advanced interface for training an xgboost model.
#' The \code{xgboost} function is a simpler wrapper for \code{xgb.train}.
#'
#' @param params the list of parameters.
#' The complete list of parameters is available at \url{http://xgboost.readthedocs.io/en/latest/parameter.html}.
#' Below is a shorter summary:
#'
#' 1. General Parameters
#'
#' \itemize{
#' \item \code{booster} which booster to use, can be \code{gbtree} or \code{gblinear}. Default: \code{gbtree}.
#' }
#'
#' 2. Booster Parameters
#'
#' 2.1. Parameter for Tree Booster
#'
#' \itemize{
#' \item \code{eta} control the learning rate: scale the contribution of each tree by a factor of \code{0 < eta < 1} when it is added to the current approximation. Used to prevent overfitting by making the boosting process more conservative. Lower value for \code{eta} implies larger value for \code{nrounds}: low \code{eta} value means model more robust to overfitting but slower to compute. Default: 0.3
#' \item \code{gamma} minimum loss reduction required to make a further partition on a leaf node of the tree. the larger, the more conservative the algorithm will be.
#' \item \code{max_depth} maximum depth of a tree. Default: 6
#' \item \code{min_child_weight} minimum sum of instance weight (hessian) needed in a child. If the tree partition step results in a leaf node with the sum of instance weight less than min_child_weight, then the building process will give up further partitioning. In linear regression mode, this simply corresponds to minimum number of instances needed to be in each node. The larger, the more conservative the algorithm will be. Default: 1
#' \item \code{subsample} subsample ratio of the training instance. Setting it to 0.5 means that xgboost randomly collected half of the data instances to grow trees and this will prevent overfitting. It makes computation shorter (because less data to analyse). It is advised to use this parameter with \code{eta} and increase \code{nrounds}. Default: 1
#' \item \code{colsample_bytree} subsample ratio of columns when constructing each tree. Default: 1
#' \item \code{num_parallel_tree} Experimental parameter. number of trees to grow per round. Useful to test Random Forest through Xgboost (set \code{colsample_bytree < 1}, \code{subsample < 1} and \code{round = 1}) accordingly. Default: 1
#' \item \code{monotone_constraints} A numerical vector consists of \code{1}, \code{0} and \code{-1} with its length equals to the number of features in the training data. \code{1} is increasing, \code{-1} is decreasing and \code{0} is no constraint.
#' \item \code{interaction_constraints} A list of vectors specifying feature indices of permitted interactions. Each item of the list represents one permitted interaction where specified features are allowed to interact with each other. Feature index values should start from \code{0} (\code{0} references the first column). Leave argument unspecified for no interaction constraints.
#' }
#'
#' 2.2. Parameter for Linear Booster
#'
#' \itemize{
#' \item \code{lambda} L2 regularization term on weights. Default: 0
#' \item \code{lambda_bias} L2 regularization term on bias. Default: 0
#' \item \code{alpha} L1 regularization term on weights. (there is no L1 reg on bias because it is not important). Default: 0
#' }
#'
#' 3. Task Parameters
#'
#' \itemize{
#' \item \code{objective} specify the learning task and the corresponding learning objective, users can pass a self-defined function to it. The default objective options are below:
#' \itemize{
#' \item \code{reg:squarederror} Regression with squared loss (Default).
#' \item \code{reg:logistic} logistic regression.
#' \item \code{binary:logistic} logistic regression for binary classification. Output probability.
#' \item \code{binary:logitraw} logistic regression for binary classification, output score before logistic transformation.
#' \item \code{num_class} set the number of classes. To use only with multiclass objectives.
#' \item \code{multi:softmax} set xgboost to do multiclass classification using the softmax objective. Class is represented by a number and should be from 0 to \code{num_class - 1}.
#' \item \code{multi:softprob} same as softmax, but prediction outputs a vector of ndata * nclass elements, which can be further reshaped to ndata, nclass matrix. The result contains predicted probabilities of each data point belonging to each class.
#' \item \code{rank:pairwise} set xgboost to do ranking task by minimizing the pairwise loss.
#' }
#' \item \code{base_score} the initial prediction score of all instances, global bias. Default: 0.5
#' \item \code{eval_metric} evaluation metrics for validation data. Users can pass a self-defined function to it. Default: metric will be assigned according to objective(rmse for regression, and error for classification, mean average precision for ranking). List is provided in detail section.
#' }
#'
#' @param data training dataset. \code{xgb.train} accepts only an \code{xgb.DMatrix} as the input.
#' \code{xgboost}, in addition, also accepts \code{matrix}, \code{dgCMatrix}, or name of a local data file.
#' @param nrounds max number of boosting iterations.
#' @param watchlist named list of xgb.DMatrix datasets to use for evaluating model performance.
#' Metrics specified in either \code{eval_metric} or \code{feval} will be computed for each
#' of these datasets during each boosting iteration, and stored in the end as a field named
#' \code{evaluation_log} in the resulting object. When either \code{verbose>=1} or
#' \code{\link{cb.print.evaluation}} callback is engaged, the performance results are continuously
#' printed out during the training.
#' E.g., specifying \code{watchlist=list(validation1=mat1, validation2=mat2)} allows to track
#' the performance of each round's model on mat1 and mat2.
#' @param obj customized objective function. Returns gradient and second order
#' gradient with given prediction and dtrain.
#' @param feval customized evaluation function. Returns
#' \code{list(metric='metric-name', value='metric-value')} with given
#' prediction and dtrain.
#' @param verbose If 0, xgboost will stay silent. If 1, it will print information about performance.
#' If 2, some additional information will be printed out.
#' Note that setting \code{verbose > 0} automatically engages the
#' \code{cb.print.evaluation(period=1)} callback function.
#' @param print_every_n Print each n-th iteration evaluation messages when \code{verbose>0}.
#' Default is 1 which means all messages are printed. This parameter is passed to the
#' \code{\link{cb.print.evaluation}} callback.
#' @param early_stopping_rounds If \code{NULL}, the early stopping function is not triggered.
#' If set to an integer \code{k}, training with a validation set will stop if the performance
#' doesn't improve for \code{k} rounds.
#' Setting this parameter engages the \code{\link{cb.early.stop}} callback.
#' @param maximize If \code{feval} and \code{early_stopping_rounds} are set,
#' then this parameter must be set as well.
#' When it is \code{TRUE}, it means the larger the evaluation score the better.
#' This parameter is passed to the \code{\link{cb.early.stop}} callback.
#' @param save_period when it is non-NULL, model is saved to disk after every \code{save_period} rounds,
#' 0 means save at the end. The saving is handled by the \code{\link{cb.save.model}} callback.
#' @param save_name the name or path for periodically saved model file.
#' @param xgb_model a previously built model to continue the training from.
#' Could be either an object of class \code{xgb.Booster}, or its raw data, or the name of a
#' file with a previously saved model.
#' @param callbacks a list of callback functions to perform various task during boosting.
#' See \code{\link{callbacks}}. Some of the callbacks are automatically created depending on the
#' parameters' values. User can provide either existing or their own callback methods in order
#' to customize the training process.
#' @param ... other parameters to pass to \code{params}.
#' @param label vector of response values. Should not be provided when data is
#' a local data file name or an \code{xgb.DMatrix}.
#' @param missing by default is set to NA, which means that NA values should be considered as 'missing'
#' by the algorithm. Sometimes, 0 or other extreme value might be used to represent missing values.
#' This parameter is only used when input is a dense matrix.
#' @param weight a vector indicating the weight for each row of the input.
#'
#' @details
#' These are the training functions for \code{xgboost}.
#'
#' The \code{xgb.train} interface supports advanced features such as \code{watchlist},
#' customized objective and evaluation metric functions, therefore it is more flexible
#' than the \code{xgboost} interface.
#'
#' Parallelization is automatically enabled if \code{OpenMP} is present.
#' Number of threads can also be manually specified via \code{nthread} parameter.
#'
#' The evaluation metric is chosen automatically by Xgboost (according to the objective)
#' when the \code{eval_metric} parameter is not provided.
#' User may set one or several \code{eval_metric} parameters.
#' Note that when using a customized metric, only this single metric can be used.
#' The following is the list of built-in metrics for which Xgboost provides optimized implementation:
#' \itemize{
#' \item \code{rmse} root mean square error. \url{http://en.wikipedia.org/wiki/Root_mean_square_error}
#' \item \code{logloss} negative log-likelihood. \url{http://en.wikipedia.org/wiki/Log-likelihood}
#' \item \code{mlogloss} multiclass logloss. \url{http://wiki.fast.ai/index.php/Log_Loss}
#' \item \code{error} Binary classification error rate. It is calculated as \code{(# wrong cases) / (# all cases)}.
#' By default, it uses the 0.5 threshold for predicted values to define negative and positive instances.
#' Different threshold (e.g., 0.) could be specified as "error@0."
#' \item \code{merror} Multiclass classification error rate. It is calculated as \code{(# wrong cases) / (# all cases)}.
#' \item \code{auc} Area under the curve. \url{http://en.wikipedia.org/wiki/Receiver_operating_characteristic#'Area_under_curve} for ranking evaluation.
#' \item \code{aucpr} Area under the PR curve. \url{https://en.wikipedia.org/wiki/Precision_and_recall} for ranking evaluation.
#' \item \code{ndcg} Normalized Discounted Cumulative Gain (for ranking task). \url{http://en.wikipedia.org/wiki/NDCG}
#' }
#'
#' The following callbacks are automatically created when certain parameters are set:
#' \itemize{
#' \item \code{cb.print.evaluation} is turned on when \code{verbose > 0};
#' and the \code{print_every_n} parameter is passed to it.
#' \item \code{cb.evaluation.log} is on when \code{watchlist} is present.
#' \item \code{cb.early.stop}: when \code{early_stopping_rounds} is set.
#' \item \code{cb.save.model}: when \code{save_period > 0} is set.
#' }
#'
#' @return
#' An object of class \code{xgb.Booster} with the following elements:
#' \itemize{
#' \item \code{handle} a handle (pointer) to the xgboost model in memory.
#' \item \code{raw} a cached memory dump of the xgboost model saved as R's \code{raw} type.
#' \item \code{niter} number of boosting iterations.
#' \item \code{evaluation_log} evaluation history stored as a \code{data.table} with the
#' first column corresponding to iteration number and the rest corresponding to evaluation
#' metrics' values. It is created by the \code{\link{cb.evaluation.log}} callback.
#' \item \code{call} a function call.
#' \item \code{params} parameters that were passed to the xgboost library. Note that it does not
#' capture parameters changed by the \code{\link{cb.reset.parameters}} callback.
#' \item \code{callbacks} callback functions that were either automatically assigned or
#' explicitly passed.
#' \item \code{best_iteration} iteration number with the best evaluation metric value
#' (only available with early stopping).
#' \item \code{best_ntreelimit} the \code{ntreelimit} value corresponding to the best iteration,
#' which could further be used in \code{predict} method
#' (only available with early stopping).
#' \item \code{best_score} the best evaluation metric value during early stopping.
#' (only available with early stopping).
#' \item \code{feature_names} names of the training dataset features
#' (only when column names were defined in training data).
#' \item \code{nfeatures} number of features in training data.
#' }
#'
#' @seealso
#' \code{\link{callbacks}},
#' \code{\link{predict.xgb.Booster}},
#' \code{\link{xgb.cv}}
#'
#' @references
#'
#' Tianqi Chen and Carlos Guestrin, "XGBoost: A Scalable Tree Boosting System",
#' 22nd SIGKDD Conference on Knowledge Discovery and Data Mining, 2016, \url{https://arxiv.org/abs/1603.02754}
#'
#' @examples
#' data(agaricus.train, package='xgboost')
#' 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)
#' watchlist <- list(train = dtrain, eval = dtest)
#'
#' ## A simple xgb.train example:
#' param <- list(max_depth = 2, eta = 1, verbose = 0, nthread = 2,
#' objective = "binary:logistic", eval_metric = "auc")
#' bst <- xgb.train(param, dtrain, nrounds = 2, watchlist)
#'
#'
#' ## An xgb.train example where custom objective and evaluation metric are used:
#' logregobj <- function(preds, dtrain) {
#' labels <- getinfo(dtrain, "label")
#' preds <- 1/(1 + exp(-preds))
#' grad <- preds - labels
#' hess <- preds * (1 - preds)
#' return(list(grad = grad, hess = hess))
#' }
#' evalerror <- function(preds, dtrain) {
#' labels <- getinfo(dtrain, "label")
#' err <- as.numeric(sum(labels != (preds > 0)))/length(labels)
#' return(list(metric = "error", value = err))
#' }
#'
#' # These functions could be used by passing them either:
#' # as 'objective' and 'eval_metric' parameters in the params list:
#' param <- list(max_depth = 2, eta = 1, verbose = 0, nthread = 2,
#' objective = logregobj, eval_metric = evalerror)
#' bst <- xgb.train(param, dtrain, nrounds = 2, watchlist)
#'
#' # or through the ... arguments:
#' param <- list(max_depth = 2, eta = 1, verbose = 0, nthread = 2)
#' bst <- xgb.train(param, dtrain, nrounds = 2, watchlist,
#' objective = logregobj, eval_metric = evalerror)
#'
#' # or as dedicated 'obj' and 'feval' parameters of xgb.train:
#' bst <- xgb.train(param, dtrain, nrounds = 2, watchlist,
#' obj = logregobj, feval = evalerror)
#'
#'
#' ## An xgb.train example of using variable learning rates at each iteration:
#' param <- list(max_depth = 2, eta = 1, verbose = 0, nthread = 2,
#' objective = "binary:logistic", eval_metric = "auc")
#' my_etas <- list(eta = c(0.5, 0.1))
#' bst <- xgb.train(param, dtrain, nrounds = 2, watchlist,
#' callbacks = list(cb.reset.parameters(my_etas)))
#'
#' ## Early stopping:
#' bst <- xgb.train(param, dtrain, nrounds = 25, watchlist,
#' early_stopping_rounds = 3)
#'
#' ## An 'xgboost' interface example:
#' bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label,
#' max_depth = 2, eta = 1, nthread = 2, nrounds = 2,
#' objective = "binary:logistic")
#' pred <- predict(bst, agaricus.test$data)
#'
#' @rdname xgb.train
#' @export
xgb.train <- function(params = list(), data, nrounds, watchlist = list(),
obj = NULL, feval = NULL, verbose = 1, print_every_n = 1L,
early_stopping_rounds = NULL, maximize = NULL,
save_period = NULL, save_name = "xgboost.model",
xgb_model = NULL, callbacks = list(), ...) {
check.deprecation(...)
params <- check.booster.params(params, ...)
check.custom.obj()
check.custom.eval()
# data & watchlist checks
dtrain <- data
if (!inherits(dtrain, "xgb.DMatrix"))
stop("second argument dtrain must be xgb.DMatrix")
if (length(watchlist) > 0) {
if (typeof(watchlist) != "list" ||
!all(vapply(watchlist, inherits, logical(1), what = 'xgb.DMatrix')))
stop("watchlist must be a list of xgb.DMatrix elements")
evnames <- names(watchlist)
if (is.null(evnames) || any(evnames == ""))
stop("each element of the watchlist must have a name tag")
}
# evaluation printing callback
params <- c(params, list(silent = ifelse(verbose > 1, 0, 1)))
print_every_n <- max( as.integer(print_every_n), 1L)
if (!has.callbacks(callbacks, 'cb.print.evaluation') &&
verbose) {
callbacks <- add.cb(callbacks, cb.print.evaluation(print_every_n))
}
# evaluation log callback: it is automatically enabled when watchlist is provided
evaluation_log <- list()
if (!has.callbacks(callbacks, 'cb.evaluation.log') &&
length(watchlist) > 0) {
callbacks <- add.cb(callbacks, cb.evaluation.log())
}
# Model saving callback
if (!is.null(save_period) &&
!has.callbacks(callbacks, 'cb.save.model')) {
callbacks <- add.cb(callbacks, cb.save.model(save_period, save_name))
}
# Early stopping callback
stop_condition <- FALSE
if (!is.null(early_stopping_rounds) &&
!has.callbacks(callbacks, 'cb.early.stop')) {
callbacks <- add.cb(callbacks, cb.early.stop(early_stopping_rounds,
maximize = maximize, verbose = verbose))
}
# Sort the callbacks into categories
cb <- categorize.callbacks(callbacks)
# The tree updating process would need slightly different handling
is_update <- NVL(params[['process_type']], '.') == 'update'
# Construct a booster (either a new one or load from xgb_model)
handle <- xgb.Booster.handle(params, append(watchlist, dtrain), xgb_model)
bst <- xgb.handleToBooster(handle)
# extract parameters that can affect the relationship b/w #trees and #iterations
num_class <- max(as.numeric(NVL(params[['num_class']], 1)), 1)
num_parallel_tree <- max(as.numeric(NVL(params[['num_parallel_tree']], 1)), 1)
# When the 'xgb_model' was set, find out how many boosting iterations it has
niter_init <- 0
if (!is.null(xgb_model)) {
niter_init <- as.numeric(xgb.attr(bst, 'niter')) + 1
if (length(niter_init) == 0) {
niter_init <- xgb.ntree(bst) %/% (num_parallel_tree * num_class)
}
}
if(is_update && nrounds > niter_init)
stop("nrounds cannot be larger than ", niter_init, " (nrounds of xgb_model)")
# TODO: distributed code
rank <- 0
niter_skip <- ifelse(is_update, 0, niter_init)
begin_iteration <- niter_skip + 1
end_iteration <- niter_skip + nrounds
# the main loop for boosting iterations
for (iteration in begin_iteration:end_iteration) {
for (f in cb$pre_iter) f()
xgb.iter.update(bst$handle, dtrain, iteration - 1, obj)
bst_evaluation <- numeric(0)
if (length(watchlist) > 0)
bst_evaluation <- xgb.iter.eval(bst$handle, watchlist, iteration - 1, feval)
xgb.attr(bst$handle, 'niter') <- iteration - 1
for (f in cb$post_iter) f()
if (stop_condition) break
}
for (f in cb$finalize) f(finalize = TRUE)
bst <- xgb.Booster.complete(bst, saveraw = TRUE)
# store the total number of boosting iterations
bst$niter = end_iteration
# store the evaluation results
if (length(evaluation_log) > 0 &&
nrow(evaluation_log) > 0) {
# include the previous compatible history when available
if (inherits(xgb_model, 'xgb.Booster') &&
!is_update &&
!is.null(xgb_model$evaluation_log) &&
isTRUE(all.equal(colnames(evaluation_log),
colnames(xgb_model$evaluation_log)))) {
evaluation_log <- rbindlist(list(xgb_model$evaluation_log, evaluation_log))
}
bst$evaluation_log <- evaluation_log
}
bst$call <- match.call()
bst$params <- params
bst$callbacks <- callbacks
if (!is.null(colnames(dtrain)))
bst$feature_names <- colnames(dtrain)
bst$nfeatures <- ncol(dtrain)
return(bst)
}

113
R-package/R/xgboost.R Normal file
View File

@@ -0,0 +1,113 @@
# Simple interface for training an xgboost model that wraps \code{xgb.train}.
# Its documentation is combined with xgb.train.
#
#' @rdname xgb.train
#' @export
xgboost <- function(data = NULL, label = NULL, missing = NA, weight = NULL,
params = list(), nrounds,
verbose = 1, print_every_n = 1L,
early_stopping_rounds = NULL, maximize = NULL,
save_period = NULL, save_name = "xgboost.model",
xgb_model = NULL, callbacks = list(), ...) {
dtrain <- xgb.get.DMatrix(data, label, missing, weight)
watchlist <- list(train = dtrain)
bst <- xgb.train(params, dtrain, nrounds, watchlist, verbose = verbose, print_every_n = print_every_n,
early_stopping_rounds = early_stopping_rounds, maximize = maximize,
save_period = save_period, save_name = save_name,
xgb_model = xgb_model, callbacks = callbacks, ...)
return(bst)
}
#' Training part from Mushroom Data Set
#'
#' This data set is originally from the Mushroom data set,
#' UCI Machine Learning Repository.
#'
#' This data set includes the following fields:
#'
#' \itemize{
#' \item \code{label} the label for each record
#' \item \code{data} a sparse Matrix of \code{dgCMatrix} class, with 126 columns.
#' }
#'
#' @references
#' https://archive.ics.uci.edu/ml/datasets/Mushroom
#'
#' Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository
#' [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California,
#' School of Information and Computer Science.
#'
#' @docType data
#' @keywords datasets
#' @name agaricus.train
#' @usage data(agaricus.train)
#' @format A list containing a label vector, and a dgCMatrix object with 6513
#' rows and 127 variables
NULL
#' Test part from Mushroom Data Set
#'
#' This data set is originally from the Mushroom data set,
#' UCI Machine Learning Repository.
#'
#' This data set includes the following fields:
#'
#' \itemize{
#' \item \code{label} the label for each record
#' \item \code{data} a sparse Matrix of \code{dgCMatrix} class, with 126 columns.
#' }
#'
#' @references
#' https://archive.ics.uci.edu/ml/datasets/Mushroom
#'
#' Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository
#' [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California,
#' School of Information and Computer Science.
#'
#' @docType data
#' @keywords datasets
#' @name agaricus.test
#' @usage data(agaricus.test)
#' @format A list containing a label vector, and a dgCMatrix object with 1611
#' rows and 126 variables
NULL
# Various imports
#' @importClassesFrom Matrix dgCMatrix dgeMatrix
#' @importFrom Matrix colSums
#' @importFrom Matrix sparse.model.matrix
#' @importFrom Matrix sparseVector
#' @importFrom Matrix sparseMatrix
#' @importFrom Matrix t
#' @importFrom data.table data.table
#' @importFrom data.table is.data.table
#' @importFrom data.table as.data.table
#' @importFrom data.table :=
#' @importFrom data.table rbindlist
#' @importFrom data.table setkey
#' @importFrom data.table setkeyv
#' @importFrom data.table setnames
#' @importFrom magrittr %>%
#' @importFrom stringi stri_detect_regex
#' @importFrom stringi stri_match_first_regex
#' @importFrom stringi stri_replace_first_regex
#' @importFrom stringi stri_replace_all_regex
#' @importFrom stringi stri_split_regex
#' @importFrom utils object.size str tail
#' @importFrom stats predict
#' @importFrom stats median
#' @importFrom utils head
#' @importFrom graphics barplot
#' @importFrom graphics lines
#' @importFrom graphics points
#' @importFrom graphics grid
#' @importFrom graphics par
#' @importFrom graphics title
#' @importFrom grDevices rgb
#'
#' @import methods
#' @useDynLib xgboost, .registration = TRUE
NULL

33
R-package/README.md Normal file
View File

@@ -0,0 +1,33 @@
XGBoost R Package for Scalable GBM
==================================
[![CRAN Status Badge](http://www.r-pkg.org/badges/version/xgboost)](https://cran.r-project.org/web/packages/xgboost)
[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/xgboost)](https://cran.rstudio.com/web/packages/xgboost/index.html)
[![Documentation Status](https://readthedocs.org/projects/xgboost/badge/?version=latest)](http://xgboost.readthedocs.org/en/latest/R-package/index.html)
Resources
---------
* [XGBoost R Package Online Documentation](http://xgboost.readthedocs.org/en/latest/R-package/index.html)
- Check this out for detailed documents, examples and tutorials.
Installation
------------
We are [on CRAN](https://cran.r-project.org/web/packages/xgboost/index.html) now. For stable/pre-compiled(for Windows and OS X) version, please install from CRAN:
```r
install.packages('xgboost')
```
For more detailed installation instructions, please see [here](http://xgboost.readthedocs.org/en/latest/build.html#r-package-installation).
Examples
--------
* Please visit [walk through example](demo).
* See also the [example scripts](../demo/kaggle-higgs) for Kaggle Higgs Challenge, including [speedtest script](../demo/kaggle-higgs/speedtest.R) on this dataset and the one related to [Otto challenge](../demo/kaggle-otto), including a [RMarkdown documentation](../demo/kaggle-otto/understandingXGBoostModel.Rmd).
Development
-----------
* See the [R Package section](https://xgboost.readthedocs.io/en/latest/contribute.html#r-package) of the contributors guide.

4
R-package/cleanup Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
rm -f src/Makevars
rm -f CMakeLists.txt

2856
R-package/configure vendored Executable file

File diff suppressed because it is too large Load Diff

31
R-package/configure.ac Normal file
View File

@@ -0,0 +1,31 @@
### configure.ac -*- Autoconf -*-
AC_PREREQ(2.62)
AC_INIT([xgboost],[0.6-3],[],[xgboost],[])
OPENMP_CXXFLAGS=""
if test `uname -s` = "Linux"
then
OPENMP_CXXFLAGS="\$(SHLIB_OPENMP_CXXFLAGS)"
fi
if test `uname -s` = "Darwin"
then
OPENMP_CXXFLAGS="\$(SHLIB_OPENMP_CXXFLAGS)"
ac_pkg_openmp=no
AC_MSG_CHECKING([whether OpenMP will work in a package])
AC_LANG_CONFTEST(
[AC_LANG_PROGRAM([[#include <omp.h>]], [[ return omp_get_num_threads (); ]])])
PKG_CFLAGS="${OPENMP_CFLAGS}" PKG_LIBS="${OPENMP_CFLAGS}" "$RBIN" CMD SHLIB conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && "$RBIN" --vanilla -q -e "dyn.load(paste('conftest',.Platform\$dynlib.ext,sep=''))" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && ac_pkg_openmp=yes
AC_MSG_RESULT([${ac_pkg_openmp}])
if test "${ac_pkg_openmp}" = no; then
OPENMP_CXXFLAGS=''
fi
fi
AC_SUBST(OPENMP_CXXFLAGS)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT

0
R-package/configure.win Normal file
View File

Binary file not shown.

Binary file not shown.

15
R-package/demo/00Index Normal file
View File

@@ -0,0 +1,15 @@
basic_walkthrough Basic feature walkthrough
caret_wrapper Use xgboost to train in caret library
custom_objective Cutomize loss function, and evaluation metric
boost_from_prediction Boosting from existing prediction
predict_first_ntree Predicting using first n trees
generalized_linear_model Generalized Linear Model
cross_validation Cross validation
create_sparse_matrix Create Sparse Matrix
predict_leaf_indices Predicting the corresponding leaves
early_stopping Early Stop in training
poisson_regression Poisson Regression on count data
tweedie_regression Tweddie Regression
gpu_accelerated GPU-accelerated tree building algorithms
interaction_constraints Interaction constraints among features

20
R-package/demo/README.md Normal file
View File

@@ -0,0 +1,20 @@
XGBoost R Feature Walkthrough
====
* [Basic walkthrough of wrappers](basic_walkthrough.R)
* [Train a xgboost model from caret library](caret_wrapper.R)
* [Cutomize loss function, and evaluation metric](custom_objective.R)
* [Boosting from existing prediction](boost_from_prediction.R)
* [Predicting using first n trees](predict_first_ntree.R)
* [Generalized Linear Model](generalized_linear_model.R)
* [Cross validation](cross_validation.R)
* [Create a sparse matrix from a dense one](create_sparse_matrix.R)
* [Use GPU-accelerated tree building algorithms](gpu_accelerated.R)
Benchmarks
====
* [Starter script for Kaggle Higgs Boson](../../demo/kaggle-higgs)
Notes
====
* Contribution of examples, benchmarks is more than welcomed!
* If you like to share how you use xgboost to solve your problem, send a pull request:)

View File

@@ -0,0 +1,112 @@
require(xgboost)
require(methods)
# we load in the agaricus dataset
# In this example, we are aiming to predict whether a mushroom is edible
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
# the loaded data is stored in sparseMatrix, and label is a numeric vector in {0,1}
class(train$label)
class(train$data)
#-------------Basic Training using XGBoost-----------------
# this is the basic usage of xgboost you can put matrix in data field
# note: we are putting in sparse matrix here, xgboost naturally handles sparse input
# use sparse matrix when your feature is sparse(e.g. when you are using one-hot encoding vector)
print("Training xgboost with sparseMatrix")
bst <- xgboost(data = train$data, label = train$label, max_depth = 2, eta = 1, nrounds = 2,
nthread = 2, objective = "binary:logistic")
# alternatively, you can put in dense matrix, i.e. basic R-matrix
print("Training xgboost with Matrix")
bst <- xgboost(data = as.matrix(train$data), label = train$label, max_depth = 2, eta = 1, nrounds = 2,
nthread = 2, objective = "binary:logistic")
# you can also put in xgb.DMatrix object, which stores label, data and other meta datas needed for advanced features
print("Training xgboost with xgb.DMatrix")
dtrain <- xgb.DMatrix(data = train$data, label = train$label)
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nrounds = 2, nthread = 2,
objective = "binary:logistic")
# Verbose = 0,1,2
print("Train xgboost with verbose 0, no message")
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nrounds = 2,
nthread = 2, objective = "binary:logistic", verbose = 0)
print("Train xgboost with verbose 1, print evaluation metric")
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nrounds = 2,
nthread = 2, objective = "binary:logistic", verbose = 1)
print("Train xgboost with verbose 2, also print information about tree")
bst <- xgboost(data = dtrain, max_depth = 2, eta = 1, nrounds = 2,
nthread = 2, objective = "binary:logistic", verbose = 2)
# you can also specify data as file path to a LibSVM format input
# since we do not have this file with us, the following line is just for illustration
# bst <- xgboost(data = 'agaricus.train.svm', max_depth = 2, eta = 1, nrounds = 2,objective = "binary:logistic")
#--------------------basic prediction using xgboost--------------
# you can do prediction using the following line
# you can put in Matrix, sparseMatrix, or xgb.DMatrix
pred <- predict(bst, test$data)
err <- mean(as.numeric(pred > 0.5) != test$label)
print(paste("test-error=", err))
#-------------------save and load models-------------------------
# save model to binary local file
xgb.save(bst, "xgboost.model")
# load binary model to R
bst2 <- xgb.load("xgboost.model")
pred2 <- predict(bst2, test$data)
# pred2 should be identical to pred
print(paste("sum(abs(pred2-pred))=", sum(abs(pred2-pred))))
# save model to R's raw vector
raw = xgb.save.raw(bst)
# load binary model to R
bst3 <- xgb.load(raw)
pred3 <- predict(bst3, test$data)
# pred3 should be identical to pred
print(paste("sum(abs(pred3-pred))=", sum(abs(pred3-pred))))
#----------------Advanced features --------------
# to use advanced features, we need to put data in xgb.DMatrix
dtrain <- xgb.DMatrix(data = train$data, label=train$label)
dtest <- xgb.DMatrix(data = test$data, label=test$label)
#---------------Using watchlist----------------
# watchlist is a list of xgb.DMatrix, each of them is tagged with name
watchlist <- list(train=dtrain, test=dtest)
# to train with watchlist, use xgb.train, which contains more advanced features
# watchlist allows us to monitor the evaluation result on all data in the list
print("Train xgboost using xgb.train with watchlist")
bst <- xgb.train(data=dtrain, max_depth=2, eta=1, nrounds=2, watchlist=watchlist,
nthread = 2, objective = "binary:logistic")
# we can change evaluation metrics, or use multiple evaluation metrics
print("train xgboost using xgb.train with watchlist, watch logloss and error")
bst <- xgb.train(data=dtrain, max_depth=2, eta=1, nrounds=2, watchlist=watchlist,
eval_metric = "error", eval_metric = "logloss",
nthread = 2, objective = "binary:logistic")
# xgb.DMatrix can also be saved using xgb.DMatrix.save
xgb.DMatrix.save(dtrain, "dtrain.buffer")
# to load it in, simply call xgb.DMatrix
dtrain2 <- xgb.DMatrix("dtrain.buffer")
bst <- xgb.train(data=dtrain2, max_depth=2, eta=1, nrounds=2, watchlist=watchlist,
nthread = 2, objective = "binary:logistic")
# information can be extracted from xgb.DMatrix using getinfo
label = getinfo(dtest, "label")
pred <- predict(bst, dtest)
err <- as.numeric(sum(as.integer(pred > 0.5) != label))/length(label)
print(paste("test-error=", err))
# You can dump the tree you learned using xgb.dump into a text file
dump_path = file.path(tempdir(), 'dump.raw.txt')
xgb.dump(bst, dump_path, with_stats = T)
# Finally, you can check which features are the most important.
print("Most important features (look at column Gain):")
imp_matrix <- xgb.importance(feature_names = colnames(train$data), model = bst)
print(imp_matrix)
# Feature importance bar plot by gain
print("Feature importance Plot : ")
print(xgb.plot.importance(importance_matrix = imp_matrix))

View File

@@ -0,0 +1,26 @@
require(xgboost)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
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)
watchlist <- list(eval = dtest, train = dtrain)
###
# advanced: start from a initial base prediction
#
print('start running example to start from a initial prediction')
# train xgboost for 1 round
param <- list(max_depth=2, eta=1, nthread = 2, 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
ptrain <- predict(bst, dtrain, outputmargin=TRUE)
ptest <- predict(bst, dtest, outputmargin=TRUE)
# set the base_margin property of dtrain and dtest
# base margin is the base prediction we will boost from
setinfo(dtrain, "base_margin", ptrain)
setinfo(dtest, "base_margin", ptest)
print('this is result of boost from initial prediction')
bst <- xgb.train(params = param, data = dtrain, nrounds = 1, watchlist = watchlist)

View File

@@ -0,0 +1,35 @@
# install development version of caret library that contains xgboost models
devtools::install_github("topepo/caret/pkg/caret")
require(caret)
require(xgboost)
require(data.table)
require(vcd)
require(e1071)
# Load Arthritis dataset in memory.
data(Arthritis)
# Create a copy of the dataset with data.table package (data.table is 100% compliant with R dataframe but its syntax is a lot more consistent and its performance are really good).
df <- data.table(Arthritis, keep.rownames = F)
# Let's add some new categorical features to see if it helps. Of course these feature are highly correlated to the Age feature. Usually it's not a good thing in ML, but Tree algorithms (including boosted trees) are able to select the best features, even in case of highly correlated features.
# For the first feature we create groups of age by rounding the real age. Note that we transform it to factor (categorical data) so the algorithm treat them as independant values.
df[,AgeDiscret:= as.factor(round(Age/10,0))]
# Here is an even stronger simplification of the real age with an arbitrary split at 30 years old. I choose this value based on nothing. We will see later if simplifying the information based on arbitrary values is a good strategy (I am sure you already have an idea of how well it will work!).
df[,AgeCat:= as.factor(ifelse(Age > 30, "Old", "Young"))]
# We remove ID as there is nothing to learn from this feature (it will just add some noise as the dataset is small).
df[,ID:=NULL]
#-------------Basic Training using XGBoost in caret Library-----------------
# Set up control parameters for caret::train
# Here we use 10-fold cross-validation, repeating twice, and using random search for tuning hyper-parameters.
fitControl <- trainControl(method = "repeatedcv", number = 10, repeats = 2, search = "random")
# train a xgbTree model using caret::train
model <- train(factor(Improved)~., data = df, method = "xgbTree", trControl = fitControl)
# Instead of tree for our boosters, you can also fit a linear regression or logistic regression model using xgbLinear
# model <- train(factor(Improved)~., data = df, method = "xgbLinear", trControl = fitControl)
# See model results
print(model)

View File

@@ -0,0 +1,89 @@
require(xgboost)
require(Matrix)
require(data.table)
if (!require(vcd)) {
install.packages('vcd') #Available in Cran. Used for its dataset with categorical values.
require(vcd)
}
# According to its documentation, Xgboost works only on numbers.
# Sometimes the dataset we have to work on have categorical data.
# A categorical variable is one which have a fixed number of values. By example, if for each observation a variable called "Colour" can have only "red", "blue" or "green" as value, it is a categorical variable.
#
# In R, categorical variable is called Factor.
# Type ?factor in console for more information.
#
# In this demo we will see how to transform a dense dataframe with categorical variables to a sparse matrix before analyzing it in Xgboost.
# The method we are going to see is usually called "one hot encoding".
#load Arthritis dataset in memory.
data(Arthritis)
# create a copy of the dataset with data.table package (data.table is 100% compliant with R dataframe but its syntax is a lot more consistent and its performance are really good).
df <- data.table(Arthritis, keep.rownames = F)
# Let's have a look to the data.table
cat("Print the dataset\n")
print(df)
# 2 columns have factor type, one has ordinal type (ordinal variable is a categorical variable with values wich can be ordered, here: None > Some > Marked).
cat("Structure of the dataset\n")
str(df)
# Let's add some new categorical features to see if it helps. Of course these feature are highly correlated to the Age feature. Usually it's not a good thing in ML, but Tree algorithms (including boosted trees) are able to select the best features, even in case of highly correlated features.
# For the first feature we create groups of age by rounding the real age. Note that we transform it to factor (categorical data) so the algorithm treat them as independant values.
df[,AgeDiscret:= as.factor(round(Age/10,0))]
# Here is an even stronger simplification of the real age with an arbitrary split at 30 years old. I choose this value based on nothing. We will see later if simplifying the information based on arbitrary values is a good strategy (I am sure you already have an idea of how well it will work!).
df[,AgeCat:= as.factor(ifelse(Age > 30, "Old", "Young"))]
# We remove ID as there is nothing to learn from this feature (it will just add some noise as the dataset is small).
df[,ID:=NULL]
# List the different values for the column Treatment: Placebo, Treated.
cat("Values of the categorical feature Treatment\n")
print(levels(df[,Treatment]))
# Next step, we will transform the categorical data to dummy variables.
# This method is also called one hot encoding.
# The purpose is to transform each value of each categorical feature in one binary feature.
#
# Let's take, the column Treatment will be replaced by two columns, Placebo, and Treated. Each of them will be binary. For example an observation which had the value Placebo in column Treatment before the transformation will have, after the transformation, the value 1 in the new column Placebo and the value 0 in the new column Treated.
#
# Formulae Improved~.-1 used below means transform all categorical features but column Improved to binary values.
# Column Improved is excluded because it will be our output column, the one we want to predict.
sparse_matrix = sparse.model.matrix(Improved~.-1, data = df)
cat("Encoding of the sparse Matrix\n")
print(sparse_matrix)
# Create the output vector (not sparse)
# 1. Set, for all rows, field in Y column to 0;
# 2. set Y to 1 when Improved == Marked;
# 3. Return Y column
output_vector = df[,Y:=0][Improved == "Marked",Y:=1][,Y]
# Following is the same process as other demo
cat("Learning...\n")
bst <- xgboost(data = sparse_matrix, label = output_vector, max_depth = 9,
eta = 1, nthread = 2, nrounds = 10, objective = "binary:logistic")
importance <- xgb.importance(feature_names = colnames(sparse_matrix), model = bst)
print(importance)
# According to the matrix below, the most important feature in this dataset to predict if the treatment will work is the Age. The second most important feature is having received a placebo or not. The sex is third. Then we see our generated features (AgeDiscret). We can see that their contribution is very low (Gain column).
# Does these result make sense?
# Let's check some Chi2 between each of these features and the outcome.
print(chisq.test(df$Age, df$Y))
# Pearson correlation between Age and illness disappearing is 35
print(chisq.test(df$AgeDiscret, df$Y))
# Our first simplification of Age gives a Pearson correlation of 8.
print(chisq.test(df$AgeCat, df$Y))
# The perfectly random split I did between young and old at 30 years old have a low correlation of 2. It's a result we may expect as may be in my mind > 30 years is being old (I am 32 and starting feeling old, this may explain that), but for the illness we are studying, the age to be vulnerable is not the same. Don't let your "gut" lower the quality of your model. In "data science", there is science :-)
# As you can see, in general destroying information by simplifying it won't improve your model. Chi2 just demonstrates that. But in more complex cases, creating a new feature based on existing one which makes link with the outcome more obvious may help the algorithm and improve the model. The case studied here is not enough complex to show that. Check Kaggle forum for some challenging datasets.
# However it's almost always worse when you add some arbitrary rules.
# Moreover, you can notice that even if we have added some not useful new features highly correlated with other features, the boosting tree algorithm have been able to choose the best one, which in this case is the Age. Linear model may not be that strong in these scenario.

View File

@@ -0,0 +1,51 @@
require(xgboost)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
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)
nrounds <- 2
param <- list(max_depth=2, eta=1, silent=1, nthread=2, objective='binary:logistic')
cat('running cross validation\n')
# do cross validation, this will print result out as
# [iteration] metric_name:mean_value+std_value
# std_value is standard deviation of the metric
xgb.cv(param, dtrain, nrounds, nfold=5, metrics={'error'})
cat('running cross validation, disable standard deviation display\n')
# do cross validation, this will print result out as
# [iteration] metric_name:mean_value+std_value
# std_value is standard deviation of the metric
xgb.cv(param, dtrain, nrounds, nfold=5,
metrics='error', showsd = FALSE)
###
# you can also do cross validation with cutomized loss function
# See custom_objective.R
##
print ('running cross validation, with cutomsized loss function')
logregobj <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
preds <- 1/(1 + exp(-preds))
grad <- preds - labels
hess <- preds * (1 - preds)
return(list(grad = grad, hess = hess))
}
evalerror <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
err <- as.numeric(sum(labels != (preds > 0)))/length(labels)
return(list(metric = "error", value = err))
}
param <- list(max_depth=2, eta=1, silent=1,
objective = logregobj, eval_metric = evalerror)
# train with customized objective
xgb.cv(params = param, data = dtrain, nrounds = nrounds, nfold = 5)
# do cross validation with prediction values for each fold
res <- xgb.cv(params = param, data = dtrain, nrounds = nrounds, nfold = 5, prediction = TRUE)
res$evaluation_log
length(res$pred)

View File

@@ -0,0 +1,65 @@
require(xgboost)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
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)
# 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
watchlist <- list(eval = dtest, train = dtrain)
num_round <- 2
# user define objective function, given prediction, return gradient and second order gradient
# this is loglikelihood loss
logregobj <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
preds <- 1/(1 + exp(-preds))
grad <- preds - labels
hess <- preds * (1 - preds)
return(list(grad = grad, hess = hess))
}
# user defined evaluation function, return a pair metric_name, result
# NOTE: when you do customized loss function, the default prediction value is margin
# this may make buildin evalution metric not function properly
# for example, we are doing logistic loss, the prediction is score before logistic transformation
# the buildin evaluation error assumes input is after logistic transformation
# Take this in mind when you use the customization, and maybe you need write customized evaluation function
evalerror <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
err <- as.numeric(sum(labels != (preds > 0)))/length(labels)
return(list(metric = "error", value = err))
}
param <- list(max_depth=2, eta=1, nthread = 2, verbosity=0,
objective=logregobj, eval_metric=evalerror)
print ('start training with user customized objective')
# training with customized objective, we can also do step by step training
# simply look at xgboost.py's implementation of train
bst <- xgb.train(param, dtrain, num_round, watchlist)
#
# there can be cases where you want additional information
# being considered besides the property of DMatrix you can get by getinfo
# you can set additional information as attributes if DMatrix
# set label attribute of dtrain to be label, we use label as an example, it can be anything
attr(dtrain, 'label') <- getinfo(dtrain, 'label')
# this is new customized objective, where you can access things you set
# same thing applies to customized evaluation function
logregobjattr <- function(preds, dtrain) {
# now you can access the attribute in customized function
labels <- attr(dtrain, 'label')
preds <- 1/(1 + exp(-preds))
grad <- preds - labels
hess <- preds * (1 - preds)
return(list(grad = grad, hess = hess))
}
param <- list(max_depth=2, eta=1, nthread = 2, verbosity=0,
objective=logregobjattr, eval_metric=evalerror)
print ('start training with user customized objective, with additional attributes in DMatrix')
# training with customized objective, we can also do step by step training
# simply look at xgboost.py's implementation of train
bst <- xgb.train(param, dtrain, num_round, watchlist)

View File

@@ -0,0 +1,40 @@
require(xgboost)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
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)
# 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, nthread=2, verbosity=0)
watchlist <- list(eval = dtest)
num_round <- 20
# user define objective function, given prediction, return gradient and second order gradient
# this is loglikelihood loss
logregobj <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
preds <- 1/(1 + exp(-preds))
grad <- preds - labels
hess <- preds * (1 - preds)
return(list(grad = grad, hess = hess))
}
# user defined evaluation function, return a pair metric_name, result
# NOTE: when you do customized loss function, the default prediction value is margin
# this may make buildin evalution metric not function properly
# for example, we are doing logistic loss, the prediction is score before logistic transformation
# the buildin evaluation error assumes input is after logistic transformation
# Take this in mind when you use the customization, and maybe you need write customized evaluation function
evalerror <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
err <- as.numeric(sum(labels != (preds > 0)))/length(labels)
return(list(metric = "error", value = err))
}
print ('start training with early Stopping setting')
bst <- xgb.train(param, dtrain, num_round, watchlist,
objective = logregobj, eval_metric = evalerror, maximize = FALSE,
early_stopping_round = 3)
bst <- xgb.cv(param, dtrain, num_round, nfold = 5,
objective = logregobj, eval_metric = evalerror,
maximize = FALSE, early_stopping_rounds = 3)

View File

@@ -0,0 +1,34 @@
require(xgboost)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
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)
##
# this script demonstrate how to fit generalized linear model in xgboost
# basically, we are using linear model, instead of tree for our boosters
# you can fit a linear regression, or logistic regression model
##
# change booster to gblinear, so that we are fitting a linear model
# alpha is the L1 regularizer
# lambda is the L2 regularizer
# you can also set lambda_bias which is L2 regularizer on the bias term
param <- list(objective = "binary:logistic", booster = "gblinear",
nthread = 2, alpha = 0.0001, lambda = 1)
# normally, you do not need to set eta (step_size)
# XGBoost uses a parallel coordinate descent algorithm (shotgun),
# there could be affection on convergence with parallelization on certain cases
# setting eta to be smaller value, e.g 0.5 can make the optimization more stable
##
# the rest of settings are the same
##
watchlist <- list(eval = dtest, train = dtrain)
num_round <- 2
bst <- xgb.train(param, dtrain, num_round, watchlist)
ypred <- predict(bst, dtest)
labels <- getinfo(dtest, 'label')
cat('error of preds=', mean(as.numeric(ypred>0.5)!=labels),'\n')

View File

@@ -0,0 +1,45 @@
# An example of using GPU-accelerated tree building algorithms
#
# NOTE: it can only run if you have a CUDA-enable GPU and the package was
# specially compiled with GPU support.
#
# For the current functionality, see
# https://xgboost.readthedocs.io/en/latest/gpu/index.html
#
library('xgboost')
# Simulate N x p random matrix with some binomial response dependent on pp columns
set.seed(111)
N <- 1000000
p <- 50
pp <- 25
X <- matrix(runif(N * p), ncol = p)
betas <- 2 * runif(pp) - 1
sel <- sort(sample(p, pp))
m <- X[, sel] %*% betas - 1 + rnorm(N)
y <- rbinom(N, 1, plogis(m))
tr <- sample.int(N, N * 0.75)
dtrain <- xgb.DMatrix(X[tr,], label = y[tr])
dtest <- xgb.DMatrix(X[-tr,], label = y[-tr])
wl <- list(train = dtrain, test = dtest)
# An example of running 'gpu_hist' algorithm
# which is
# - similar to the 'hist'
# - the fastest option for moderately large datasets
# - current limitations: max_depth < 16, does not implement guided loss
# You can use tree_method = 'gpu_exact' for another GPU accelerated algorithm,
# which is slower, more memory-hungry, but does not use binning.
param <- list(objective = 'reg:logistic', eval_metric = 'auc', subsample = 0.5, nthread = 4,
max_bin = 64, tree_method = 'gpu_hist')
pt <- proc.time()
bst_gpu <- xgb.train(param, dtrain, watchlist = wl, nrounds = 50)
proc.time() - pt
# Compare to the 'hist' algorithm:
param$tree_method <- 'hist'
pt <- proc.time()
bst_hist <- xgb.train(param, dtrain, watchlist = wl, nrounds = 50)
proc.time() - pt

View File

@@ -0,0 +1,105 @@
library(xgboost)
library(data.table)
set.seed(1024)
# Function to obtain a list of interactions fitted in trees, requires input of maximum depth
treeInteractions <- function(input_tree, input_max_depth){
trees <- copy(input_tree) # copy tree input to prevent overwriting
if (input_max_depth < 2) return(list()) # no interactions if max depth < 2
if (nrow(input_tree) == 1) return(list())
# Attach parent nodes
for (i in 2:input_max_depth){
if (i == 2) trees[, ID_merge:=ID] else trees[, ID_merge:=get(paste0('parent_',i-2))]
parents_left <- trees[!is.na(Split), list(i.id=ID, i.feature=Feature, ID_merge=Yes)]
parents_right <- trees[!is.na(Split), list(i.id=ID, i.feature=Feature, ID_merge=No)]
setorderv(trees, 'ID_merge')
setorderv(parents_left, 'ID_merge')
setorderv(parents_right, 'ID_merge')
trees <- merge(trees, parents_left, by='ID_merge', all.x=T)
trees[!is.na(i.id), c(paste0('parent_', i-1), paste0('parent_feat_', i-1)):=list(i.id, i.feature)]
trees[, c('i.id','i.feature'):=NULL]
trees <- merge(trees, parents_right, by='ID_merge', all.x=T)
trees[!is.na(i.id), c(paste0('parent_', i-1), paste0('parent_feat_', i-1)):=list(i.id, i.feature)]
trees[, c('i.id','i.feature'):=NULL]
}
# Extract nodes with interactions
interaction_trees <- trees[!is.na(Split) & !is.na(parent_1),
c('Feature',paste0('parent_feat_',1:(input_max_depth-1))), with=F]
interaction_trees_split <- split(interaction_trees, 1:nrow(interaction_trees))
interaction_list <- lapply(interaction_trees_split, as.character)
# Remove NAs (no parent interaction)
interaction_list <- lapply(interaction_list, function(x) x[!is.na(x)])
# Remove non-interactions (same variable)
interaction_list <- lapply(interaction_list, unique) # remove same variables
interaction_length <- sapply(interaction_list, length)
interaction_list <- interaction_list[interaction_length > 1]
interaction_list <- unique(lapply(interaction_list, sort))
return(interaction_list)
}
# Generate sample data
x <- list()
for (i in 1:10){
x[[i]] = i*rnorm(1000, 10)
}
x <- as.data.table(x)
y = -1*x[, rowSums(.SD)] + x[['V1']]*x[['V2']] + x[['V3']]*x[['V4']]*x[['V5']] + rnorm(1000, 0.001) + 3*sin(x[['V7']])
train = as.matrix(x)
# Interaction constraint list (column names form)
interaction_list <- list(c('V1','V2'),c('V3','V4','V5'))
# Convert interaction constraint list into feature index form
cols2ids <- function(object, col_names) {
LUT <- seq_along(col_names) - 1
names(LUT) <- col_names
rapply(object, function(x) LUT[x], classes="character", how="replace")
}
interaction_list_fid = cols2ids(interaction_list, colnames(train))
# Fit model with interaction constraints
bst = xgboost(data = train, label = y, max_depth = 4,
eta = 0.1, nthread = 2, nrounds = 1000,
interaction_constraints = interaction_list_fid)
bst_tree <- xgb.model.dt.tree(colnames(train), bst)
bst_interactions <- treeInteractions(bst_tree, 4) # interactions constrained to combinations of V1*V2 and V3*V4*V5
# Fit model without interaction constraints
bst2 = xgboost(data = train, label = y, max_depth = 4,
eta = 0.1, nthread = 2, nrounds = 1000)
bst2_tree <- xgb.model.dt.tree(colnames(train), bst2)
bst2_interactions <- treeInteractions(bst2_tree, 4) # much more interactions
# Fit model with both interaction and monotonicity constraints
bst3 = xgboost(data = train, label = y, max_depth = 4,
eta = 0.1, nthread = 2, nrounds = 1000,
interaction_constraints = interaction_list_fid,
monotone_constraints = c(-1,0,0,0,0,0,0,0,0,0))
bst3_tree <- xgb.model.dt.tree(colnames(train), bst3)
bst3_interactions <- treeInteractions(bst3_tree, 4) # interactions still constrained to combinations of V1*V2 and V3*V4*V5
# Show monotonic constraints still apply by checking scores after incrementing V1
x1 <- sort(unique(x[['V1']]))
for (i in 1:length(x1)){
testdata <- copy(x[, -c('V1')])
testdata[['V1']] <- x1[i]
testdata <- testdata[, paste0('V',1:10), with=F]
pred <- predict(bst3, as.matrix(testdata))
# Should not print out anything due to monotonic constraints
if (i > 1) if (any(pred > prev_pred)) print(i)
prev_pred <- pred
}

View File

@@ -0,0 +1,7 @@
data(mtcars)
head(mtcars)
bst = xgboost(data=as.matrix(mtcars[,-11]),label=mtcars[,11],
objective='count:poisson',nrounds=5)
pred = predict(bst,as.matrix(mtcars[,-11]))
sqrt(mean((pred-mtcars[,11])^2))

View File

@@ -0,0 +1,23 @@
require(xgboost)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
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')
watchlist <- list(eval = dtest, train = dtrain)
nrounds = 2
# training the model for two rounds
bst = xgb.train(param, dtrain, nrounds, nthread = 2, watchlist)
cat('start testing prediction from first n trees\n')
labels <- getinfo(dtest,'label')
### predict using first 1 tree
ypred1 = predict(bst, dtest, ntreelimit=1)
# by default, we predict using all the trees
ypred2 = predict(bst, dtest)
cat('error of ypred1=', mean(as.numeric(ypred1>0.5)!=labels),'\n')
cat('error of ypred2=', mean(as.numeric(ypred2>0.5)!=labels),'\n')

View File

@@ -0,0 +1,53 @@
require(xgboost)
require(data.table)
require(Matrix)
set.seed(1982)
# load in the agaricus dataset
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
dtrain <- xgb.DMatrix(data = agaricus.train$data, label = agaricus.train$label)
dtest <- xgb.DMatrix(data = agaricus.test$data, label = agaricus.test$label)
param <- list(max_depth=2, eta=1, silent=1, objective='binary:logistic')
nrounds = 4
# training the model for two rounds
bst = xgb.train(params = param, data = dtrain, nrounds = nrounds, nthread = 2)
# Model accuracy without new features
accuracy.before <- sum((predict(bst, agaricus.test$data) >= 0.5) == agaricus.test$label) / length(agaricus.test$label)
# by default, we predict using all the trees
pred_with_leaf = predict(bst, dtest, predleaf = TRUE)
head(pred_with_leaf)
create.new.tree.features <- function(model, original.features){
pred_with_leaf <- predict(model, original.features, predleaf = TRUE)
cols <- list()
for(i in 1:model$niter){
# max is not the real max but it s not important for the purpose of adding features
leaf.id <- sort(unique(pred_with_leaf[,i]))
cols[[i]] <- factor(x = pred_with_leaf[,i], level = leaf.id)
}
cbind(original.features, sparse.model.matrix( ~ . -1, as.data.frame(cols)))
}
# Convert previous features to one hot encoding
new.features.train <- create.new.tree.features(bst, agaricus.train$data)
new.features.test <- create.new.tree.features(bst, agaricus.test$data)
colnames(new.features.test) <- colnames(new.features.train)
# learning with new features
new.dtrain <- xgb.DMatrix(data = new.features.train, label = agaricus.train$label)
new.dtest <- xgb.DMatrix(data = new.features.test, label = agaricus.test$label)
watchlist <- list(train = new.dtrain)
bst <- xgb.train(params = param, data = new.dtrain, nrounds = nrounds, nthread = 2)
# Model accuracy with new features
accuracy.after <- sum((predict(bst, new.dtest) >= 0.5) == agaricus.test$label) / length(agaricus.test$label)
# Here the accuracy was already good and is now perfect.
cat(paste("The accuracy was", accuracy.before, "before adding leaf features and it is now", accuracy.after, "!\n"))

14
R-package/demo/runall.R Normal file
View File

@@ -0,0 +1,14 @@
# running all scripts in demo folder
demo(basic_walkthrough)
demo(custom_objective)
demo(boost_from_prediction)
demo(predict_first_ntree)
demo(generalized_linear_model)
demo(cross_validation)
demo(create_sparse_matrix)
demo(predict_leaf_indices)
demo(early_stopping)
demo(poisson_regression)
demo(caret_wrapper)
demo(tweedie_regression)
#demo(gpu_accelerated) # can only run when built with GPU support

View File

@@ -0,0 +1,49 @@
library(xgboost)
library(data.table)
library(cplm)
data(AutoClaim)
# auto insurance dataset analyzed by Yip and Yau (2005)
dt <- data.table(AutoClaim)
# exclude these columns from the model matrix
exclude <- c('POLICYNO', 'PLCYDATE', 'CLM_FREQ5', 'CLM_AMT5', 'CLM_FLAG', 'IN_YY')
# retains the missing values
# NOTE: this dataset is comes ready out of the box
options(na.action = 'na.pass')
x <- sparse.model.matrix(~ . - 1, data = dt[, -exclude, with = F])
options(na.action = 'na.omit')
# response
y <- dt[, CLM_AMT5]
d_train <- xgb.DMatrix(data = x, label = y, missing = NA)
# the tweedie_variance_power parameter determines the shape of
# distribution
# - closer to 1 is more poisson like and the mass
# is more concentrated near zero
# - closer to 2 is more gamma like and the mass spreads to the
# the right with less concentration near zero
params <- list(
objective = 'reg:tweedie',
eval_metric = 'rmse',
tweedie_variance_power = 1.4,
max_depth = 6,
eta = 1)
bst <- xgb.train(
data = d_train,
params = params,
maximize = FALSE,
watchlist = list(train = d_train),
nrounds = 20)
var_imp <- xgb.importance(attr(x, 'Dimnames')[[2]], model = bst)
preds <- predict(bst, d_train)
rmse <- sqrt(sum(mean((y - preds)^2)))

View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgboost.R
\docType{data}
\name{agaricus.test}
\alias{agaricus.test}
\title{Test part from Mushroom Data Set}
\format{A list containing a label vector, and a dgCMatrix object with 1611
rows and 126 variables}
\usage{
data(agaricus.test)
}
\description{
This data set is originally from the Mushroom data set,
UCI Machine Learning Repository.
}
\details{
This data set includes the following fields:
\itemize{
\item \code{label} the label for each record
\item \code{data} a sparse Matrix of \code{dgCMatrix} class, with 126 columns.
}
}
\references{
https://archive.ics.uci.edu/ml/datasets/Mushroom
Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository
[http://archive.ics.uci.edu/ml]. Irvine, CA: University of California,
School of Information and Computer Science.
}
\keyword{datasets}

View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgboost.R
\docType{data}
\name{agaricus.train}
\alias{agaricus.train}
\title{Training part from Mushroom Data Set}
\format{A list containing a label vector, and a dgCMatrix object with 6513
rows and 127 variables}
\usage{
data(agaricus.train)
}
\description{
This data set is originally from the Mushroom data set,
UCI Machine Learning Repository.
}
\details{
This data set includes the following fields:
\itemize{
\item \code{label} the label for each record
\item \code{data} a sparse Matrix of \code{dgCMatrix} class, with 126 columns.
}
}
\references{
https://archive.ics.uci.edu/ml/datasets/Mushroom
Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository
[http://archive.ics.uci.edu/ml]. Irvine, CA: University of California,
School of Information and Computer Science.
}
\keyword{datasets}

View File

@@ -0,0 +1,37 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{callbacks}
\alias{callbacks}
\title{Callback closures for booster training.}
\description{
These are used to perform various service tasks either during boosting iterations or at the end.
This approach helps to modularize many of such tasks without bloating the main training methods,
and it offers .
}
\details{
By default, a callback function is run after each boosting iteration.
An R-attribute \code{is_pre_iteration} could be set for a callback to define a pre-iteration function.
When a callback function has \code{finalize} parameter, its finalizer part will also be run after
the boosting is completed.
WARNING: side-effects!!! Be aware that these callback functions access and modify things in
the environment from which they are called from, which is a fairly uncommon thing to do in R.
To write a custom callback closure, make sure you first understand the main concepts about R environments.
Check either R documentation on \code{\link[base]{environment}} or the
\href{http://adv-r.had.co.nz/Environments.html}{Environments chapter} from the "Advanced R"
book by Hadley Wickham. Further, the best option is to read the code of some of the existing callbacks -
choose ones that do something similar to what you want to achieve. Also, you would need to get familiar
with the objects available inside of the \code{xgb.train} and \code{xgb.cv} internal environments.
}
\seealso{
\code{\link{cb.print.evaluation}},
\code{\link{cb.evaluation.log}},
\code{\link{cb.reset.parameters}},
\code{\link{cb.early.stop}},
\code{\link{cb.save.model}},
\code{\link{cb.cv.predict}},
\code{\link{xgb.train}},
\code{\link{xgb.cv}}
}

View File

@@ -0,0 +1,43 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.cv.predict}
\alias{cb.cv.predict}
\title{Callback closure for returning cross-validation based predictions.}
\usage{
cb.cv.predict(save_models = FALSE)
}
\arguments{
\item{save_models}{a flag for whether to save the folds' models.}
}
\value{
Predictions are returned inside of the \code{pred} element, which is either a vector or a matrix,
depending on the number of prediction outputs per data row. The order of predictions corresponds
to the order of rows in the original dataset. Note that when a custom \code{folds} list is
provided in \code{xgb.cv}, the predictions would only be returned properly when this list is a
non-overlapping list of k sets of indices, as in a standard k-fold CV. The predictions would not be
meaningful when user-provided folds have overlapping indices as in, e.g., random sampling splits.
When some of the indices in the training dataset are not included into user-provided \code{folds},
their prediction value would be \code{NA}.
}
\description{
Callback closure for returning cross-validation based predictions.
}
\details{
This callback function saves predictions for all of the test folds,
and also allows to save the folds' models.
It is a "finalizer" callback and it uses early stopping information whenever it is available,
thus it must be run after the early stopping callback if the early stopping is used.
Callback function expects the following values to be set in its calling frame:
\code{bst_folds},
\code{basket},
\code{data},
\code{end_iteration},
\code{params},
\code{num_parallel_tree},
\code{num_class}.
}
\seealso{
\code{\link{callbacks}}
}

View File

@@ -0,0 +1,62 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.early.stop}
\alias{cb.early.stop}
\title{Callback closure to activate the early stopping.}
\usage{
cb.early.stop(stopping_rounds, maximize = FALSE, metric_name = NULL,
verbose = TRUE)
}
\arguments{
\item{stopping_rounds}{The number of rounds with no improvement in
the evaluation metric in order to stop the training.}
\item{maximize}{whether to maximize the evaluation metric}
\item{metric_name}{the name of an evaluation column to use as a criteria for early
stopping. If not set, the last column would be used.
Let's say the test data in \code{watchlist} was labelled as \code{dtest},
and one wants to use the AUC in test data for early stopping regardless of where
it is in the \code{watchlist}, then one of the following would need to be set:
\code{metric_name='dtest-auc'} or \code{metric_name='dtest_auc'}.
All dash '-' characters in metric names are considered equivalent to '_'.}
\item{verbose}{whether to print the early stopping information.}
}
\description{
Callback closure to activate the early stopping.
}
\details{
This callback function determines the condition for early stopping
by setting the \code{stop_condition = TRUE} flag in its calling frame.
The following additional fields are assigned to the model's R object:
\itemize{
\item \code{best_score} the evaluation score at the best iteration
\item \code{best_iteration} at which boosting iteration the best score has occurred (1-based index)
\item \code{best_ntreelimit} to use with the \code{ntreelimit} parameter in \code{predict}.
It differs from \code{best_iteration} in multiclass or random forest settings.
}
The Same values are also stored as xgb-attributes:
\itemize{
\item \code{best_iteration} is stored as a 0-based iteration index (for interoperability of binary models)
\item \code{best_msg} message string is also stored.
}
At least one data element is required in the evaluation watchlist for early stopping to work.
Callback function expects the following values to be set in its calling frame:
\code{stop_condition},
\code{bst_evaluation},
\code{rank},
\code{bst} (or \code{bst_folds} and \code{basket}),
\code{iteration},
\code{begin_iteration},
\code{end_iteration},
\code{num_parallel_tree}.
}
\seealso{
\code{\link{callbacks}},
\code{\link{xgb.attr}}
}

View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.evaluation.log}
\alias{cb.evaluation.log}
\title{Callback closure for logging the evaluation history}
\usage{
cb.evaluation.log()
}
\description{
Callback closure for logging the evaluation history
}
\details{
This callback function appends the current iteration evaluation results \code{bst_evaluation}
available in the calling parent frame to the \code{evaluation_log} list in a calling frame.
The finalizer callback (called with \code{finalize = TURE} in the end) converts
the \code{evaluation_log} list into a final data.table.
The iteration evaluation result \code{bst_evaluation} must be a named numeric vector.
Note: in the column names of the final data.table, the dash '-' character is replaced with
the underscore '_' in order to make the column names more like regular R identifiers.
Callback function expects the following values to be set in its calling frame:
\code{evaluation_log},
\code{bst_evaluation},
\code{iteration}.
}
\seealso{
\code{\link{callbacks}}
}

View File

@@ -0,0 +1,95 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.gblinear.history}
\alias{cb.gblinear.history}
\title{Callback closure for collecting the model coefficients history of a gblinear booster
during its training.}
\usage{
cb.gblinear.history(sparse = FALSE)
}
\arguments{
\item{sparse}{when set to FALSE/TURE, a dense/sparse matrix is used to store the result.
Sparse format is useful when one expects only a subset of coefficients to be non-zero,
when using the "thrifty" feature selector with fairly small number of top features
selected per iteration.}
}
\value{
Results are stored in the \code{coefs} element of the closure.
The \code{\link{xgb.gblinear.history}} convenience function provides an easy way to access it.
With \code{xgb.train}, it is either a dense of a sparse matrix.
While with \code{xgb.cv}, it is a list (an element per each fold) of such matrices.
}
\description{
Callback closure for collecting the model coefficients history of a gblinear booster
during its training.
}
\details{
To keep things fast and simple, gblinear booster does not internally store the history of linear
model coefficients at each boosting iteration. This callback provides a workaround for storing
the coefficients' path, by extracting them after each training iteration.
Callback function expects the following values to be set in its calling frame:
\code{bst} (or \code{bst_folds}).
}
\examples{
#### Binary classification:
#
# In the iris dataset, it is hard to linearly separate Versicolor class from the rest
# without considering the 2nd order interactions:
require(magrittr)
x <- model.matrix(Species ~ .^2, iris)[,-1]
colnames(x)
dtrain <- xgb.DMatrix(scale(x), label = 1*(iris$Species == "versicolor"))
param <- list(booster = "gblinear", objective = "reg:logistic", eval_metric = "auc",
lambda = 0.0003, alpha = 0.0003, nthread = 2)
# For 'shotgun', which is a default linear updater, using high eta values may result in
# unstable behaviour in some datasets. With this simple dataset, however, the high learning
# rate does not break the convergence, but allows us to illustrate the typical pattern of
# "stochastic explosion" behaviour of this lock-free algorithm at early boosting iterations.
bst <- xgb.train(param, dtrain, list(tr=dtrain), nrounds = 200, eta = 1.,
callbacks = list(cb.gblinear.history()))
# Extract the coefficients' path and plot them vs boosting iteration number:
coef_path <- xgb.gblinear.history(bst)
matplot(coef_path, type = 'l')
# With the deterministic coordinate descent updater, it is safer to use higher learning rates.
# Will try the classical componentwise boosting which selects a single best feature per round:
bst <- xgb.train(param, dtrain, list(tr=dtrain), nrounds = 200, eta = 0.8,
updater = 'coord_descent', feature_selector = 'thrifty', top_k = 1,
callbacks = list(cb.gblinear.history()))
xgb.gblinear.history(bst) \%>\% matplot(type = 'l')
# Componentwise boosting is known to have similar effect to Lasso regularization.
# Try experimenting with various values of top_k, eta, nrounds,
# as well as different feature_selectors.
# For xgb.cv:
bst <- xgb.cv(param, dtrain, nfold = 5, nrounds = 100, eta = 0.8,
callbacks = list(cb.gblinear.history()))
# coefficients in the CV fold #3
xgb.gblinear.history(bst)[[3]] \%>\% matplot(type = 'l')
#### Multiclass classification:
#
dtrain <- xgb.DMatrix(scale(x), label = as.numeric(iris$Species) - 1)
param <- list(booster = "gblinear", objective = "multi:softprob", num_class = 3,
lambda = 0.0003, alpha = 0.0003, nthread = 2)
# For the default linear updater 'shotgun' it sometimes is helpful
# to use smaller eta to reduce instability
bst <- xgb.train(param, dtrain, list(tr=dtrain), nrounds = 70, eta = 0.5,
callbacks = list(cb.gblinear.history()))
# Will plot the coefficient paths separately for each class:
xgb.gblinear.history(bst, class_index = 0) \%>\% matplot(type = 'l')
xgb.gblinear.history(bst, class_index = 1) \%>\% matplot(type = 'l')
xgb.gblinear.history(bst, class_index = 2) \%>\% matplot(type = 'l')
# CV:
bst <- xgb.cv(param, dtrain, nfold = 5, nrounds = 70, eta = 0.5,
callbacks = list(cb.gblinear.history(FALSE)))
# 1st forld of 1st class
xgb.gblinear.history(bst, class_index = 0)[[1]] \%>\% matplot(type = 'l')
}
\seealso{
\code{\link{callbacks}}, \code{\link{xgb.gblinear.history}}.
}

View File

@@ -0,0 +1,29 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.print.evaluation}
\alias{cb.print.evaluation}
\title{Callback closure for printing the result of evaluation}
\usage{
cb.print.evaluation(period = 1, showsd = TRUE)
}
\arguments{
\item{period}{results would be printed every number of periods}
\item{showsd}{whether standard deviations should be printed (when available)}
}
\description{
Callback closure for printing the result of evaluation
}
\details{
The callback function prints the result of evaluation at every \code{period} iterations.
The initial and the last iteration's evaluations are always printed.
Callback function expects the following values to be set in its calling frame:
\code{bst_evaluation} (also \code{bst_evaluation_err} when available),
\code{iteration},
\code{begin_iteration},
\code{end_iteration}.
}
\seealso{
\code{\link{callbacks}}
}

View File

@@ -0,0 +1,36 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.reset.parameters}
\alias{cb.reset.parameters}
\title{Callback closure for resetting the booster's parameters at each iteration.}
\usage{
cb.reset.parameters(new_params)
}
\arguments{
\item{new_params}{a list where each element corresponds to a parameter that needs to be reset.
Each element's value must be either a vector of values of length \code{nrounds}
to be set at each iteration,
or a function of two parameters \code{learning_rates(iteration, nrounds)}
which returns a new parameter value by using the current iteration number
and the total number of boosting rounds.}
}
\description{
Callback closure for resetting the booster's parameters at each iteration.
}
\details{
This is a "pre-iteration" callback function used to reset booster's parameters
at the beginning of each iteration.
Note that when training is resumed from some previous model, and a function is used to
reset a parameter value, the \code{nrounds} argument in this function would be the
the number of boosting rounds in the current training.
Callback function expects the following values to be set in its calling frame:
\code{bst} or \code{bst_folds},
\code{iteration},
\code{begin_iteration},
\code{end_iteration}.
}
\seealso{
\code{\link{callbacks}}
}

View File

@@ -0,0 +1,33 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{cb.save.model}
\alias{cb.save.model}
\title{Callback closure for saving a model file.}
\usage{
cb.save.model(save_period = 0, save_name = "xgboost.model")
}
\arguments{
\item{save_period}{save the model to disk after every
\code{save_period} iterations; 0 means save the model at the end.}
\item{save_name}{the name or path for the saved model file.
It can contain a \code{\link[base]{sprintf}} formatting specifier
to include the integer iteration number in the file name.
E.g., with \code{save_name} = 'xgboost_%04d.model',
the file saved at iteration 50 would be named "xgboost_0050.model".}
}
\description{
Callback closure for saving a model file.
}
\details{
This callback function allows to save an xgb-model file, either periodically after each \code{save_period}'s or at the end.
Callback function expects the following values to be set in its calling frame:
\code{bst},
\code{iteration},
\code{begin_iteration},
\code{end_iteration}.
}
\seealso{
\code{\link{callbacks}}
}

View File

@@ -0,0 +1,28 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{dim.xgb.DMatrix}
\alias{dim.xgb.DMatrix}
\title{Dimensions of xgb.DMatrix}
\usage{
\method{dim}{xgb.DMatrix}(x)
}
\arguments{
\item{x}{Object of class \code{xgb.DMatrix}}
}
\description{
Returns a vector of numbers of rows and of columns in an \code{xgb.DMatrix}.
}
\details{
Note: since \code{nrow} and \code{ncol} internally use \code{dim}, they can also
be directly used with an \code{xgb.DMatrix} object.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
stopifnot(nrow(dtrain) == nrow(train$data))
stopifnot(ncol(dtrain) == ncol(train$data))
stopifnot(all(dim(dtrain) == dim(train$data)))
}

View File

@@ -0,0 +1,35 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{dimnames.xgb.DMatrix}
\alias{dimnames.xgb.DMatrix}
\alias{dimnames<-.xgb.DMatrix}
\title{Handling of column names of \code{xgb.DMatrix}}
\usage{
\method{dimnames}{xgb.DMatrix}(x)
\method{dimnames}{xgb.DMatrix}(x) <- value
}
\arguments{
\item{x}{object of class \code{xgb.DMatrix}}
\item{value}{a list of two elements: the first one is ignored
and the second one is column names}
}
\description{
Only column names are supported for \code{xgb.DMatrix}, thus setting of
row names would have no effect and returned row names would be NULL.
}
\details{
Generic \code{dimnames} methods are used by \code{colnames}.
Since row names are irrelevant, it is recommended to use \code{colnames} directly.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
dimnames(dtrain)
colnames(dtrain)
colnames(dtrain) <- make.names(1:ncol(train$data))
print(dtrain, verbose=TRUE)
}

45
R-package/man/getinfo.Rd Normal file
View File

@@ -0,0 +1,45 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{getinfo}
\alias{getinfo}
\alias{getinfo.xgb.DMatrix}
\title{Get information of an xgb.DMatrix object}
\usage{
getinfo(object, ...)
\method{getinfo}{xgb.DMatrix}(object, name, ...)
}
\arguments{
\item{object}{Object of class \code{xgb.DMatrix}}
\item{...}{other parameters}
\item{name}{the name of the information field to get (see details)}
}
\description{
Get information of an xgb.DMatrix object
}
\details{
The \code{name} field can be one of the following:
\itemize{
\item \code{label}: label Xgboost learn from ;
\item \code{weight}: to do a weight rescale ;
\item \code{base_margin}: base margin is the base prediction Xgboost will boost from ;
\item \code{nrow}: number of rows of the \code{xgb.DMatrix}.
}
\code{group} can be setup by \code{setinfo} but can't be retrieved by \code{getinfo}.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
labels <- getinfo(dtrain, 'label')
setinfo(dtrain, 'label', 1-labels)
labels2 <- getinfo(dtrain, 'label')
stopifnot(all(labels2 == 1-labels))
}

View File

@@ -0,0 +1,189 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.Booster.R
\name{predict.xgb.Booster}
\alias{predict.xgb.Booster}
\alias{predict.xgb.Booster.handle}
\title{Predict method for eXtreme Gradient Boosting model}
\usage{
\method{predict}{xgb.Booster}(object, newdata, missing = NA,
outputmargin = FALSE, ntreelimit = NULL, predleaf = FALSE,
predcontrib = FALSE, approxcontrib = FALSE, predinteraction = FALSE,
reshape = FALSE, ...)
\method{predict}{xgb.Booster.handle}(object, ...)
}
\arguments{
\item{object}{Object of class \code{xgb.Booster} or \code{xgb.Booster.handle}}
\item{newdata}{takes \code{matrix}, \code{dgCMatrix}, local data file or \code{xgb.DMatrix}.}
\item{missing}{Missing is only used when input is dense matrix. Pick a float value that represents
missing values in data (e.g., sometimes 0 or some other extreme value is used).}
\item{outputmargin}{whether the prediction should be returned in the for of original untransformed
sum of predictions from boosting iterations' results. E.g., setting \code{outputmargin=TRUE} for
logistic regression would result in predictions for log-odds instead of probabilities.}
\item{ntreelimit}{limit the number of model's trees or boosting iterations used in prediction (see Details).
It will use all the trees by default (\code{NULL} value).}
\item{predleaf}{whether predict leaf index.}
\item{predcontrib}{whether to return feature contributions to individual predictions (see Details).}
\item{approxcontrib}{whether to use a fast approximation for feature contributions (see Details).}
\item{predinteraction}{whether to return contributions of feature interactions to individual predictions (see Details).}
\item{reshape}{whether to reshape the vector of predictions to a matrix form when there are several
prediction outputs per case. This option has no effect when either of predleaf, predcontrib,
or predinteraction flags is TRUE.}
\item{...}{Parameters passed to \code{predict.xgb.Booster}}
}
\value{
For regression or binary classification, it returns a vector of length \code{nrows(newdata)}.
For multiclass classification, either a \code{num_class * nrows(newdata)} vector or
a \code{(nrows(newdata), num_class)} dimension matrix is returned, depending on
the \code{reshape} value.
When \code{predleaf = TRUE}, the output is a matrix object with the
number of columns corresponding to the number of trees.
When \code{predcontrib = TRUE} and it is not a multiclass setting, the output is a matrix object with
\code{num_features + 1} columns. The last "+ 1" column in a matrix corresponds to bias.
For a multiclass case, a list of \code{num_class} elements is returned, where each element is
such a matrix. The contribution values are on the scale of untransformed margin
(e.g., for binary classification would mean that the contributions are log-odds deviations from bias).
When \code{predinteraction = TRUE} and it is not a multiclass setting, the output is a 3d array with
dimensions \code{c(nrow, num_features + 1, num_features + 1)}. The off-diagonal (in the last two dimensions)
elements represent different features interaction contributions. The array is symmetric WRT the last
two dimensions. The "+ 1" columns corresponds to bias. Summing this array along the last dimension should
produce practically the same result as predict with \code{predcontrib = TRUE}.
For a multiclass case, a list of \code{num_class} elements is returned, where each element is
such an array.
}
\description{
Predicted values based on either xgboost model or model handle object.
}
\details{
Note that \code{ntreelimit} is not necessarily equal to the number of boosting iterations
and it is not necessarily equal to the number of trees in a model.
E.g., in a random forest-like model, \code{ntreelimit} would limit the number of trees.
But for multiclass classification, while there are multiple trees per iteration,
\code{ntreelimit} limits the number of boosting iterations.
Also note that \code{ntreelimit} would currently do nothing for predictions from gblinear,
since gblinear doesn't keep its boosting history.
One possible practical applications of the \code{predleaf} option is to use the model
as a generator of new features which capture non-linearity and interactions,
e.g., as implemented in \code{\link{xgb.create.features}}.
Setting \code{predcontrib = TRUE} allows to calculate contributions of each feature to
individual predictions. For "gblinear" booster, feature contributions are simply linear terms
(feature_beta * feature_value). For "gbtree" booster, feature contributions are SHAP
values (Lundberg 2017) that sum to the difference between the expected output
of the model and the current prediction (where the hessian weights are used to compute the expectations).
Setting \code{approxcontrib = TRUE} approximates these values following the idea explained
in \url{http://blog.datadive.net/interpreting-random-forests/}.
With \code{predinteraction = TRUE}, SHAP values of contributions of interaction of each pair of features
are computed. Note that this operation might be rather expensive in terms of compute and memory.
Since it quadratically depends on the number of features, it is recommended to perform selection
of the most important features first. See below about the format of the returned results.
}
\examples{
## binary classification:
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 0.5, nthread = 2, nrounds = 5, objective = "binary:logistic")
# use all trees by default
pred <- predict(bst, test$data)
# use only the 1st tree
pred1 <- predict(bst, test$data, ntreelimit = 1)
# Predicting tree leafs:
# the result is an nsamples X ntrees matrix
pred_leaf <- predict(bst, test$data, predleaf = TRUE)
str(pred_leaf)
# Predicting feature contributions to predictions:
# the result is an nsamples X (nfeatures + 1) matrix
pred_contr <- predict(bst, test$data, predcontrib = TRUE)
str(pred_contr)
# verify that contributions' sums are equal to log-odds of predictions (up to float precision):
summary(rowSums(pred_contr) - qlogis(pred))
# for the 1st record, let's inspect its features that had non-zero contribution to prediction:
contr1 <- pred_contr[1,]
contr1 <- contr1[-length(contr1)] # drop BIAS
contr1 <- contr1[contr1 != 0] # drop non-contributing features
contr1 <- contr1[order(abs(contr1))] # order by contribution magnitude
old_mar <- par("mar")
par(mar = old_mar + c(0,7,0,0))
barplot(contr1, horiz = TRUE, las = 2, xlab = "contribution to prediction in log-odds")
par(mar = old_mar)
## multiclass classification in iris dataset:
lb <- as.numeric(iris$Species) - 1
num_class <- 3
set.seed(11)
bst <- xgboost(data = as.matrix(iris[, -5]), label = lb,
max_depth = 4, eta = 0.5, nthread = 2, nrounds = 10, subsample = 0.5,
objective = "multi:softprob", num_class = num_class)
# predict for softmax returns num_class probability numbers per case:
pred <- predict(bst, as.matrix(iris[, -5]))
str(pred)
# reshape it to a num_class-columns matrix
pred <- matrix(pred, ncol=num_class, byrow=TRUE)
# convert the probabilities to softmax labels
pred_labels <- max.col(pred) - 1
# the following should result in the same error as seen in the last iteration
sum(pred_labels != lb)/length(lb)
# compare that to the predictions from softmax:
set.seed(11)
bst <- xgboost(data = as.matrix(iris[, -5]), label = lb,
max_depth = 4, eta = 0.5, nthread = 2, nrounds = 10, subsample = 0.5,
objective = "multi:softmax", num_class = num_class)
pred <- predict(bst, as.matrix(iris[, -5]))
str(pred)
all.equal(pred, pred_labels)
# prediction from using only 5 iterations should result
# in the same error as seen in iteration 5:
pred5 <- predict(bst, as.matrix(iris[, -5]), ntreelimit=5)
sum(pred5 != lb)/length(lb)
## random forest-like model of 25 trees for binary classification:
set.seed(11)
bst <- xgboost(data = train$data, label = train$label, max_depth = 5,
nthread = 2, nrounds = 1, objective = "binary:logistic",
num_parallel_tree = 25, subsample = 0.6, colsample_bytree = 0.1)
# Inspect the prediction error vs number of trees:
lb <- test$label
dtest <- xgb.DMatrix(test$data, label=lb)
err <- sapply(1:25, function(n) {
pred <- predict(bst, dtest, ntreelimit=n)
sum((pred > 0.5) != lb)/length(lb)
})
plot(err, type='l', ylim=c(0,0.1), xlab='#trees')
}
\references{
Scott M. Lundberg, Su-In Lee, "A Unified Approach to Interpreting Model Predictions", NIPS Proceedings 2017, \url{https://arxiv.org/abs/1705.07874}
Scott M. Lundberg, Su-In Lee, "Consistent feature attribution for tree ensembles", \url{https://arxiv.org/abs/1706.06060}
}
\seealso{
\code{\link{xgb.train}}.
}

View File

@@ -0,0 +1,29 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.Booster.R
\name{print.xgb.Booster}
\alias{print.xgb.Booster}
\title{Print xgb.Booster}
\usage{
\method{print}{xgb.Booster}(x, verbose = FALSE, ...)
}
\arguments{
\item{x}{an xgb.Booster object}
\item{verbose}{whether to print detailed data (e.g., attribute values)}
\item{...}{not currently used}
}
\description{
Print information about xgb.Booster.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
attr(bst, 'myattr') <- 'memo'
print(bst)
print(bst, verbose=TRUE)
}

View File

@@ -0,0 +1,28 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{print.xgb.DMatrix}
\alias{print.xgb.DMatrix}
\title{Print xgb.DMatrix}
\usage{
\method{print}{xgb.DMatrix}(x, verbose = FALSE, ...)
}
\arguments{
\item{x}{an xgb.DMatrix object}
\item{verbose}{whether to print colnames (when present)}
\item{...}{not currently used}
}
\description{
Print information about xgb.DMatrix.
Currently it displays dimensions and presence of info-fields and colnames.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
dtrain
print(dtrain, verbose=TRUE)
}

View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.cv.R
\name{print.xgb.cv.synchronous}
\alias{print.xgb.cv.synchronous}
\title{Print xgb.cv result}
\usage{
\method{print}{xgb.cv.synchronous}(x, verbose = FALSE, ...)
}
\arguments{
\item{x}{an \code{xgb.cv.synchronous} object}
\item{verbose}{whether to print detailed data}
\item{...}{passed to \code{data.table.print}}
}
\description{
Prints formatted results of \code{xgb.cv}.
}
\details{
When not verbose, it would only print the evaluation results,
including the best iteration (when available).
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
cv <- xgb.cv(data = train$data, label = train$label, nfold = 5, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
print(cv)
print(cv, verbose=TRUE)
}

43
R-package/man/setinfo.Rd Normal file
View File

@@ -0,0 +1,43 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{setinfo}
\alias{setinfo}
\alias{setinfo.xgb.DMatrix}
\title{Set information of an xgb.DMatrix object}
\usage{
setinfo(object, ...)
\method{setinfo}{xgb.DMatrix}(object, name, info, ...)
}
\arguments{
\item{object}{Object of class "xgb.DMatrix"}
\item{...}{other parameters}
\item{name}{the name of the field to get}
\item{info}{the specific field of information to set}
}
\description{
Set information of an xgb.DMatrix object
}
\details{
The \code{name} field can be one of the following:
\itemize{
\item \code{label}: label Xgboost learn from ;
\item \code{weight}: to do a weight rescale ;
\item \code{base_margin}: base margin is the base prediction Xgboost will boost from ;
\item \code{group}: number of rows in each group (to use with \code{rank:pairwise} objective).
}
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
labels <- getinfo(dtrain, 'label')
setinfo(dtrain, 'label', 1-labels)
labels2 <- getinfo(dtrain, 'label')
stopifnot(all.equal(labels2, 1-labels))
}

View File

@@ -0,0 +1,40 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{slice}
\alias{slice}
\alias{slice.xgb.DMatrix}
\alias{[.xgb.DMatrix}
\title{Get a new DMatrix containing the specified rows of
original xgb.DMatrix object}
\usage{
slice(object, ...)
\method{slice}{xgb.DMatrix}(object, idxset, ...)
\method{[}{xgb.DMatrix}(object, idxset, colset = NULL)
}
\arguments{
\item{object}{Object of class "xgb.DMatrix"}
\item{...}{other parameters (currently not used)}
\item{idxset}{a integer vector of indices of rows needed}
\item{colset}{currently not used (columns subsetting is not available)}
}
\description{
Get a new DMatrix containing the specified rows of
original xgb.DMatrix object
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
dsub <- slice(dtrain, 1:42)
labels1 <- getinfo(dsub, 'label')
dsub <- dtrain[1:42, ]
labels2 <- getinfo(dsub, 'label')
all.equal(labels1, labels2)
}

View File

@@ -0,0 +1,50 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.Booster.R
\name{xgb.Booster.complete}
\alias{xgb.Booster.complete}
\title{Restore missing parts of an incomplete xgb.Booster object.}
\usage{
xgb.Booster.complete(object, saveraw = TRUE)
}
\arguments{
\item{object}{object of class \code{xgb.Booster}}
\item{saveraw}{a flag indicating whether to append \code{raw} Booster memory dump data
when it doesn't already exist.}
}
\value{
An object of \code{xgb.Booster} class.
}
\description{
It attempts to complete an \code{xgb.Booster} object by restoring either its missing
raw model memory dump (when it has no \code{raw} data but its \code{xgb.Booster.handle} is valid)
or its missing internal handle (when its \code{xgb.Booster.handle} is not valid
but it has a raw Booster memory dump).
}
\details{
While this method is primarily for internal use, it might be useful in some practical situations.
E.g., when an \code{xgb.Booster} model is saved as an R object and then is loaded as an R object,
its handle (pointer) to an internal xgboost model would be invalid. The majority of xgboost methods
should still work for such a model object since those methods would be using
\code{xgb.Booster.complete} internally. However, one might find it to be more efficient to call the
\code{xgb.Booster.complete} function explicitly once after loading a model as an R-object.
That would prevent further repeated implicit reconstruction of an internal booster model.
}
\examples{
data(agaricus.train, package='xgboost')
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
saveRDS(bst, "xgb.model.rds")
bst1 <- readRDS("xgb.model.rds")
if (file.exists("xgb.model.rds")) file.remove("xgb.model.rds")
# the handle is invalid:
print(bst1$handle)
bst1 <- xgb.Booster.complete(bst1)
# now the handle points to a valid internal booster model:
print(bst1$handle)
}

View File

@@ -0,0 +1,35 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.R
\name{xgb.DMatrix}
\alias{xgb.DMatrix}
\title{Construct xgb.DMatrix object}
\usage{
xgb.DMatrix(data, info = list(), missing = NA, silent = FALSE, ...)
}
\arguments{
\item{data}{a \code{matrix} object (either numeric or integer), a \code{dgCMatrix} object, or a character
string representing a filename.}
\item{info}{a named list of additional information to store in the \code{xgb.DMatrix} object.
See \code{\link{setinfo}} for the specific allowed kinds of}
\item{missing}{a float value to represents missing values in data (used only when input is a dense matrix).
It is useful when a 0 or some other extreme value represents missing values in data.}
\item{silent}{whether to suppress printing an informational message after loading from a file.}
\item{...}{the \code{info} data could be passed directly as parameters, without creating an \code{info} list.}
}
\description{
Construct xgb.DMatrix object from either a dense matrix, a sparse matrix, or a local file.
Supported input file formats are either a libsvm text file or a binary file that was created previously by
\code{\link{xgb.DMatrix.save}}).
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
xgb.DMatrix.save(dtrain, 'xgb.DMatrix.data')
dtrain <- xgb.DMatrix('xgb.DMatrix.data')
if (file.exists('xgb.DMatrix.data')) file.remove('xgb.DMatrix.data')
}

View File

@@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.DMatrix.save.R
\name{xgb.DMatrix.save}
\alias{xgb.DMatrix.save}
\title{Save xgb.DMatrix object to binary file}
\usage{
xgb.DMatrix.save(dmatrix, fname)
}
\arguments{
\item{dmatrix}{the \code{xgb.DMatrix} object}
\item{fname}{the name of the file to write.}
}
\description{
Save xgb.DMatrix object to binary file
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
xgb.DMatrix.save(dtrain, 'xgb.DMatrix.data')
dtrain <- xgb.DMatrix('xgb.DMatrix.data')
if (file.exists('xgb.DMatrix.data')) file.remove('xgb.DMatrix.data')
}

86
R-package/man/xgb.attr.Rd Normal file
View File

@@ -0,0 +1,86 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.Booster.R
\name{xgb.attr}
\alias{xgb.attr}
\alias{xgb.attr<-}
\alias{xgb.attributes}
\alias{xgb.attributes<-}
\title{Accessors for serializable attributes of a model.}
\usage{
xgb.attr(object, name)
xgb.attr(object, name) <- value
xgb.attributes(object)
xgb.attributes(object) <- value
}
\arguments{
\item{object}{Object of class \code{xgb.Booster} or \code{xgb.Booster.handle}.}
\item{name}{a non-empty character string specifying which attribute is to be accessed.}
\item{value}{a value of an attribute for \code{xgb.attr<-}; for \code{xgb.attributes<-}
it's a list (or an object coercible to a list) with the names of attributes to set
and the elements corresponding to attribute values.
Non-character values are converted to character.
When attribute value is not a scalar, only the first index is used.
Use \code{NULL} to remove an attribute.}
}
\value{
\code{xgb.attr} returns either a string value of an attribute
or \code{NULL} if an attribute wasn't stored in a model.
\code{xgb.attributes} returns a list of all attribute stored in a model
or \code{NULL} if a model has no stored attributes.
}
\description{
These methods allow to manipulate the key-value attribute strings of an xgboost model.
}
\details{
The primary purpose of xgboost model attributes is to store some meta-data about the model.
Note that they are a separate concept from the object attributes in R.
Specifically, they refer to key-value strings that can be attached to an xgboost model,
stored together with the model's binary representation, and accessed later
(from R or any other interface).
In contrast, any R-attribute assigned to an R-object of \code{xgb.Booster} class
would not be saved by \code{xgb.save} because an xgboost model is an external memory object
and its serialization is handled externally.
Also, setting an attribute that has the same name as one of xgboost's parameters wouldn't
change the value of that parameter for a model.
Use \code{\link{xgb.parameters<-}} to set or change model parameters.
The attribute setters would usually work more efficiently for \code{xgb.Booster.handle}
than for \code{xgb.Booster}, since only just a handle (pointer) would need to be copied.
That would only matter if attributes need to be set many times.
Note, however, that when feeding a handle of an \code{xgb.Booster} object to the attribute setters,
the raw model cache of an \code{xgb.Booster} object would not be automatically updated,
and it would be user's responsibility to call \code{xgb.save.raw} to update it.
The \code{xgb.attributes<-} setter either updates the existing or adds one or several attributes,
but it doesn't delete the other existing attributes.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
xgb.attr(bst, "my_attribute") <- "my attribute value"
print(xgb.attr(bst, "my_attribute"))
xgb.attributes(bst) <- list(a = 123, b = "abc")
xgb.save(bst, 'xgb.model')
bst1 <- xgb.load('xgb.model')
if (file.exists('xgb.model')) file.remove('xgb.model')
print(xgb.attr(bst1, "my_attribute"))
print(xgb.attributes(bst1))
# deletion:
xgb.attr(bst1, "my_attribute") <- NULL
print(xgb.attributes(bst1))
xgb.attributes(bst1) <- list(a = NULL, b = NULL)
print(xgb.attributes(bst1))
}

View File

@@ -0,0 +1,92 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.create.features.R
\name{xgb.create.features}
\alias{xgb.create.features}
\title{Create new features from a previously learned model}
\usage{
xgb.create.features(model, data, ...)
}
\arguments{
\item{model}{decision tree boosting model learned on the original data}
\item{data}{original data (usually provided as a \code{dgCMatrix} matrix)}
\item{...}{currently not used}
}
\value{
\code{dgCMatrix} matrix including both the original data and the new features.
}
\description{
May improve the learning by adding new features to the training data based on the decision trees from a previously learned model.
}
\details{
This is the function inspired from the paragraph 3.1 of the paper:
\strong{Practical Lessons from Predicting Clicks on Ads at Facebook}
\emph{(Xinran He, Junfeng Pan, Ou Jin, Tianbing Xu, Bo Liu, Tao Xu, Yan, xin Shi, Antoine Atallah, Ralf Herbrich, Stuart Bowers,
Joaquin Quinonero Candela)}
International Workshop on Data Mining for Online Advertising (ADKDD) - August 24, 2014
\url{https://research.fb.com/publications/practical-lessons-from-predicting-clicks-on-ads-at-facebook/}.
Extract explaining the method:
"We found that boosted decision trees are a powerful and very
convenient way to implement non-linear and tuple transformations
of the kind we just described. We treat each individual
tree as a categorical feature that takes as value the
index of the leaf an instance ends up falling in. We use
1-of-K coding of this type of features.
For example, consider the boosted tree model in Figure 1 with 2 subtrees,
where the first subtree has 3 leafs and the second 2 leafs. If an
instance ends up in leaf 2 in the first subtree and leaf 1 in
second subtree, the overall input to the linear classifier will
be the binary vector \code{[0, 1, 0, 1, 0]}, where the first 3 entries
correspond to the leaves of the first subtree and last 2 to
those of the second subtree.
[...]
We can understand boosted decision tree
based transformation as a supervised feature encoding that
converts a real-valued vector into a compact binary-valued
vector. A traversal from root node to a leaf node represents
a rule on certain features."
}
\examples{
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
dtrain <- xgb.DMatrix(data = agaricus.train$data, label = agaricus.train$label)
dtest <- xgb.DMatrix(data = agaricus.test$data, label = agaricus.test$label)
param <- list(max_depth=2, eta=1, silent=1, objective='binary:logistic')
nrounds = 4
bst = xgb.train(params = param, data = dtrain, nrounds = nrounds, nthread = 2)
# Model accuracy without new features
accuracy.before <- sum((predict(bst, agaricus.test$data) >= 0.5) == agaricus.test$label) /
length(agaricus.test$label)
# Convert previous features to one hot encoding
new.features.train <- xgb.create.features(model = bst, agaricus.train$data)
new.features.test <- xgb.create.features(model = bst, agaricus.test$data)
# learning with new features
new.dtrain <- xgb.DMatrix(data = new.features.train, label = agaricus.train$label)
new.dtest <- xgb.DMatrix(data = new.features.test, label = agaricus.test$label)
watchlist <- list(train = new.dtrain)
bst <- xgb.train(params = param, data = new.dtrain, nrounds = nrounds, nthread = 2)
# Model accuracy with new features
accuracy.after <- sum((predict(bst, new.dtest) >= 0.5) == agaricus.test$label) /
length(agaricus.test$label)
# Here the accuracy was already good and is now perfect.
cat(paste("The accuracy was", accuracy.before, "before adding leaf features and it is now",
accuracy.after, "!\\n"))
}

144
R-package/man/xgb.cv.Rd Normal file
View File

@@ -0,0 +1,144 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.cv.R
\name{xgb.cv}
\alias{xgb.cv}
\title{Cross Validation}
\usage{
xgb.cv(params = list(), data, nrounds, nfold, label = NULL, missing = NA,
prediction = FALSE, showsd = TRUE, metrics = list(), obj = NULL,
feval = NULL, stratified = TRUE, folds = NULL, verbose = TRUE,
print_every_n = 1L, early_stopping_rounds = NULL, maximize = NULL,
callbacks = list(), ...)
}
\arguments{
\item{params}{the list of parameters. Commonly used ones are:
\itemize{
\item \code{objective} objective function, common ones are
\itemize{
\item \code{reg:squarederror} Regression with squared loss
\item \code{binary:logistic} logistic regression for classification
}
\item \code{eta} step size of each boosting step
\item \code{max_depth} maximum depth of the tree
\item \code{nthread} number of thread used in training, if not set, all threads are used
}
See \code{\link{xgb.train}} for further details.
See also demo/ for walkthrough example in R.}
\item{data}{takes an \code{xgb.DMatrix}, \code{matrix}, or \code{dgCMatrix} as the input.}
\item{nrounds}{the max number of iterations}
\item{nfold}{the original dataset is randomly partitioned into \code{nfold} equal size subsamples.}
\item{label}{vector of response values. Should be provided only when data is an R-matrix.}
\item{missing}{is only used when input is a dense matrix. By default is set to NA, which means
that NA values should be considered as 'missing' by the algorithm.
Sometimes, 0 or other extreme value might be used to represent missing values.}
\item{prediction}{A logical value indicating whether to return the test fold predictions
from each CV model. This parameter engages the \code{\link{cb.cv.predict}} callback.}
\item{showsd}{\code{boolean}, whether to show standard deviation of cross validation}
\item{metrics, }{list of evaluation metrics to be used in cross validation,
when it is not specified, the evaluation metric is chosen according to objective function.
Possible options are:
\itemize{
\item \code{error} binary classification error rate
\item \code{rmse} Rooted mean square error
\item \code{logloss} negative log-likelihood function
\item \code{auc} Area under curve
\item \code{aucpr} Area under PR curve
\item \code{merror} Exact matching error, used to evaluate multi-class classification
}}
\item{obj}{customized objective function. Returns gradient and second order
gradient with given prediction and dtrain.}
\item{feval}{customized evaluation function. Returns
\code{list(metric='metric-name', value='metric-value')} with given
prediction and dtrain.}
\item{stratified}{a \code{boolean} indicating whether sampling of folds should be stratified
by the values of outcome labels.}
\item{folds}{\code{list} provides a possibility to use a list of pre-defined CV folds
(each element must be a vector of test fold's indices). When folds are supplied,
the \code{nfold} and \code{stratified} parameters are ignored.}
\item{verbose}{\code{boolean}, print the statistics during the process}
\item{print_every_n}{Print each n-th iteration evaluation messages when \code{verbose>0}.
Default is 1 which means all messages are printed. This parameter is passed to the
\code{\link{cb.print.evaluation}} callback.}
\item{early_stopping_rounds}{If \code{NULL}, the early stopping function is not triggered.
If set to an integer \code{k}, training with a validation set will stop if the performance
doesn't improve for \code{k} rounds.
Setting this parameter engages the \code{\link{cb.early.stop}} callback.}
\item{maximize}{If \code{feval} and \code{early_stopping_rounds} are set,
then this parameter must be set as well.
When it is \code{TRUE}, it means the larger the evaluation score the better.
This parameter is passed to the \code{\link{cb.early.stop}} callback.}
\item{callbacks}{a list of callback functions to perform various task during boosting.
See \code{\link{callbacks}}. Some of the callbacks are automatically created depending on the
parameters' values. User can provide either existing or their own callback methods in order
to customize the training process.}
\item{...}{other parameters to pass to \code{params}.}
}
\value{
An object of class \code{xgb.cv.synchronous} with the following elements:
\itemize{
\item \code{call} a function call.
\item \code{params} parameters that were passed to the xgboost library. Note that it does not
capture parameters changed by the \code{\link{cb.reset.parameters}} callback.
\item \code{callbacks} callback functions that were either automatically assigned or
explicitly passed.
\item \code{evaluation_log} evaluation history stored as a \code{data.table} with the
first column corresponding to iteration number and the rest corresponding to the
CV-based evaluation means and standard deviations for the training and test CV-sets.
It is created by the \code{\link{cb.evaluation.log}} callback.
\item \code{niter} number of boosting iterations.
\item \code{nfeatures} number of features in training data.
\item \code{folds} the list of CV folds' indices - either those passed through the \code{folds}
parameter or randomly generated.
\item \code{best_iteration} iteration number with the best evaluation metric value
(only available with early stopping).
\item \code{best_ntreelimit} the \code{ntreelimit} value corresponding to the best iteration,
which could further be used in \code{predict} method
(only available with early stopping).
\item \code{pred} CV prediction values available when \code{prediction} is set.
It is either vector or matrix (see \code{\link{cb.cv.predict}}).
\item \code{models} a liost of the CV folds' models. It is only available with the explicit
setting of the \code{cb.cv.predict(save_models = TRUE)} callback.
}
}
\description{
The cross validation function of xgboost
}
\details{
The original sample is randomly partitioned into \code{nfold} equal size subsamples.
Of the \code{nfold} subsamples, a single subsample is retained as the validation data for testing the model, and the remaining \code{nfold - 1} subsamples are used as training data.
The cross-validation process is then repeated \code{nrounds} times, with each of the \code{nfold} subsamples used exactly once as the validation data.
All observations are used for both training and validation.
Adapted from \url{http://en.wikipedia.org/wiki/Cross-validation_\%28statistics\%29#k-fold_cross-validation}
}
\examples{
data(agaricus.train, package='xgboost')
dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
cv <- xgb.cv(data = dtrain, nrounds = 3, nthread = 2, nfold = 5, metrics = list("rmse","auc"),
max_depth = 3, eta = 1, objective = "binary:logistic")
print(cv)
print(cv, verbose=TRUE)
}

56
R-package/man/xgb.dump.Rd Normal file
View File

@@ -0,0 +1,56 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.dump.R
\name{xgb.dump}
\alias{xgb.dump}
\title{Dump an xgboost model in text format.}
\usage{
xgb.dump(model, fname = NULL, fmap = "", with_stats = FALSE,
dump_format = c("text", "json"), ...)
}
\arguments{
\item{model}{the model object.}
\item{fname}{the name of the text file where to save the model text dump.
If not provided or set to \code{NULL}, the model is returned as a \code{character} vector.}
\item{fmap}{feature map file representing feature types.
Detailed description could be found at
\url{https://github.com/dmlc/xgboost/wiki/Binary-Classification#dump-model}.
See demo/ for walkthrough example in R, and
\url{https://github.com/dmlc/xgboost/blob/master/demo/data/featmap.txt}
for example Format.}
\item{with_stats}{whether to dump some additional statistics about the splits.
When this option is on, the model dump contains two additional values:
gain is the approximate loss function gain we get in each split;
cover is the sum of second order gradient in each node.}
\item{dump_format}{either 'text' or 'json' format could be specified.}
\item{...}{currently not used}
}
\value{
If fname is not provided or set to \code{NULL} the function will return the model
as a \code{character} vector. Otherwise it will return \code{TRUE}.
}
\description{
Dump an xgboost model in text format.
}
\examples{
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
# save the model in file 'xgb.model.dump'
dump_path = file.path(tempdir(), 'model.dump')
xgb.dump(bst, dump_path, with_stats = TRUE)
# print the model without saving it to a file
print(xgb.dump(bst, with_stats = TRUE))
# print in JSON format:
cat(xgb.dump(bst, with_stats = TRUE, dump_format='json'))
}

View File

@@ -0,0 +1,29 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/callbacks.R
\name{xgb.gblinear.history}
\alias{xgb.gblinear.history}
\title{Extract gblinear coefficients history.}
\usage{
xgb.gblinear.history(model, class_index = NULL)
}
\arguments{
\item{model}{either an \code{xgb.Booster} or a result of \code{xgb.cv()}, trained
using the \code{cb.gblinear.history()} callback.}
\item{class_index}{zero-based class index to extract the coefficients for only that
specific class in a multinomial multiclass model. When it is NULL, all the
coefficients are returned. Has no effect in non-multiclass models.}
}
\value{
For an \code{xgb.train} result, a matrix (either dense or sparse) with the columns
corresponding to iteration's coefficients (in the order as \code{xgb.dump()} would
return) and the rows corresponding to boosting iterations.
For an \code{xgb.cv} result, a list of such matrices is returned with the elements
corresponding to CV folds.
}
\description{
A helper function to extract the matrix of linear coefficients' history
from a gblinear model created while using the \code{cb.gblinear.history()}
callback.
}

View File

@@ -0,0 +1,95 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.importance.R
\name{xgb.importance}
\alias{xgb.importance}
\title{Importance of features in a model.}
\usage{
xgb.importance(feature_names = NULL, model = NULL, trees = NULL,
data = NULL, label = NULL, target = NULL)
}
\arguments{
\item{feature_names}{character vector of feature names. If the model already
contains feature names, those would be used when \code{feature_names=NULL} (default value).
Non-null \code{feature_names} could be provided to override those in the model.}
\item{model}{object of class \code{xgb.Booster}.}
\item{trees}{(only for the gbtree booster) an integer vector of tree indices that should be included
into the importance calculation. If set to \code{NULL}, all trees of the model are parsed.
It could be useful, e.g., in multiclass classification to get feature importances
for each class separately. IMPORTANT: the tree index in xgboost models
is zero-based (e.g., use \code{trees = 0:4} for first 5 trees).}
\item{data}{deprecated.}
\item{label}{deprecated.}
\item{target}{deprecated.}
}
\value{
For a tree model, a \code{data.table} with the following columns:
\itemize{
\item \code{Features} names of the features used in the model;
\item \code{Gain} represents fractional contribution of each feature to the model based on
the total gain of this feature's splits. Higher percentage means a more important
predictive feature.
\item \code{Cover} metric of the number of observation related to this feature;
\item \code{Frequency} percentage representing the relative number of times
a feature have been used in trees.
}
A linear model's importance \code{data.table} has the following columns:
\itemize{
\item \code{Features} names of the features used in the model;
\item \code{Weight} the linear coefficient of this feature;
\item \code{Class} (only for multiclass models) class label.
}
If \code{feature_names} is not provided and \code{model} doesn't have \code{feature_names},
index of the features will be used instead. Because the index is extracted from the model dump
(based on C++ code), it starts at 0 (as in C/C++ or Python) instead of 1 (usual in R).
}
\description{
Creates a \code{data.table} of feature importances in a model.
}
\details{
This function works for both linear and tree models.
For linear models, the importance is the absolute magnitude of linear coefficients.
For that reason, in order to obtain a meaningful ranking by importance for a linear model,
the features need to be on the same scale (which you also would want to do when using either
L1 or L2 regularization).
}
\examples{
# binomial classification using gbtree:
data(agaricus.train, package='xgboost')
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
xgb.importance(model = bst)
# binomial classification using gblinear:
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, booster = "gblinear",
eta = 0.3, nthread = 1, nrounds = 20, objective = "binary:logistic")
xgb.importance(model = bst)
# multiclass classification using gbtree:
nclass <- 3
nrounds <- 10
mbst <- xgboost(data = as.matrix(iris[, -5]), label = as.numeric(iris$Species) - 1,
max_depth = 3, eta = 0.2, nthread = 2, nrounds = nrounds,
objective = "multi:softprob", num_class = nclass)
# all classes clumped together:
xgb.importance(model = mbst)
# inspect importances separately for each class:
xgb.importance(model = mbst, trees = seq(from=0, by=nclass, length.out=nrounds))
xgb.importance(model = mbst, trees = seq(from=1, by=nclass, length.out=nrounds))
xgb.importance(model = mbst, trees = seq(from=2, by=nclass, length.out=nrounds))
# multiclass classification using gblinear:
mbst <- xgboost(data = scale(as.matrix(iris[, -5])), label = as.numeric(iris$Species) - 1,
booster = "gblinear", eta = 0.2, nthread = 1, nrounds = 15,
objective = "multi:softprob", num_class = nclass)
xgb.importance(model = mbst)
}

41
R-package/man/xgb.load.Rd Normal file
View File

@@ -0,0 +1,41 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.load.R
\name{xgb.load}
\alias{xgb.load}
\title{Load xgboost model from binary file}
\usage{
xgb.load(modelfile)
}
\arguments{
\item{modelfile}{the name of the binary input file.}
}
\value{
An object of \code{xgb.Booster} class.
}
\description{
Load xgboost model from the binary model file.
}
\details{
The input file is expected to contain a model saved in an xgboost-internal binary format
using either \code{\link{xgb.save}} or \code{\link{cb.save.model}} in R, or using some
appropriate methods from other xgboost interfaces. E.g., a model trained in Python and
saved from there in xgboost format, could be loaded from R.
Note: a model saved as an R-object, has to be loaded using corresponding R-methods,
not \code{xgb.load}.
}
\examples{
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
xgb.save(bst, 'xgb.model')
bst <- xgb.load('xgb.model')
if (file.exists('xgb.model')) file.remove('xgb.model')
pred <- predict(bst, test$data)
}
\seealso{
\code{\link{xgb.save}}, \code{\link{xgb.Booster.complete}}.
}

View File

@@ -0,0 +1,77 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.model.dt.tree.R
\name{xgb.model.dt.tree}
\alias{xgb.model.dt.tree}
\title{Parse a boosted tree model text dump}
\usage{
xgb.model.dt.tree(feature_names = NULL, model = NULL, text = NULL,
trees = NULL, use_int_id = FALSE, ...)
}
\arguments{
\item{feature_names}{character vector of feature names. If the model already
contains feature names, those would be used when \code{feature_names=NULL} (default value).
Non-null \code{feature_names} could be provided to override those in the model.}
\item{model}{object of class \code{xgb.Booster}}
\item{text}{\code{character} vector previously generated by the \code{xgb.dump}
function (where parameter \code{with_stats = TRUE} should have been set).
\code{text} takes precedence over \code{model}.}
\item{trees}{an integer vector of tree indices that should be parsed.
If set to \code{NULL}, all trees of the model are parsed.
It could be useful, e.g., in multiclass classification to get only
the trees of one certain class. IMPORTANT: the tree index in xgboost models
is zero-based (e.g., use \code{trees = 0:4} for first 5 trees).}
\item{use_int_id}{a logical flag indicating whether nodes in columns "Yes", "No", "Missing" should be
represented as integers (when FALSE) or as "Tree-Node" character strings (when FALSE).}
\item{...}{currently not used.}
}
\value{
A \code{data.table} with detailed information about model trees' nodes.
The columns of the \code{data.table} are:
\itemize{
\item \code{Tree}: integer ID of a tree in a model (zero-based index)
\item \code{Node}: integer ID of a node in a tree (zero-based index)
\item \code{ID}: character identifier of a node in a model (only when \code{use_int_id=FALSE})
\item \code{Feature}: for a branch node, it's a feature id or name (when available);
for a leaf note, it simply labels it as \code{'Leaf'}
\item \code{Split}: location of the split for a branch node (split condition is always "less than")
\item \code{Yes}: ID of the next node when the split condition is met
\item \code{No}: ID of the next node when the split condition is not met
\item \code{Missing}: ID of the next node when branch value is missing
\item \code{Quality}: either the split gain (change in loss) or the leaf value
\item \code{Cover}: metric related to the number of observation either seen by a split
or collected by a leaf during training.
}
When \code{use_int_id=FALSE}, columns "Yes", "No", and "Missing" point to model-wide node identifiers
in the "ID" column. When \code{use_int_id=TRUE}, those columns point to node identifiers from
the corresponding trees in the "Node" column.
}
\description{
Parse a boosted tree model text dump into a \code{data.table} structure.
}
\examples{
# Basic use:
data(agaricus.train, package='xgboost')
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2,objective = "binary:logistic")
(dt <- xgb.model.dt.tree(colnames(agaricus.train$data), bst))
# This bst model already has feature_names stored with it, so those would be used when
# feature_names is not set:
(dt <- xgb.model.dt.tree(model = bst))
# How to match feature names of splits that are following a current 'Yes' branch:
merge(dt, dt[, .(ID, Y.Feature=Feature)], by.x='Yes', by.y='ID', all.x=TRUE)[order(Tree,Node)]
}

View File

@@ -0,0 +1,31 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.Booster.R
\name{xgb.parameters<-}
\alias{xgb.parameters<-}
\title{Accessors for model parameters.}
\usage{
xgb.parameters(object) <- value
}
\arguments{
\item{object}{Object of class \code{xgb.Booster} or \code{xgb.Booster.handle}.}
\item{value}{a list (or an object coercible to a list) with the names of parameters to set
and the elements corresponding to parameter values.}
}
\description{
Only the setter for xgboost parameters is currently implemented.
}
\details{
Note that the setter would usually work more efficiently for \code{xgb.Booster.handle}
than for \code{xgb.Booster}, since only just a handle would need to be copied.
}
\examples{
data(agaricus.train, package='xgboost')
train <- agaricus.train
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
xgb.parameters(bst) <- list(eta = 0.1)
}

View File

@@ -0,0 +1,74 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.ggplot.R, R/xgb.plot.deepness.R
\name{xgb.ggplot.deepness}
\alias{xgb.ggplot.deepness}
\alias{xgb.plot.deepness}
\title{Plot model trees deepness}
\usage{
xgb.ggplot.deepness(model = NULL, which = c("2x1", "max.depth", "med.depth",
"med.weight"))
xgb.plot.deepness(model = NULL, which = c("2x1", "max.depth", "med.depth",
"med.weight"), plot = TRUE, ...)
}
\arguments{
\item{model}{either an \code{xgb.Booster} model generated by the \code{xgb.train} function
or a data.table result of the \code{xgb.model.dt.tree} function.}
\item{which}{which distribution to plot (see details).}
\item{plot}{(base R barplot) whether a barplot should be produced.
If FALSE, only a data.table is returned.}
\item{...}{other parameters passed to \code{barplot} or \code{plot}.}
}
\value{
Other than producing plots (when \code{plot=TRUE}), the \code{xgb.plot.deepness} function
silently returns a processed data.table where each row corresponds to a terminal leaf in a tree model,
and contains information about leaf's depth, cover, and weight (which is used in calculating predictions).
The \code{xgb.ggplot.deepness} silently returns either a list of two ggplot graphs when \code{which="2x1"}
or a single ggplot graph for the other \code{which} options.
}
\description{
Visualizes distributions related to depth of tree leafs.
\code{xgb.plot.deepness} uses base R graphics, while \code{xgb.ggplot.deepness} uses the ggplot backend.
}
\details{
When \code{which="2x1"}, two distributions with respect to the leaf depth
are plotted on top of each other:
\itemize{
\item the distribution of the number of leafs in a tree model at a certain depth;
\item the distribution of average weighted number of observations ("cover")
ending up in leafs at certain depth.
}
Those could be helpful in determining sensible ranges of the \code{max_depth}
and \code{min_child_weight} parameters.
When \code{which="max.depth"} or \code{which="med.depth"}, plots of either maximum or median depth
per tree with respect to tree number are created. And \code{which="med.weight"} allows to see how
a tree's median absolute leaf weight changes through the iterations.
This function was inspired by the blog post
\url{https://github.com/aysent/random-forest-leaf-visualization}.
}
\examples{
data(agaricus.train, package='xgboost')
# Change max_depth to a higher number to get a more significant result
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 6,
eta = 0.1, nthread = 2, nrounds = 50, objective = "binary:logistic",
subsample = 0.5, min_child_weight = 2)
xgb.plot.deepness(bst)
xgb.ggplot.deepness(bst)
xgb.plot.deepness(bst, which='max.depth', pch=16, col=rgb(0,0,1,0.3), cex=2)
xgb.plot.deepness(bst, which='med.weight', pch=16, col=rgb(0,0,1,0.3), cex=2)
}
\seealso{
\code{\link{xgb.train}}, \code{\link{xgb.model.dt.tree}}.
}

View File

@@ -0,0 +1,81 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.ggplot.R, R/xgb.plot.importance.R
\name{xgb.ggplot.importance}
\alias{xgb.ggplot.importance}
\alias{xgb.plot.importance}
\title{Plot feature importance as a bar graph}
\usage{
xgb.ggplot.importance(importance_matrix = NULL, top_n = NULL,
measure = NULL, rel_to_first = FALSE, n_clusters = c(1:10), ...)
xgb.plot.importance(importance_matrix = NULL, top_n = NULL,
measure = NULL, rel_to_first = FALSE, left_margin = 10, cex = NULL,
plot = TRUE, ...)
}
\arguments{
\item{importance_matrix}{a \code{data.table} returned by \code{\link{xgb.importance}}.}
\item{top_n}{maximal number of top features to include into the plot.}
\item{measure}{the name of importance measure to plot.
When \code{NULL}, 'Gain' would be used for trees and 'Weight' would be used for gblinear.}
\item{rel_to_first}{whether importance values should be represented as relative to the highest ranked feature.
See Details.}
\item{n_clusters}{(ggplot only) a \code{numeric} vector containing the min and the max range
of the possible number of clusters of bars.}
\item{...}{other parameters passed to \code{barplot} (except horiz, border, cex.names, names.arg, and las).}
\item{left_margin}{(base R barplot) allows to adjust the left margin size to fit feature names.
When it is NULL, the existing \code{par('mar')} is used.}
\item{cex}{(base R barplot) passed as \code{cex.names} parameter to \code{barplot}.}
\item{plot}{(base R barplot) whether a barplot should be produced.
If FALSE, only a data.table is returned.}
}
\value{
The \code{xgb.plot.importance} function creates a \code{barplot} (when \code{plot=TRUE})
and silently returns a processed data.table with \code{n_top} features sorted by importance.
The \code{xgb.ggplot.importance} function returns a ggplot graph which could be customized afterwards.
E.g., to change the title of the graph, add \code{+ ggtitle("A GRAPH NAME")} to the result.
}
\description{
Represents previously calculated feature importance as a bar graph.
\code{xgb.plot.importance} uses base R graphics, while \code{xgb.ggplot.importance} uses the ggplot backend.
}
\details{
The graph represents each feature as a horizontal bar of length proportional to the importance of a feature.
Features are shown ranked in a decreasing importance order.
It works for importances from both \code{gblinear} and \code{gbtree} models.
When \code{rel_to_first = FALSE}, the values would be plotted as they were in \code{importance_matrix}.
For gbtree model, that would mean being normalized to the total of 1
("what is feature's importance contribution relative to the whole model?").
For linear models, \code{rel_to_first = FALSE} would show actual values of the coefficients.
Setting \code{rel_to_first = TRUE} allows to see the picture from the perspective of
"what is feature's importance contribution relative to the most important feature?"
The ggplot-backend method also performs 1-D clustering of the importance values,
with bar colors corresponding to different clusters that have somewhat similar importance values.
}
\examples{
data(agaricus.train)
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 3,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
importance_matrix <- xgb.importance(colnames(agaricus.train$data), model = bst)
xgb.plot.importance(importance_matrix, rel_to_first = TRUE, xlab = "Relative importance")
(gg <- xgb.ggplot.importance(importance_matrix, measure = "Frequency", rel_to_first = TRUE))
gg + ggplot2::ylab("Frequency")
}
\seealso{
\code{\link[graphics]{barplot}}.
}

View File

@@ -0,0 +1,75 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.plot.multi.trees.R
\name{xgb.plot.multi.trees}
\alias{xgb.plot.multi.trees}
\title{Project all trees on one tree and plot it}
\usage{
xgb.plot.multi.trees(model, feature_names = NULL, features_keep = 5,
plot_width = NULL, plot_height = NULL, render = TRUE, ...)
}
\arguments{
\item{model}{produced by the \code{xgb.train} function.}
\item{feature_names}{names of each feature as a \code{character} vector.}
\item{features_keep}{number of features to keep in each position of the multi trees.}
\item{plot_width}{width in pixels of the graph to produce}
\item{plot_height}{height in pixels of the graph to produce}
\item{render}{a logical flag for whether the graph should be rendered (see Value).}
\item{...}{currently not used}
}
\value{
When \code{render = TRUE}:
returns a rendered graph object which is an \code{htmlwidget} of class \code{grViz}.
Similar to ggplot objects, it needs to be printed to see it when not running from command line.
When \code{render = FALSE}:
silently returns a graph object which is of DiagrammeR's class \code{dgr_graph}.
This could be useful if one wants to modify some of the graph attributes
before rendering the graph with \code{\link[DiagrammeR]{render_graph}}.
}
\description{
Visualization of the ensemble of trees as a single collective unit.
}
\details{
This function tries to capture the complexity of a gradient boosted tree model
in a cohesive way by compressing an ensemble of trees into a single tree-graph representation.
The goal is to improve the interpretability of a model generally seen as black box.
Note: this function is applicable to tree booster-based models only.
It takes advantage of the fact that the shape of a binary tree is only defined by
its depth (therefore, in a boosting model, all trees have similar shape).
Moreover, the trees tend to reuse the same features.
The function projects each tree onto one, and keeps for each position the
\code{features_keep} first features (based on the Gain per feature measure).
This function is inspired by this blog post:
\url{https://wellecks.wordpress.com/2015/02/21/peering-into-the-black-box-visualizing-lambdamart/}
}
\examples{
data(agaricus.train, package='xgboost')
bst <- xgboost(data = agaricus.train$data, label = agaricus.train$label, max_depth = 15,
eta = 1, nthread = 2, nrounds = 30, objective = "binary:logistic",
min_child_weight = 50, verbose = 0)
p <- xgb.plot.multi.trees(model = bst, features_keep = 3)
print(p)
\dontrun{
# Below is an example of how to save this plot to a file.
# Note that for `export_graph` to work, the DiagrammeRsvg and rsvg packages must also be installed.
library(DiagrammeR)
gr <- xgb.plot.multi.trees(model=bst, features_keep = 3, render=FALSE)
export_graph(gr, 'tree.pdf', width=1500, height=600)
}
}

View File

@@ -0,0 +1,138 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xgb.plot.shap.R
\name{xgb.plot.shap}
\alias{xgb.plot.shap}
\title{SHAP contribution dependency plots}
\usage{
xgb.plot.shap(data, shap_contrib = NULL, features = NULL, top_n = 1,
model = NULL, trees = NULL, target_class = NULL,
approxcontrib = FALSE, subsample = NULL, n_col = 1, col = rgb(0, 0, 1,
0.2), pch = ".", discrete_n_uniq = 5, discrete_jitter = 0.01,
ylab = "SHAP", plot_NA = TRUE, col_NA = rgb(0.7, 0, 1, 0.6),
pch_NA = ".", pos_NA = 1.07, plot_loess = TRUE, col_loess = 2,
span_loess = 0.5, which = c("1d", "2d"), plot = TRUE, ...)
}
\arguments{
\item{data}{data as a \code{matrix} or \code{dgCMatrix}.}
\item{shap_contrib}{a matrix of SHAP contributions that was computed earlier for the above
\code{data}. When it is NULL, it is computed internally using \code{model} and \code{data}.}
\item{features}{a vector of either column indices or of feature names to plot. When it is NULL,
feature importance is calculated, and \code{top_n} high ranked features are taken.}
\item{top_n}{when \code{features} is NULL, top_n [1, 100] most important features in a model are taken.}
\item{model}{an \code{xgb.Booster} model. It has to be provided when either \code{shap_contrib}
or \code{features} is missing.}
\item{trees}{passed to \code{\link{xgb.importance}} when \code{features = NULL}.}
\item{target_class}{is only relevant for multiclass models. When it is set to a 0-based class index,
only SHAP contributions for that specific class are used.
If it is not set, SHAP importances are averaged over all classes.}
\item{approxcontrib}{passed to \code{\link{predict.xgb.Booster}} when \code{shap_contrib = NULL}.}
\item{subsample}{a random fraction of data points to use for plotting. When it is NULL,
it is set so that up to 100K data points are used.}
\item{n_col}{a number of columns in a grid of plots.}
\item{col}{color of the scatterplot markers.}
\item{pch}{scatterplot marker.}
\item{discrete_n_uniq}{a maximal number of unique values in a feature to consider it as discrete.}
\item{discrete_jitter}{an \code{amount} parameter of jitter added to discrete features' positions.}
\item{ylab}{a y-axis label in 1D plots.}
\item{plot_NA}{whether the contributions of cases with missing values should also be plotted.}
\item{col_NA}{a color of marker for missing value contributions.}
\item{pch_NA}{a marker type for NA values.}
\item{pos_NA}{a relative position of the x-location where NA values are shown:
\code{min(x) + (max(x) - min(x)) * pos_NA}.}
\item{plot_loess}{whether to plot loess-smoothed curves. The smoothing is only done for features with
more than 5 distinct values.}
\item{col_loess}{a color to use for the loess curves.}
\item{span_loess}{the \code{span} parameter in \code{\link[stats]{loess}}'s call.}
\item{which}{whether to do univariate or bivariate plotting. NOTE: only 1D is implemented so far.}
\item{plot}{whether a plot should be drawn. If FALSE, only a lits of matrices is returned.}
\item{...}{other parameters passed to \code{plot}.}
}
\value{
In addition to producing plots (when \code{plot=TRUE}), it silently returns a list of two matrices:
\itemize{
\item \code{data} the values of selected features;
\item \code{shap_contrib} the contributions of selected features.
}
}
\description{
Visualizing the SHAP feature contribution to prediction dependencies on feature value.
}
\details{
These scatterplots represent how SHAP feature contributions depend of feature values.
The similarity to partial dependency plots is that they also give an idea for how feature values
affect predictions. However, in partial dependency plots, we usually see marginal dependencies
of model prediction on feature value, while SHAP contribution dependency plots display the estimated
contributions of a feature to model prediction for each individual case.
When \code{plot_loess = TRUE} is set, feature values are rounded to 3 significant digits and
weighted LOESS is computed and plotted, where weights are the numbers of data points
at each rounded value.
Note: SHAP contributions are shown on the scale of model margin. E.g., for a logistic binomial objective,
the margin is prediction before a sigmoidal transform into probability-like values.
Also, since SHAP stands for "SHapley Additive exPlanation" (model prediction = sum of SHAP
contributions for all features + bias), depending on the objective used, transforming SHAP
contributions for a feature from the marginal to the prediction space is not necessarily
a meaningful thing to do.
}
\examples{
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
bst <- xgboost(agaricus.train$data, agaricus.train$label, nrounds = 50,
eta = 0.1, max_depth = 3, subsample = .5,
method = "hist", objective = "binary:logistic", nthread = 2, verbose = 0)
xgb.plot.shap(agaricus.test$data, model = bst, features = "odor=none")
contr <- predict(bst, agaricus.test$data, predcontrib = TRUE)
xgb.plot.shap(agaricus.test$data, contr, model = bst, top_n = 12, n_col = 3)
# multiclass example - plots for each class separately:
nclass <- 3
nrounds <- 20
x <- as.matrix(iris[, -5])
set.seed(123)
is.na(x[sample(nrow(x) * 4, 30)]) <- TRUE # introduce some missing values
mbst <- xgboost(data = x, label = as.numeric(iris$Species) - 1, nrounds = nrounds,
max_depth = 2, eta = 0.3, subsample = .5, nthread = 2,
objective = "multi:softprob", num_class = nclass, verbose = 0)
trees0 <- seq(from=0, by=nclass, length.out=nrounds)
col <- rgb(0, 0, 1, 0.5)
xgb.plot.shap(x, model = mbst, trees = trees0, target_class = 0, top_n = 4,
n_col = 2, col = col, pch = 16, pch_NA = 17)
xgb.plot.shap(x, model = mbst, trees = trees0 + 1, target_class = 1, top_n = 4,
n_col = 2, col = col, pch = 16, pch_NA = 17)
xgb.plot.shap(x, model = mbst, trees = trees0 + 2, target_class = 2, top_n = 4,
n_col = 2, col = col, pch = 16, pch_NA = 17)
}
\references{
Scott M. Lundberg, Su-In Lee, "A Unified Approach to Interpreting Model Predictions", NIPS Proceedings 2017, \url{https://arxiv.org/abs/1705.07874}
Scott M. Lundberg, Su-In Lee, "Consistent feature attribution for tree ensembles", \url{https://arxiv.org/abs/1706.06060}
}

Some files were not shown because too many files have changed in this diff Show More