while ((expected = (Tuple)expectedInput.nextValue()) != null)
{
Tuple actual = (Tuple)actualInput.nextValue();
if (actual == null)
{
throw new UnmatchedActivityInputsException(
new String[] {INPUT_EXPECTED, INPUT_PREDICTED},
new Object[] {expected, ControlBlock.NO_MORE_DATA});
}
// we're assuming there are no more than Integer.MAX_VALUE classes
Object predicted = actual.getObject(0);
Object exp = expected.getObject(0);
Map<Object, Long> map = confusionMatrix.get(exp);
actualValues.add(predicted);
if (map == null)
{
Map<Object, Long> counts = new HashMap<Object, Long>();
confusionMatrix.put(exp, counts);
counts.put(predicted, 1L);
}
else
{
Long count = map.get(predicted);
if (count == null)
{
map.put(predicted, 1L);
}
else
{
map.put(predicted, count+1);
}
}
}
Object obj = actualInput.nextValue();
if (obj != null)
{
throw new UnmatchedActivityInputsException(
new String[] {INPUT_EXPECTED, INPUT_PREDICTED},
new Object[] {ControlBlock.NO_MORE_DATA, obj});
}
List<ColumnMetadata> columns = new ArrayList<ColumnMetadata>();