>>> preds = predict(model, test.x) >>> pred.label = max.col(t(preds)) - 1 >>> cm = table(pred.label, test.y) >>> print(cm) pred.label 0 1 2 3 4 5 6 7 8 9 0 966 0 7 0 2 4 6 0 3 3 1 0 1123 3 2 2 0 2 10 2 5 2 3 4 1002 8 3 1 2 16 5 0 3 1 2 4 985 0 14 0 9 7 6 4 0 0 1 0 956 1 7 3 5 26 5 4 1 0 3 1 854 5 0 12 4 6 2 2 0 0 8 7 931 0 4 1 7 1 0 7 6 1 1 0 975 3 7 8 2 3 8 4 0 7 5 2 929 10 9 1 0 0 2 9 3 0 13 4 947 >>> acc = sum(diag(cm))/sum(cm) >>> print(acc) [1] 0.9668 # CNN을 구성하기 >>> install.packages("magrittr") # 최초 1회만 실행 >>> library(magrittr) >>> library(mxnet) >>> "%=>%" <- function(val,var) { >>> assign(substitute(var), val, envir = .GlobalEnv) >>> return(val) >>> }