Learn R Programming

rfPermute (version 2.5.2)

confusionMatrix: Confusion Matrix

Description

Generate a confusion matrix for Random Forest classification models with error rates translated into percent correctly classified, and columns for confidence intervals added.

Usage

confusionMatrix(x, conf.level = 0.95, threshold = NULL)

plotConfMat(x, title = NULL, plot = TRUE)

Arguments

x

a rfPermute or randomForest model object.

conf.level

confidence level for the binom.test confidence interval

threshold

threshold to test observed classification probability against. Should be a number between 0 and 1. If not NULL, the output matrix will have extra columns giving the one-tailed probability that the true correct classification is >= threshold.

title

a title for the plot.

plot

display the plot?

Author

Eric Archer eric.archer@noaa.gov

See Also

classPriors

Examples

Run this code
library(randomForest)
data(mtcars)

rf <- randomForest(factor(am) ~ ., mtcars)
confusionMatrix(rf)

confusionMatrix(rf, conf.level = 0.75)

confusionMatrix(rf, threshold = 0.7)
confusionMatrix(rf, threshold = 0.8)
confusionMatrix(rf, threshold = 0.95)

Run the code above in your browser using DataLab