predict.Rborist: predict method for Rborst

Description Usage Arguments Value Author(s) See Also Examples

Description

Prediction and test using Rborist.

Usage

1
2
3
4
## S3 method for class 'Rborist'
predict(object, newdata, yTest=NULL, quantVec=NULL,
quantiles = !is.null(quantVec), ctgCensus = "votes", oob = FALSE,
nThread = 0, verbose = FALSE, ...)

Arguments

object

an object of class Rborist, created from a previous invocation of the command Rborist to train.

newdata

a design matrix containing new data, with the same signature of predictors as in the training command.

yTest

if specfied, a response vector against which to test the new predictions.

quantVec

a vector of quantiles to predict.

quantiles

whether to predict quantiles.

ctgCensus

whether/how to summarize per-category predictions. "votes" specifies the number of trees predicting a given class. "prob" specifies a normalized, probabilistic summary.

oob

whether prediction is restricte to out-of-bag samples.

nThread

suggests ans OpenMP-style thread count. Zero denotes default processor setting.

verbose

whether to output progress of prediction.

...

not currently used.

Value

a list containing either of the two prediction containers:

PredictReg

a list of prediction results for regression:

yPred a vector containing the predicted response.

qPred a matrix containing the prediction quantiles, if requested.

PredictCtg

a list of validation results for classification:

yPred a vector containing the predicted response.

census a matrix of predictions, by category.

prob a matrix of prediction probabilities by category, if requested.

Author(s)

Mark Seligman at Suiji.

See Also

Rborist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## Not run: 
  # Regression example:
  nRow <- 5000
  x <- data.frame(replicate(6, rnorm(nRow)))
  y <- with(x, X1^2 + sin(X2) + X3 * X4) # courtesy of S. Welling.
  rb <- Rborist(x,y)


  # Performs separate prediction on new data:
  xx <- data.frame(replace(6, rnorm(nRow)))
  pred <- predict(rb, xx)
  yPred <- pred$yPred


  # Performs separate prediction, using original response as test
  # vector:
  pred <- predict(rb, xx, y)
  mse <- pred$mse
  rsq <- pred$rsq


  # Performs separate prediction with (default) quantiles:
  pred <- predict(rb, xx, quantiles="TRUE")
  qPred <- pred$qPred


  # Performs separate prediction with deciles:
  pred <- predict(rb, xx, quantVec = seq(0.1, 1.0, by = 0.10))
  qPred <- pred$qPred


  # Classification examples:
  data(iris)
  rb <- Rborist(iris[-5], iris[5])


  # Generic prediction using training set.
  # Census as (default) votes:
  pred <- predict(rb, iris[-5])
  yPred <- pred$yPred
  census <- pred$census


  # As above, but validation census to report class probabilities:
  pred <- predict(rb, iris[-5], ctgCensus="prob")
  prob <- pred$prob


  # As above, but with training reponse as test vector:
  pred <- predict(rb, iris[-5], iris[5], ctgCensus = "prob")
  prob <- pred$prob
  conf <- pred$confusion
  misPred <- pred$misPred

## End(Not run)

Rborist documentation built on Nov. 1, 2019, 7:45 p.m.