/**
* @param lid
*/
private void updateWorkerConfusionMatrix(String workerName) {
Worker w = this.workers.get(workerName);
ConfusionMatrix cm = new ConfusionMatrix(this.categories.values());
cm.empty();
// Scan all objects and change the confusion matrix for each worker
// using the class probability for each object
for (AssignedLabel al : w.getAssignedLabels()) {
// Get the name of the object and the category it
// is classified from this worker.
String objectName = al.getObjectName();
String destination = al.getCategoryName();
// We get the classification of the object
// based on the votes of all the other workers
// We treat this classification as the "correct" one
HashMap<String, Double> probabilities = this
.getObjectClassProbabilities(objectName, workerName);
if (probabilities == null)
continue; // No other worker labeled the object
for (String source : probabilities.keySet()) {
Double error = probabilities.get(source);
cm.addError(source, destination, error);
}
}
cm.normalize();
w.setConfusionMatrix(cm);
}