Skip to content

Instantly share code, notes, and snippets.

@jdeloach
Created March 8, 2016 16:55
Show Gist options
  • Save jdeloach/bdb1c358de95fde014bc to your computer and use it in GitHub Desktop.
Save jdeloach/bdb1c358de95fde014bc to your computer and use it in GitHub Desktop.
def printConfusionMatrix(labelAndPred: List[(Int,Int)]) = {
// labelAndPred
println(" " + (0 until classCount).mkString(" ") + " <- predicted ")
println((0 until 2*classCount).map(x => "--").mkString)
for(i <- 0 until classCount) {
for(j <- 0 until classCount) {
// i is actual
// j is classified as
print(" " + labelAndPred.count{ case (label,pred) => label == i && pred == j })
}
println(" | actual=" + i)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment