predict.RotationForest: Provides a predict function for an object of class...

Description Usage Arguments Value Examples

Description

Predict allows for O(N) prediction based on an object of class rotationForest where N is the length of the dataframe dependent array.

Usage

1
2
3
## S3 method for class 'rotationForest'
predict(rotationForestObject, dependent,
  prob = FALSE)

Arguments

rotationForestObject

an object of class rotationForest (returned from the constructor rotationForest(...))

dependent

a data frame of the X predictor values

prob

A logical indicating whether probabilities of existing in each class are returned (as opposed to the default predictions)

Value

A vector of predictions (or a table of probabilities) of the different classes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fpath <- system.file("extdata", "balance-scale.data", package="rotationForest")
data <- read.table(fpath, sep = ",", header = FALSE)
data.dependent <- data[,-1]
data.response <- data[,1]
data.response <- as.factor(data.response)
total <- data.frame(data.response, data.dependent)
groups <- sample(rep(1:10, times = ceiling(nrow(total) / 19)), size = nrow(total), replace = TRUE)
data.train <- total[!groups %in% 1,]
data.test <- total[groups %in% 1,]
fit <- rotationForest(data.train[,-1], data.train[,1], 2, 10)
predict <- predict(fit, data.dependent, prob = FALSE)

mananshah99/rotationforest documentation built on May 21, 2019, 11:23 a.m.