confusion: Confusion matrix

confusionR Documentation

Confusion matrix

Description

Plot a confusion matrix. Rows are the true labels and columns the predicted ones.

Usage

confusion(predictions, gt, norm = TRUE, graph = TRUE, ...)

Arguments

predictions

The prediction. This is the first argument, as for every other evaluation function of the package (evaluation, evaluation.accuracy, evaluation.precision, ...): passing the ground truth first returns the transposed matrix.

gt

The ground truth.

norm

Whether or not the confusion matrix is normalized

graph

Whether or not a graphic is displayed.

...

Other parameters, ignored. performance forwards to its evaluation function the same ... it forwards to the learning method, so a call such as performance (BAGGING, ..., type = "confusion", learningmethod = CART) would otherwise fail on the unused learningmethod.

Value

The confusion matrix.

See Also

evaluation, performance, splitdata

Examples

require ("datasets")
data (iris)
d = splitdata (iris, 5)
model = NB (d$train.x, d$train.y)
pred = predict (model, d$test.x)
confusion (pred, d$test.y)

fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.