predict.modelBst {ebmc}R Documentation

Predict Method for modelBst Object

Description

Predicting instances in test set using modelBst object

Usage

  ## S3 method for class 'modelBst'
predict(object, newdata, type = "prob", ...)

Arguments

object

A object of modelBst class.

newdata

A data frame object containing new instances.

type

Types of output, which can be prob (probability) and class (predicted label). Default is prob.

...

Not used currently.

Value

Two type of output can be selected:

prob

Estimated probability of being a minority instance (i.e. 1). The probability is averaged by using a majority vote by all weak learners, weighted by error estimation.

class

Predicted class of the instance. Instances of probability larger than 0.5 are predicted as 1, otherwise 0.

Examples

data("iris")
iris <- iris[1:70, ]
iris$Species <- factor(iris$Species, levels = c("setosa", "versicolor"), labels = c("0", "1"))
samp <- sample(nrow(iris), nrow(iris) * 0.7)
train <- iris[samp, ]
test <- iris[-samp, ]
model <- rus(Species ~ ., data = train, size = 10, alg = "c50") # Build RUSBoost model
prob <- predict(model, newdata = test, type = "prob") # return probability estimation
pred <- predict(model, newdata = test, type = "class") # return predicted class

[Package ebmc version 1.0.1 Index]