predict.rm_class {randomMachines} | R Documentation |
Prediction function for the rm_class_model
Description
This function predicts the outcome for a RM object model using new data
Usage
## S4 method for signature 'rm_class'
predict(object,newdata)
Arguments
object |
A fitted RM model object of class |
newdata |
A data frame or matrix containing the new data to be predicted. |
Value
A vector of predicted outcomes: probabilities in case of 'prob_model = TRUE' and classes in case of 'prob_model = FALSE'.
Examples
# Generating a sample for the simulation
library(randomMachines)
sim_data <- sim_class(n = 75)
sim_new <- sim_class(n = 25)
rm_mod <- randomMachines(y~., train = sim_data)
y_hat <- predict(rm_mod, newdata = sim_new)
[Package randomMachines version 0.1.0 Index]