question: public ContingencyMatrix ( double [ ] [ ] contigencyMatrix ) { this . matrix = new double [ contigencyMatrix . length ] [ ] ; for ( int i = 0 ; i < matrix . length ; i ++ ) { this . matrix [ i ] = new double [ contigencyMatrix [ i ] . length ] ; System . arraycopy ( contigencyMatrix [ i ] , 0 , this . matrix [ i ] , 0 , this . matrix [ i ] . length ) ; } double totalSum = 0 ; this . rowSums = new double [ this . matrix . length ] ; for ( int row = 0 ; row < this . rowSums . length ; row ++ ) { double prior = 0 ; double [ ] entries = this . matrix [ row ] ; for ( int i = 0 ; i < entries . length ; i ++ ) { prior += entries [ i ] ; } this . rowSums [ row ] = prior ; totalSum += prior ; } this . total = totalSum ; this . colSums = new double [ this . matrix . length > 0 ? this . matrix [ 0 ] . length : 0 ] ; for ( int col = 0 ; col < colSums . length ; col ++ ) { double sum = 0 ; for ( int i = 0 ; i < this . matrix . length ; i ++ ) { sum += this . matrix [ i ] [ col ] ; } this . colSums [ col ] = sum ; } }
target:  The contigency matrix in the format [true label][predicted label]