Skip to content

Instantly share code, notes, and snippets.

View phil8192's full-sized avatar
🦇

Phil Stubbings phil8192

🦇
View GitHub Profile
##' 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)
@phil8192
phil8192 / mm_rot.R
Last active March 15, 2021 17:15
matrix multiplication with rotations
# 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)