[R] update doc; add drat repo
This commit is contained in:
parent
1ab0c3c248
commit
bdeb095a7d
@ -21,7 +21,7 @@ if (require('knitr')) opts_chunk$set(fig.width = 5, fig.height = 5, fig.align =
|
|||||||
|
|
||||||
%
|
%
|
||||||
<<prelim,echo=FALSE>>=
|
<<prelim,echo=FALSE>>=
|
||||||
xgboost.version = '0.3-0'
|
xgboost.version = '0.4-2'
|
||||||
@
|
@
|
||||||
%
|
%
|
||||||
|
|
||||||
|
|||||||
@ -49,18 +49,24 @@ It has several features:
|
|||||||
### Github version
|
### Github version
|
||||||
|
|
||||||
|
|
||||||
For up-to-date version (highly recommended), install from *Github*:
|
For weekly updated version (highly recommended), install from *Github*:
|
||||||
|
|
||||||
```{r installGithub, eval=FALSE}
|
```{r installGithub, eval=FALSE}
|
||||||
devtools::install_git('git://github.com/dmlc/xgboost', subdir='R-package')
|
install.packages("drat", repos="https://cran.rstudio.com")
|
||||||
|
drat:::addRepo("dmlc")
|
||||||
|
install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source")
|
||||||
```
|
```
|
||||||
|
|
||||||
> *Windows* user will need to install [RTools](http://cran.r-project.org/bin/windows/Rtools/) first.
|
> *Windows* user will need to install [Rtools](http://cran.r-project.org/bin/windows/Rtools/) first.
|
||||||
|
|
||||||
Cran version
|
### CRAN version
|
||||||
------------
|
|
||||||
|
|
||||||
As of 2015-03-13, ‘xgboost’ was removed from the CRAN repository.
|
|
||||||
|
The version 0.4-2 is on CRAN, and you can install it by:
|
||||||
|
|
||||||
|
```{r, eval=FALSE}
|
||||||
|
install.packages("xgboost")
|
||||||
|
```
|
||||||
|
|
||||||
Formerly available versions can be obtained from the CRAN [archive](http://cran.r-project.org/src/contrib/Archive/xgboost)
|
Formerly available versions can be obtained from the CRAN [archive](http://cran.r-project.org/src/contrib/Archive/xgboost)
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ xgboostPresentation.md: $(PKGROOT)/vignettes/xgboostPresentation.Rmd
|
|||||||
# General Rules for build rmarkdowns, need knitr
|
# General Rules for build rmarkdowns, need knitr
|
||||||
%.md:
|
%.md:
|
||||||
Rscript -e \
|
Rscript -e \
|
||||||
|
"require(methods);"\
|
||||||
"require(knitr);"\
|
"require(knitr);"\
|
||||||
"knitr::opts_knit\$$set(root.dir=\".\");"\
|
"knitr::opts_knit\$$set(root.dir=\".\");"\
|
||||||
"knitr::opts_chunk\$$set(fig.path=\"../web-data/xgboost/knitr/$(basename $@)-\");"\
|
"knitr::opts_chunk\$$set(fig.path=\"../web-data/xgboost/knitr/$(basename $@)-\");"\
|
||||||
|
|||||||
@ -49,19 +49,26 @@ It has several features:
|
|||||||
### Github version
|
### Github version
|
||||||
|
|
||||||
|
|
||||||
For up-to-date version (highly recommended), install from *Github*:
|
For weekly updated version (highly recommended), install from *Github*:
|
||||||
|
|
||||||
|
|
||||||
```r
|
```r
|
||||||
devtools::install_git('git://github.com/dmlc/xgboost', subdir='R-package')
|
install.packages("drat", repos="https://cran.rstudio.com")
|
||||||
|
drat:::addRepo("dmlc")
|
||||||
|
install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source")
|
||||||
```
|
```
|
||||||
|
|
||||||
> *Windows* user will need to install [RTools](http://cran.r-project.org/bin/windows/Rtools/) first.
|
> *Windows* user will need to install [Rtools](http://cran.r-project.org/bin/windows/Rtools/) first.
|
||||||
|
|
||||||
Cran version
|
### CRAN version
|
||||||
------------
|
|
||||||
|
|
||||||
As of 2015-03-13, ‘xgboost’ was removed from the CRAN repository.
|
|
||||||
|
The version 0.4-2 is on CRAN, and you can install it by:
|
||||||
|
|
||||||
|
|
||||||
|
```r
|
||||||
|
install.packages("xgboost")
|
||||||
|
```
|
||||||
|
|
||||||
Formerly available versions can be obtained from the CRAN [archive](http://cran.r-project.org/src/contrib/Archive/xgboost)
|
Formerly available versions can be obtained from the CRAN [archive](http://cran.r-project.org/src/contrib/Archive/xgboost)
|
||||||
|
|
||||||
@ -115,11 +122,16 @@ str(train)
|
|||||||
|
|
||||||
```
|
```
|
||||||
## List of 2
|
## List of 2
|
||||||
## $ data :
|
## $ data :Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
|
||||||
```
|
## .. ..@ i : int [1:143286] 2 6 8 11 18 20 21 24 28 32 ...
|
||||||
|
## .. ..@ p : int [1:127] 0 369 372 3306 5845 6489 6513 8380 8384 10991 ...
|
||||||
```
|
## .. ..@ Dim : int [1:2] 6513 126
|
||||||
## Error in str.default(obj, ...): could not find function "is"
|
## .. ..@ Dimnames:List of 2
|
||||||
|
## .. .. ..$ : NULL
|
||||||
|
## .. .. ..$ : chr [1:126] "cap-shape=bell" "cap-shape=conical" "cap-shape=convex" "cap-shape=flat" ...
|
||||||
|
## .. ..@ x : num [1:143286] 1 1 1 1 1 1 1 1 1 1 ...
|
||||||
|
## .. ..@ factors : list()
|
||||||
|
## $ label: num [1:6513] 1 0 0 1 0 0 0 1 0 0 ...
|
||||||
```
|
```
|
||||||
|
|
||||||
`label` is the outcome of our dataset meaning it is the binary *classification* we will try to predict.
|
`label` is the outcome of our dataset meaning it is the binary *classification* we will try to predict.
|
||||||
@ -206,7 +218,8 @@ bstDense <- xgboost(data = as.matrix(train$data), label = train$label, max.depth
|
|||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
## Error in as.vector(data): no method for coercing this S4 class to a vector
|
## [0] train-error:0.046522
|
||||||
|
## [1] train-error:0.022263
|
||||||
```
|
```
|
||||||
|
|
||||||
##### xgb.DMatrix
|
##### xgb.DMatrix
|
||||||
@ -254,9 +267,9 @@ bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nthread = 2, nround = 2, o
|
|||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
## [11:43:20] ../..//amalgamation/../src/tree/updater_prune.cc:74: tree pruning end, 1 roots, 6 extra nodes, 0 pruned nodes, max_depth=2
|
## [11:41:01] amalgamation/../src/tree/updater_prune.cc:74: tree pruning end, 1 roots, 6 extra nodes, 0 pruned nodes, max_depth=2
|
||||||
## [0] train-error:0.046522
|
## [0] train-error:0.046522
|
||||||
## [11:43:20] ../..//amalgamation/../src/tree/updater_prune.cc:74: tree pruning end, 1 roots, 4 extra nodes, 0 pruned nodes, max_depth=2
|
## [11:41:01] amalgamation/../src/tree/updater_prune.cc:74: tree pruning end, 1 roots, 4 extra nodes, 0 pruned nodes, max_depth=2
|
||||||
## [1] train-error:0.022263
|
## [1] train-error:0.022263
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -412,8 +425,8 @@ bst <- xgb.train(data=dtrain, booster = "gblinear", max.depth=2, nthread = 2, nr
|
|||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
## [0] train-error:0.019499 train-logloss:0.176561 test-error:0.018001 test-logloss:0.173835
|
## [0] train-error:0.024720 train-logloss:0.184616 test-error:0.022967 test-logloss:0.184234
|
||||||
## [1] train-error:0.004760 train-logloss:0.068214 test-error:0.003104 test-logloss:0.065493
|
## [1] train-error:0.004146 train-logloss:0.069885 test-error:0.003724 test-logloss:0.068081
|
||||||
```
|
```
|
||||||
|
|
||||||
In this specific case, *linear boosting* gets sligtly better performance metrics than decision trees based algorithm.
|
In this specific case, *linear boosting* gets sligtly better performance metrics than decision trees based algorithm.
|
||||||
@ -442,7 +455,7 @@ dtrain2 <- xgb.DMatrix("dtrain.buffer")
|
|||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
## [11:43:20] 6513x126 matrix with 143286 entries loaded from dtrain.buffer
|
## [11:41:01] 6513x126 matrix with 143286 entries loaded from dtrain.buffer
|
||||||
```
|
```
|
||||||
|
|
||||||
```r
|
```r
|
||||||
|
|||||||
17
doc/build.md
17
doc/build.md
@ -143,10 +143,12 @@ There are several ways to install the package:
|
|||||||
|
|
||||||
## R Package Installation
|
## R Package Installation
|
||||||
|
|
||||||
You can install R package using devtools
|
You can install R package from cran just like other packages, or you can install from our weekly updated drat repo:
|
||||||
|
|
||||||
```r
|
```r
|
||||||
devtools::install_git('git://github.com/dmlc/xgboost',subdir='R-package')
|
install.packages("drat", repos="https://cran.rstudio.com")
|
||||||
|
drat:::addRepo("dmlc")
|
||||||
|
install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source")
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -160,13 +162,9 @@ First follow [Building on OSX](#building-on-osx) to get the OpenMP enabled compi
|
|||||||
Then inside R, run
|
Then inside R, run
|
||||||
|
|
||||||
```R
|
```R
|
||||||
install.packages('xgboost/R-package/', repos=NULL, type='source')
|
install.packages("drat", repos="https://cran.rstudio.com")
|
||||||
```
|
drat:::addRepo("dmlc")
|
||||||
|
install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source")
|
||||||
Or
|
|
||||||
|
|
||||||
```R
|
|
||||||
devtools::install_local('xgboost/', subdir = 'R-package') # you may use devtools
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Trouble Shooting
|
## Trouble Shooting
|
||||||
@ -198,4 +196,3 @@ First follow [Building on OSX](#building-on-osx) to get the OpenMP enabled compi
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/dmlc/xgboost --recursive
|
git clone https://github.com/dmlc/xgboost --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user