predict.CBA | R Documentation |
Predicts classes for new data using a CBA classifier.
## S3 method for class 'CBA'
predict(object, newdata, type = c("class", "score"), ...)
accuracy(pred, true)
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 |
A factor vector with the classification result.
Michael Hahsler
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.