Show classification report in b_manage
This commit is contained in:
@@ -16,7 +16,7 @@ namespace platform {
|
||||
ReportConsole report(result.getJson());
|
||||
report.show();
|
||||
if (classification_report) {
|
||||
report.showClassificationReport();
|
||||
std::cout << Colors::BLUE() << report.showClassificationReport() << Colors::RESET();
|
||||
}
|
||||
}
|
||||
void Experiment::show()
|
||||
|
@@ -129,11 +129,15 @@ namespace platform {
|
||||
vbody.push_back(line.str()); sbody << line.str();
|
||||
line.str(""); line << headerLine(fVector("Test times: ", lastResult["times_test"], 10, 3));
|
||||
vbody.push_back(line.str()); sbody << line.str();
|
||||
|
||||
} else {
|
||||
footer(totalScore);
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
void ReportConsole::showSummary()
|
||||
{
|
||||
@@ -165,16 +169,17 @@ namespace platform {
|
||||
std::cout << headerLine("*** Best Results File not found. Couldn't compare any result!");
|
||||
}
|
||||
}
|
||||
void ReportConsole::showClassificationReport()
|
||||
std::string ReportConsole::showClassificationReport()
|
||||
{
|
||||
if (data["results"].size() > 1)
|
||||
return;
|
||||
auto lastResult = data["results"][0];
|
||||
if (data["results"].size() > 1 || lastResult.find("confusion_matrices") == lastResult.end())
|
||||
return "";
|
||||
auto item = data["results"][0];
|
||||
auto scores = Scores(item["confusion_matrices"][0]);
|
||||
for (int i = 1; i < item["confusion_matrices"].size(); i++) {
|
||||
auto score = Scores(item["confusion_matrices"][i]);
|
||||
scores.aggregate(score);
|
||||
}
|
||||
std::cout << Colors::BLUE() << scores.classification_report() << Colors::RESET();
|
||||
return scores.classification_report();
|
||||
}
|
||||
}
|
@@ -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; }
|
||||
void showClassificationReport();
|
||||
std::string showClassificationReport();
|
||||
private:
|
||||
int selectedIndex;
|
||||
std::string headerLine(const std::string& text, int utf);
|
||||
|
Reference in New Issue
Block a user