Learn R Programming

PPtree (version 2.3.0)

PP.classify: Predict class for the test set and calculate prediction error

Description

After finding tree structure, predict class for the test set and calculate prediction error.

Usage

PP.classify(test.data, true.class, Tree.result, Rule, ...)

Arguments

test.data
the test dataset
true.class
true class of test dataset if available
Tree.result
the result of PP.Tree
Rule
split rule

1 - mean of two group means

2 - weighted mean of two group means 3 - mean of max(left group) and min(right group)

4 - weighted mean of max(left group) and min(right group)

...
...

Value

predict.class
predicted class
predict.error
prediction error

References

Lee E., Cook D., and Klinke, S. (2002) Projection Pursuit indices for supervised classification

See Also

PPindex.class, PP.optimize, PP.Tree

Examples

Run this code
data(iris)
n <- nrow(iris)
n.train <- round(n*0.9)
train <- sample(n, n.train)

Tree.result <- PP.Tree("LDA", iris[train,5], iris[train, 1:4])
tree.train <- PP.classify(iris[train, 1:4], iris[train, 5], Tree.result,
                          Rule=1)
tree.train
tree.test <- PP.classify(iris[-train, 1:4], iris[-train, 5],
                         Tree.result, Rule=1)
tree.test

Run the code above in your browser using DataLab