This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##' calculate summary statistics from a confusion matrix. | |
##' | |
##' @param cm a confusion matrix, where rows = predicted, cols = actual. | |
##' @param dp round decimal place (default 2). | |
##' @return a classification report, similar to sklean. | |
##' @examples | |
##' \dontrun{ | |
##' # 3 classes. | |
##' cm <- matrix(c(4, 6, 3, 1, 2, 0, 1, 2, 6), ncol=3, byrow=T) | |
##' cr(cm) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 4 elem vector | |
w <- c(10, 20, 30, 40) | |
# 4*3 matrix | |
# [,1] [,2] [,3] | |
# [1,] 1 2 3 | |
# [2,] 4 5 6 | |
# [3,] 7 8 9 | |
# [4,] 10 11 12 | |
x <- matrix(1:12, ncol=3, byrow=T) |
OlderNewer