Add colors to confusion matrix and classification report

This commit is contained in:
2024-05-14 00:41:29 +02:00
parent 8d20545fd2
commit 99c9c6731f
5 changed files with 15 additions and 11 deletions

View File

@@ -136,7 +136,7 @@ namespace platform {
sbody << std::string(MAXL, '*') << Colors::RESET() << std::endl;
vbody.push_back(std::string(MAXL, '*') + Colors::RESET() + "\n");
if (lastResult.find("confusion_matrices") != lastResult.end() && (data["results"].size() == 1 || selectedIndex != -1)) {
vbody.push_back(Colors::BLUE() + showClassificationReport() + Colors::RESET());
vbody.push_back(showClassificationReport(Colors::BLUE()));
}
}
void ReportConsole::showSummary()
@@ -169,7 +169,7 @@ namespace platform {
std::cout << headerLine("*** Best Results File not found. Couldn't compare any result!");
}
}
std::string ReportConsole::showClassificationReport()
std::string ReportConsole::showClassificationReport(std::string color)
{
auto lastResult = data["results"][0];
if (data["results"].size() > 1 || lastResult.find("confusion_matrices") == lastResult.end())
@@ -180,6 +180,6 @@ namespace platform {
auto score = Scores(item["confusion_matrices"][i]);
scores.aggregate(score);
}
return scores.classification_report();
return scores.classification_report(color);
}
}

View File

@@ -14,7 +14,7 @@ namespace platform {
std::string fileReport();
std::string getHeader() { do_header(); do_body(); return sheader.str(); }
std::vector<std::string>& getBody() { return vbody; }
std::string showClassificationReport();
std::string showClassificationReport(std::string color);
private:
int selectedIndex;
std::string headerLine(const std::string& text, int utf);