Path pathPattern,
Configuration conf,
Parameters params) throws IOException {
StringTuple key = new StringTuple();
DoubleWritable value = new DoubleWritable();
String defaultLabel = params.get("defaultCat");
FileStatus[] outputFiles = fs.globStatus(pathPattern);
Map<String,Map<String,Integer>> confusionMatrix = new HashMap<String,Map<String,Integer>>();
for (FileStatus fileStatus : outputFiles) {
Path path = fileStatus.getPath();
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
while (reader.next(key, value)) {
String correctLabel = key.stringAt(1);
String classifiedLabel = key.stringAt(2);
Map<String,Integer> rowMatrix = confusionMatrix.get(correctLabel);
if (rowMatrix == null) {
rowMatrix = new HashMap<String,Integer>();
}
Integer count = Double.valueOf(value.get()).intValue();
rowMatrix.put(classifiedLabel, count);
confusionMatrix.put(correctLabel, rowMatrix);
}
}