Learn R Programming

PPforest (version 0.2.0)

predict.PPforest: Predict method for PPforest objects

Description

Predict method for PPforest objects

Usage

# S3 method for PPforest
predict(object, newdata, rule = 1, parallel = TRUE, cores = 2, ...)

Value

A list with:

predtree

Matrix with individual tree predictions

predforest

Final predicted classes based on majority vote

Arguments

object

A fitted PPforest object

newdata

A data frame with predictors (same structure as training data)

rule

Split rule used in classification (integer from 1 to 8) 1: mean of two group means 2: weighted mean of two group means - weight with group size 3: weighted mean of two group means - weight with group sd 4: weighted mean of two group means - weight with group se 5: mean of two group medians 6: weighted mean of two group medians - weight with group size 7: weighted mean of two group median - weight with group IQR 8: weighted mean of two group median - weight with group IQR and size

parallel

Logical, whether to use parallel processing

cores

Number of cores to use if parallel = TRUE

...

Additional arguments (ignored)

Examples

Run this code
if (FALSE) {
set.seed(123)
train <- sample(1:nrow(crab), nrow(crab)*.7)
crab_train <- data.frame(crab[train, ])
crab_test <- data.frame(crab[-train, ])

# if you split your data in training and test outside PPforest size.tr should be 1.
pprf.crab <- PPforest(data = crab_train, class = 'Type',
 std = 'scale', size.tr = 1, m = 200, size.p = .4, PPmethod = 'LDA', parallel = TRUE )
 
pred <- predict(pprf.crab, newdata = crab_test[,-1], parallel = TRUE) 
}

Run the code above in your browser using DataLab