MakeConfusionMatrix: Making a Confusion Matrix.

Description Usage Arguments Value See Also Examples

View source: R/BuddleMain.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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

Buddle documentation built on Feb. 13, 2020, 5:07 p.m.