predict.MLC.model {tabularMLC} | R Documentation |
Predict function for MLC.model-class
Description
predict
is inherited from the generic function for predictions from the results.
Usage
## S3 method for class 'MLC.model'
predict(object, x = NULL, likelihood = FALSE, ...)
Arguments
object |
|
x |
data.frame. The feature vector to predict |
likelihood |
logical. Whether to return or not the likelihood values, default FALSE. |
... |
inherited from generic function (not in use) |
Value
a factor vector with the predicted value. If likelihood is TRUE, then it will also return the calculated likelihoods.
Examples
data(iris)
n = length(iris$Species)
# Split training by sample
training = sample(1:n, size=n*0.7)
validation = (1:n)[-training]
# Train model with training dataset
mlcModel = MLC(Species ~ ., iris[training,])
# Predict using validation dataset
predict = predict(mlcModel, iris[validation,])
# Print confusion matrix
confusionMatrix = table(predicted=predict, observed=iris$Species[validation])
print(confusionMatrix)
[Package tabularMLC version 0.0.3 Index]