Add labels to confusion_matrices in results

This commit is contained in:
2024-05-10 17:12:11 +02:00
parent 6d4117d188
commit 69b9609154
8 changed files with 57 additions and 35 deletions

View File

@@ -155,12 +155,14 @@ std::string ArffFiles::trim(const std::string& source)
std::vector<int> ArffFiles::factorize(const std::vector<std::string>& labels_t)
{
std::vector<int> yy;
labels.clear();
yy.reserve(labels_t.size());
std::map<std::string, int> labelMap;
int i = 0;
for (const std::string& label : labels_t) {
if (labelMap.find(label) == labelMap.end()) {
labelMap[label] = i++;
labels.push_back(label);
}
yy.push_back(labelMap[label]);
}