Add confusion matrix to json results

Add Aggregate method to Scores
This commit is contained in:
2024-05-10 13:42:38 +02:00
parent dd94fd51f7
commit ec0268c514
5 changed files with 59 additions and 4 deletions

View File

@@ -25,6 +25,15 @@ namespace platform {
labels.push_back("Class " + std::to_string(i));
}
}
void Scores::aggregate(const Scores& a)
{
if (a.num_classes != num_classes)
throw std::invalid_argument("The number of classes must be the same");
confusion_matrix += a.confusion_matrix;
total += a.total;
accuracy_value += a.accuracy_value;
accuracy_value /= 2;
}
Scores::Scores(json& confusion_matrix_)
{
json values;
@@ -46,7 +55,6 @@ namespace platform {
confusion_matrix[i][j] = value_int;
total += value_int;
}
std::cout << std::endl;
i++;
}
// Compute accuracy with the confusion matrix