Last data update: 2014.03.03

R: prediction function for tsp.randomForest
predict.tsp.randomForestR Documentation

prediction function for tsp.randomForest

Description

prediction function for tsp.randomForest

Usage

## S3 method for class 'tsp.randomForest'
predict(object, newdata, type = "response", norm.votes = TRUE, predict.all = FALSE, proximity = FALSE, nodes = FALSE, cutoff, ...)

Arguments

object

a tsp.randomForest object

newdata

new data matrix

type

one of response, prob. or votes, indicating the type of output: predicted values, matrix of class probabilities, or matrix of vote counts. class is allowed, but automatically converted to ”response", for backward compatibility.

norm.votes

Should the vote counts be normalized (i.e., expressed as fractions)?

predict.all

Should the predictions of all trees be kept?

proximity

Should proximity measures be computed?

nodes

Should the terminal node indicators (an n by ntree matrix) be return? If so, it is in the ”nodes" attribute of the returned object.

cutoff

A vector of length equal to number of classes. The 'winning' class for an observation is the one with the maximum ratio of proportion of votes to cutoff.

...

not used.

Author(s)

Xiaolin Yang, Han Liu

References

randomForest package.

Examples

library(randomForest)
x=matrix(rnorm(100*20),100,20)
y=rbinom(100,1,0.5)
y=as.factor(y)
fit=tsp.randomForest(x,y)
predict(fit,x[1:10,])

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BigTSP)
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-5

Loading required package: tree
Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Loading required package: gbm
Loading required package: survival
Loading required package: lattice
Loading required package: splines
Loading required package: parallel
Loaded gbm 2.1.1
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BigTSP/predict.tsp.randomForest.Rd_%03d_medium.png", width=480, height=480)
> ### Name: predict.tsp.randomForest
> ### Title: prediction function for tsp.randomForest
> ### Aliases: predict.tsp.randomForest
> ### Keywords: ~kwd1 ~kwd2
> 
> ### ** Examples
> 
> library(randomForest)
> x=matrix(rnorm(100*20),100,20)
> y=rbinom(100,1,0.5)
> y=as.factor(y)
> fit=tsp.randomForest(x,y)
> predict(fit,x[1:10,])
 1  2  3  4  5  6  7  8  9 10 
 1  0  0  0  0  1  1  1  1  1 
Levels: 0 1
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>