predict: Predict function for MLC.model-class

Description Usage Arguments Value Examples

Description

predict is inherited from the generic function for predictions from the results.

Usage

1
2
## S3 method for class 'MLC.model'
predict(object, x = NULL, likelihood = FALSE, ...)

Arguments

object

MLC.model-class model class to use for prediction

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

tabularMLC documentation built on Oct. 5, 2021, 9:07 a.m.