PackPredict: Compute class predictions for each observation in X

Description Usage Arguments Value Examples

View source: R/PackPredict.R

Description

Predicts the classification of samples using a trained forest.

Usage

1
PackPredict(X, num.cores = 1)

Arguments

X

an n by d numeric matrix (preferable) or data frame. The rows correspond to observations and columns correspond to features of a test set, which should be different from the training set.

num.cores

the number of cores to use while predicting. (num.cores=0)

Value

predictions an n length vector of prediction class numbers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(rerf)
trainIdx <- c(1:40, 51:90, 101:140)
X <- as.matrix(iris[, 1:4])
Y <- as.numeric(iris[, 5])

paramList <- list(p = ncol(X), d = ceiling(sqrt(ncol(X))))

forest <- RerF(X, Y, FUN = RandMatRF, paramList = paramList, rfPack = TRUE, num.cores = 1)

predictions <- PackPredict(X)

rerf documentation built on May 2, 2019, 8:16 a.m.