text vignette
This commit is contained in:
parent
cefd55ef00
commit
d7ba5c1511
@ -83,23 +83,24 @@ Xgboost offer a way to group them in a `xgb.DMatrix`. You can even add other met
|
|||||||
|
|
||||||
```{r trainingDense, message=F, warning=F}
|
```{r trainingDense, message=F, warning=F}
|
||||||
dtrain <- xgb.DMatrix(data = train$data, label = train$label)
|
dtrain <- xgb.DMatrix(data = train$data, label = train$label)
|
||||||
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2, objective = "binary:logistic")
|
bstDMatrix <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2, objective = "binary:logistic")
|
||||||
```
|
```
|
||||||
|
|
||||||
# Verbose = 0,1,2
|
Below is a demonstration of the effect of verbose parameter.
|
||||||
|
|
||||||
|
```{r trainingVerbose, message=T, warning=F}
|
||||||
print ('train xgboost with verbose 0, no message')
|
print ('train xgboost with verbose 0, no message')
|
||||||
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2,
|
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2,
|
||||||
objective = "binary:logistic", verbose = 0)
|
objective = "binary:logistic", verbose = 0)
|
||||||
|
|
||||||
print ('train xgboost with verbose 1, print evaluation metric')
|
print ('train xgboost with verbose 1, print evaluation metric')
|
||||||
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2,
|
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2,
|
||||||
objective = "binary:logistic", verbose = 1)
|
objective = "binary:logistic", verbose = 1)
|
||||||
|
|
||||||
print ('train xgboost with verbose 2, also print information about tree')
|
print ('train xgboost with verbose 2, also print information about tree')
|
||||||
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2,
|
bst <- xgboost(data = dtrain, max.depth = 2, eta = 1, nround = 2,
|
||||||
objective = "binary:logistic", verbose = 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, nround = 2,objective = "binary:logistic")
|
|
||||||
|
|
||||||
#--------------------basic prediction using xgboost--------------
|
#--------------------basic prediction using xgboost--------------
|
||||||
# you can do prediction using the following line
|
# you can do prediction using the following line
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user