Description Usage Arguments Value Examples
Predicting instances in test set using modelBst object
1 2 |
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. |
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. |
1 2 3 4 5 6 7 8 9 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.