diff --git a/src/Platform/ManageResults.cc b/src/Platform/ManageResults.cc index 83d92e2..4c18beb 100644 --- a/src/Platform/ManageResults.cc +++ b/src/Platform/ManageResults.cc @@ -46,13 +46,14 @@ namespace platform { cout << Colors::MAGENTA() << "Only listing partial results" << endl; } auto i = 0; - cout << Colors::GREEN() << " # Date Model Score Name Score C/P Duration Title" << endl; - cout << "=== ========== ============ =========== =========== === ========= =============================================================" << endl; + int maxModel = results.maxModelSize(); + cout << Colors::GREEN() << " # Date " << setw(maxModel) << left << "Model" << " Score Name Score C / P Duration Title" << endl; + cout << "=== ========== " << string(maxModel, '=') << " =========== =========== === ========= =============================================================" << endl; bool odd = true; for (auto& result : results) { auto color = odd ? Colors::BLUE() : Colors::CYAN(); cout << color << setw(3) << fixed << right << i++ << " "; - cout << result.to_string() << endl; + cout << result.to_string(maxModel) << endl; if (i == numFiles) { break; } diff --git a/src/Platform/ReportConsole.cc b/src/Platform/ReportConsole.cc index 822db4e..e6144cc 100644 --- a/src/Platform/ReportConsole.cc +++ b/src/Platform/ReportConsole.cc @@ -29,11 +29,14 @@ namespace platform { { auto tmp = ConfigLocale(); int maxHyper = 0; + int maxDataset = 0; for (const auto& r : data["results"]) { maxHyper = max(maxHyper, (int)r["hyperparameters"].dump().size()); + maxDataset = max(maxDataset, (int)r["dataset"].get().size()); + } - cout << Colors::GREEN() << " # Dataset Sampl. Feat. Cls Nodes Edges States Score Time Hyperparameters" << endl; - cout << "=== ========================= ====== ===== === ========= ========= ========= =============== =================== " << string(maxHyper, '=') << endl; + cout << Colors::GREEN() << " # " << setw(maxDataset) << left << "Dataset" << " Sampl. Feat. Cls Nodes Edges States Score Time Hyperparameters" << endl; + cout << "=== " << string(maxDataset, '=') << " ====== ===== === ========= ========= ========= =============== =================== " << string(maxHyper, '=') << endl; json lastResult; double totalScore = 0.0; bool odd = true; @@ -45,8 +48,8 @@ namespace platform { } auto color = odd ? Colors::CYAN() : Colors::BLUE(); cout << color; - cout << setw(3) << index++ << " "; - cout << setw(25) << left << r["dataset"].get() << " "; + cout << setw(3) << right << index++ << " "; + cout << setw(maxDataset) << left << r["dataset"].get() << " "; cout << setw(6) << right << r["samples"].get() << " "; cout << setw(5) << right << r["features"].get() << " "; cout << setw(3) << right << r["classes"].get() << " "; diff --git a/src/Platform/Result.cc b/src/Platform/Result.cc index 436d5de..a185b56 100644 --- a/src/Platform/Result.cc +++ b/src/Platform/Result.cc @@ -37,14 +37,14 @@ namespace platform { throw invalid_argument("Unable to open result file. [" + path + "/" + filename + "]"); } - string Result::to_string() const + string Result::to_string(int maxModel) const { auto tmp = ConfigLocale(); stringstream oss; double durationShow = duration > 3600 ? duration / 3600 : duration > 60 ? duration / 60 : duration; string durationUnit = duration > 3600 ? "h" : duration > 60 ? "m" : "s"; oss << date << " "; - oss << setw(12) << left << model << " "; + oss << setw(maxModel) << left << model << " "; oss << setw(11) << left << scoreName << " "; oss << right << setw(11) << setprecision(7) << fixed << score << " "; auto completeString = isComplete() ? "C" : "P"; diff --git a/src/Platform/Result.h b/src/Platform/Result.h index 76a47d2..4d35ae6 100644 --- a/src/Platform/Result.h +++ b/src/Platform/Result.h @@ -12,7 +12,7 @@ namespace platform { public: Result(const string& path, const string& filename); json load() const; - string to_string() const; + string to_string(int maxModel) const; string getFilename() const { return filename; }; string getDate() const { return date; }; double getScore() const { return score; };