public static Map<List<String>,Double> updateAggregateMatrix(Map<List<String>,Double> aggregateMap,File matrix) throws IOException {
  List<String> confMatrixLines=FileUtils.readLines(matrix);
  StrTokenizer l=StrTokenizer.getCSVInstance(confMatrixLines.get(0));
  l.setDelimiterChar(',');
  String[] headline=l.getTokenArray();
  for (int i=1; i < confMatrixLines.size(); i++) {
    for (int j=1; j < headline.length; j++) {
      StrTokenizer line=StrTokenizer.getCSVInstance(confMatrixLines.get(i));
      String pred=headline[j];
      line.setDelimiterChar(',');
      String act=line.getTokenArray()[0];
      double value=Double.valueOf(line.getTokenArray()[j]);
      List<String> key=new ArrayList<String>(Arrays.asList(new String[]{pred,act}));
      if (aggregateMap.get(key) != null) {
        aggregateMap.put(key,aggregateMap.get(key) + value);
      }
 else {
        aggregateMap.put(key,value);
      }
    }
  }
  return aggregateMap;
}

public static Map < List < String > , Double > updateAggregateMatrix ( Map < List < String > , Double > aggregateMap , File matrix ) throws IOException { List < String > confMatrixLines = FileUtils . readLines ( matrix ) ; StrTokenizer l = StrTokenizer . getCSVInstance ( confMatrixLines . get ( 0 ) ) ; l . setDelimiterChar ( ',' ) ; String [ ] headline = l . getTokenArray ( ) ; for ( int i = 1 ; i < confMatrixLines . size ( ) ; i ++ ) { for ( int j = 1 ; j < headline . length ; j ++ ) { StrTokenizer line = StrTokenizer . getCSVInstance ( confMatrixLines . get ( i ) ) ; String pred = headline [ j ] ; line . setDelimiterChar ( ',' ) ; String act = line . getTokenArray ( ) [ 0 ] ; double value = Double . valueOf ( line . getTokenArray ( ) [ j ] ) ; List < String > key = new ArrayList < String > ( Arrays . asList ( new String [ ] { pred , act } ) ) ; if ( aggregateMap . get ( key ) != null ) { aggregateMap . put ( key , aggregateMap . get ( key ) + value ) ; } else { aggregateMap . put ( key , value ) ; } } } return aggregateMap ; }
adds results from a serialized matrix to a map
