Confusion Matrix Multiclass using R

 require(ggplot2)
input <- read.delim("conf_matrix.csv", header=TRUE, sep=",")
input.matrix <- data.matrix(input)
input.matrix.normalized <- normalize(input.matrix)
colnames(input.matrix.normalized) = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N")
rownames(input.matrix.normalized) = colnames(input.matrix.normalized)
confusion <- as.data.frame(as.table(input.matrix.normalized))
plot <- ggplot(confusion)
plot + geom_tile(aes(x=Var1, y=Var2, fill=Freq)) + scale_x_discrete(name="Actual Class") + scale_y_discrete(name="Predicted Class") + scale_fill_gradient(breaks=seq(from=-.5, to=4, by=.2)) + labs(fill="Normalized\nFrequency")




댓글

댓글 쓰기

이 블로그의 인기 게시물

파이썬으로 Homomorphic Filtering 하기

파이썬으로 2D FFT/iFFT 하기: numpy 버전