Learn R Programming

fdm2id (version 1.0.1)

confusion: 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, ...)

Value

The confusion matrix.

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.

See Also

evaluation, performance, splitdata

Examples

Run this code
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)

Run the code above in your browser using DataLab