MakeConfusionMatrix {Buddle}R Documentation

Making a Confusion Matrix.

Description

Create a confusion matrix from two vectors of labels: predicted label obtained from FetchBuddle() as a result of prediction and true label of a test set.

Usage

MakeConfusionMatrix(predicted.label, true.label, Label)

Arguments

predicted.label

a vector of predicted labels.

true.label

a vector of true labels.

Label

a vector of all possible values or levels which a label can take.

Value

An r-by-r confusion matrix where r is the length of Label.

See Also

CheckNonNumeric(), GetPrecision(), FetchBuddle(), OneHot2Label(), Split2TrainTest(), TrainBuddle()

Examples



data(iris)

Label = c("setosa", "versicolor", "virginica")

predicted.label = c("setosa", "setosa",    "virginica", "setosa", "versicolor", "versicolor")
true.label      = c("setosa", "virginica", "versicolor","setosa", "versicolor", "virginica")

confusion.matrix = MakeConfusionMatrix(predicted.label, true.label, Label)
precision = GetPrecision(confusion.matrix)

confusion.matrix
precision






[Package Buddle version 2.0.1 Index]