predict.CBA {arulesCBA} | R Documentation |
Model Prediction for Classifiers Based on Association Rules
Description
Predicts classes for new data using a CBA classifier.
Usage
## S3 method for class 'CBA'
predict(object, newdata, type = c("class", "score"), ...)
accuracy(pred, true)
Arguments
object |
An object of class CBA. |
newdata |
A data.frame or arules::transactions containing rows of new entries to be classified. |
type |
Predict |
... |
Additional arguments are ignored. |
pred , true |
two factors with the same level representing the predictions and the ground truth (e.g., obtained with |
Value
A factor vector with the classification result.
Author(s)
Michael Hahsler
Examples
data("iris")
train_id <- sample(seq_len(nrow(iris)), 130)
iris_train <- iris[train_id, ]
iris_test <- iris[-train_id, ]
cl <- CBA(Species ~., iris_train)
pr <- predict(cl, iris_test)
pr
accuracy(pr, response(Species ~., iris_test))
[Package arulesCBA version 1.2.7 Index]