predict.MLC.model {tabularMLC} | R Documentation |
predict
is inherited from the generic function for predictions from the results.
## S3 method for class 'MLC.model' predict(object, x = NULL, likelihood = FALSE, ...)
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) |
a factor vector with the predicted value. If likelihood is TRUE, then it will also return the calculated likelihoods.
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)