predict.tsp.gbm: prediction function for tsp.gbm

Description Usage Arguments Author(s) References Examples

View source: R/LDCA.R

Description

prediction function for tsp.gbm

Usage

1
2
## S3 method for class 'tsp.gbm'
predict(object, newdata, n.trees, type = "link", single.tree = FALSE, ...)

Arguments

object

a tsp.gbm object

newdata

new data matrix

n.trees

Number of trees used in the prediction. n.trees may be a vector in which case predictions are returned for each iteration specified

type

The scale on which gbm makes the predictions

single.tree

If single.tree=TRUE then predict.tsp.gbm returns only the predictions from tree(s) n.trees

...

not used.

Author(s)

Xiaolin Yang, Han Liu

References

gbm package

Examples

1
2
3
4
5
library(gbm)
x=matrix(rnorm(100*20),100,20)
y=rbinom(100,1,0.5)
fit=tsp.gbm(x,y)
predict(fit,x[1:10,],n.trees=5)

Example output

Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16

Loading required package: tree
Loading required package: randomForest
randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.
Loading required package: gbm
Loaded gbm 2.1.4
Iter   TrainDeviance   ValidDeviance   StepSize   Improve
     1        1.3858            -nan     0.0010   -0.0001
     2        1.3857            -nan     0.0010   -0.0000
     3        1.3855            -nan     0.0010   -0.0000
     4        1.3853            -nan     0.0010    0.0001
     5        1.3852            -nan     0.0010    0.0000
     6        1.3850            -nan     0.0010    0.0001
     7        1.3849            -nan     0.0010   -0.0002
     8        1.3848            -nan     0.0010   -0.0000
     9        1.3846            -nan     0.0010   -0.0000
    10        1.3844            -nan     0.0010    0.0001
    20        1.3827            -nan     0.0010   -0.0001
    40        1.3793            -nan     0.0010   -0.0001
    60        1.3762            -nan     0.0010    0.0001
    80        1.3734            -nan     0.0010    0.0000
   100        1.3707            -nan     0.0010   -0.0000

Warning message:
In gbm.fit(newx, y, offset = offset, misc = misc, distribution = distribution,  :
  Parameter `train.fraction` is deprecated, please specify `nTrain` instead.
 [1] -0.04041397 -0.03872335 -0.03734438 -0.04012260 -0.04018410 -0.04035668
 [7] -0.04313489 -0.03874362 -0.04054532 -0.03878486

BigTSP documentation built on May 2, 2019, 6:09 a.m.