predict.tsp.tree {BigTSP}R Documentation

prediction function for tsp.tree

Description

prediction function for tsp.tree

Usage

## S3 method for class 'tsp.tree'
predict(object, newdata, type = c("vector", "tree", "class", "where"), split = FALSE, nwts, eps = 0.001, ...)

Arguments

object

a tsp.tree object

newdata

new data matrix

type

character string denoting whether the predictions are returned as a vector (default) or as a tsp.tree object.

split

governs the handling of missing values. If false, cases with missing values are dropped down the tree until a leaf is reached or a node for which the attribute is missing, and that node is used for prediction. If split = TRUE cases with missing attributes are split into fractional cases and dropped down each side of the split. The predicted values are averaged over the fractions to give the prediction.

nwts

weights for the newdata cases, used when predicting a tsp.tree.

eps

a lower bound for the probabilities, used if events of predicted probability zero occur in newdata when predicting a tree.

...

other arguments.

Author(s)

Xiaolin Yang, Han Liu

Examples

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

[Package BigTSP version 1.0 Index]