predict.SmRaSE: Predict the outcome of new observations based on the...

View source: R/predict.SmRaSE.R

predict.SmRaSER Documentation

Predict the outcome of new observations based on the estimated Super mRaSE classifier (Bi, F., Zhu, J. and Feng, Y., 2022).

Description

Predict the outcome of new observations based on the estimated Super mRaSE classifier (Bi, F., Zhu, J. and Feng, Y., 2022).

Usage

## S3 method for class 'SmRaSE'
predict(object, newx, ...)

Arguments

object

object fitted 'SmRaSE' object using RaSE.

newx

a set of new observations. Each row of newx is a new observation.

...

additional arguments.

Examples

set.seed(0, kind = "L'Ecuyer-CMRG")
train.data <- RaModel("multi_classification", model.no = 1, n = 100,
p = 50, p0 = rep(1/4,4))
test.data <- RaModel("multi_classification", model.no = 1, n = 100,
p = 50, p0 = rep(1/4,4))
xtrain <- train.data$x
colnames(xtrain) <- paste0("V",1:dim(xtrain)[2])
ytrain <- train.data$y
xtest <- test.data$x
colnames(xtest) <- paste0("V",1:dim(xtest)[2])
ytest <- test.data$y
## Not run: 
fit <- SmultiRaSE(xtrain, ytrain, B1 = 20, B2 = 50, iteration = 0,
base = c('lda','knn'), cores = 1)
ypred <- predict(fit, xtest)
mean(ypred != ytest)
## End(Not run)

statcodes/RaSE documentation built on April 21, 2024, 6:01 p.m.