简体   繁体   中英

How to load already computed confusion matrix to be used with the caret package in R

I have trained a Random Forest classifier ( randomForest package) and it returns also the confusion matrix.

I want to compute sensitivity and specificity for each class, so I decided to load the confusion matrix with the caret package. However I did not find how to load it. How can I achieve it?

Thanks to Sowmya's comments, I achieve it by using the following code:

library(caret)
confusionMatrix(clf$predicted, labels)

where clf is the result of the execution of randomForest() call, while labels is the lists of reference labels of the output variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM