multilabel_confusion_matrix: Compute the confusion matrix for a multi-label prediction

Description Usage Arguments Value See Also Examples

View source: R/evaluation.R

Description

The multi-label confusion matrix is an object that contains the prediction, the expected values and also a lot of pre-processed information related with these data.

Usage

1
multilabel_confusion_matrix(mdata, mlresult)

Arguments

mdata

A mldr dataset

mlresult

A mlresult prediction

Value

A mlconfmat object that contains:

Z

The bipartition matrix prediction.

Fx

The score/probability matrix prediction.

R

The ranking matrix prediction.

Y

The expected matrix bipartition.

TP

The True Positive matrix values.

FP

The False Positive matrix values.

TN

The True Negative matrix values.

FN

The False Negative matrix values.

Zi

The total of positive predictions for each instance.

Yi

The total of positive expected for each instance.

TPi

The total of True Positive predictions for each instance.

FPi

The total of False Positive predictions for each instance.

TNi

The total of True Negative predictions for each instance.

FNi

The total False Negative predictions for each instance.

Zl

The total of positive predictions for each label.

Yl

The total of positive expected for each label.

TPl

The total of True Positive predictions for each label.

FPl

The total of False Positive predictions for each label.

TNl

The total of True Negative predictions for each label.

FNl

The total False Negative predictions for each label.

See Also

Other evaluation: cv, multilabel_evaluate, multilabel_measures

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
prediction <- predict(br(toyml), toyml)

mlconfmat <- multilabel_confusion_matrix(toyml, prediction)

# Label with the most number of True Positive values
which.max(mlconfmat$TPl)

# Number of wrong predictions for each label
errors <- mlconfmat$FPl + mlconfmat$FNl

# Examples predict with all labels
which(mlconfmat$Zi == toyml$measures$num.labels)

# You can join one or more mlconfmat
part1 <- create_subset(toyml, 1:50)
part2 <- create_subset(toyml, 51:100)
confmatp1 <- multilabel_confusion_matrix(part1, prediction[1:50, ])
confmatp2 <- multilabel_confusion_matrix(part2, prediction[51:100, ])
mlconfmat <- confmatp1 + confmatp2

## End(Not run)

Example output

Loading required package: mldr
y2 
 2 
named integer(0)

utiml documentation built on April 20, 2018, 1:04 a.m.