Add variable width of dataset name in reports
This commit is contained in:
parent
833acefbb3
commit
7bcd2eed06
@ -46,13 +46,14 @@ namespace platform {
|
|||||||
cout << Colors::MAGENTA() << "Only listing partial results" << endl;
|
cout << Colors::MAGENTA() << "Only listing partial results" << endl;
|
||||||
}
|
}
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
cout << Colors::GREEN() << " # Date Model Score Name Score C/P Duration Title" << endl;
|
int maxModel = results.maxModelSize();
|
||||||
cout << "=== ========== ============ =========== =========== === ========= =============================================================" << endl;
|
cout << Colors::GREEN() << " # Date " << setw(maxModel) << left << "Model" << " Score Name Score C / P Duration Title" << endl;
|
||||||
|
cout << "=== ========== " << string(maxModel, '=') << " =========== =========== === ========= =============================================================" << endl;
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
for (auto& result : results) {
|
for (auto& result : results) {
|
||||||
auto color = odd ? Colors::BLUE() : Colors::CYAN();
|
auto color = odd ? Colors::BLUE() : Colors::CYAN();
|
||||||
cout << color << setw(3) << fixed << right << i++ << " ";
|
cout << color << setw(3) << fixed << right << i++ << " ";
|
||||||
cout << result.to_string() << endl;
|
cout << result.to_string(maxModel) << endl;
|
||||||
if (i == numFiles) {
|
if (i == numFiles) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,14 @@ namespace platform {
|
|||||||
{
|
{
|
||||||
auto tmp = ConfigLocale();
|
auto tmp = ConfigLocale();
|
||||||
int maxHyper = 0;
|
int maxHyper = 0;
|
||||||
|
int maxDataset = 0;
|
||||||
for (const auto& r : data["results"]) {
|
for (const auto& r : data["results"]) {
|
||||||
maxHyper = max(maxHyper, (int)r["hyperparameters"].dump().size());
|
maxHyper = max(maxHyper, (int)r["hyperparameters"].dump().size());
|
||||||
|
maxDataset = max(maxDataset, (int)r["dataset"].get<string>().size());
|
||||||
|
|
||||||
}
|
}
|
||||||
cout << Colors::GREEN() << " # Dataset Sampl. Feat. Cls Nodes Edges States Score Time Hyperparameters" << endl;
|
cout << Colors::GREEN() << " # " << setw(maxDataset) << left << "Dataset" << " Sampl. Feat. Cls Nodes Edges States Score Time Hyperparameters" << endl;
|
||||||
cout << "=== ========================= ====== ===== === ========= ========= ========= =============== =================== " << string(maxHyper, '=') << endl;
|
cout << "=== " << string(maxDataset, '=') << " ====== ===== === ========= ========= ========= =============== =================== " << string(maxHyper, '=') << endl;
|
||||||
json lastResult;
|
json lastResult;
|
||||||
double totalScore = 0.0;
|
double totalScore = 0.0;
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
@ -45,8 +48,8 @@ namespace platform {
|
|||||||
}
|
}
|
||||||
auto color = odd ? Colors::CYAN() : Colors::BLUE();
|
auto color = odd ? Colors::CYAN() : Colors::BLUE();
|
||||||
cout << color;
|
cout << color;
|
||||||
cout << setw(3) << index++ << " ";
|
cout << setw(3) << right << index++ << " ";
|
||||||
cout << setw(25) << left << r["dataset"].get<string>() << " ";
|
cout << setw(maxDataset) << left << r["dataset"].get<string>() << " ";
|
||||||
cout << setw(6) << right << r["samples"].get<int>() << " ";
|
cout << setw(6) << right << r["samples"].get<int>() << " ";
|
||||||
cout << setw(5) << right << r["features"].get<int>() << " ";
|
cout << setw(5) << right << r["features"].get<int>() << " ";
|
||||||
cout << setw(3) << right << r["classes"].get<int>() << " ";
|
cout << setw(3) << right << r["classes"].get<int>() << " ";
|
||||||
|
@ -37,14 +37,14 @@ namespace platform {
|
|||||||
throw invalid_argument("Unable to open result file. [" + path + "/" + filename + "]");
|
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();
|
auto tmp = ConfigLocale();
|
||||||
stringstream oss;
|
stringstream oss;
|
||||||
double durationShow = duration > 3600 ? duration / 3600 : duration > 60 ? duration / 60 : duration;
|
double durationShow = duration > 3600 ? duration / 3600 : duration > 60 ? duration / 60 : duration;
|
||||||
string durationUnit = duration > 3600 ? "h" : duration > 60 ? "m" : "s";
|
string durationUnit = duration > 3600 ? "h" : duration > 60 ? "m" : "s";
|
||||||
oss << date << " ";
|
oss << date << " ";
|
||||||
oss << setw(12) << left << model << " ";
|
oss << setw(maxModel) << left << model << " ";
|
||||||
oss << setw(11) << left << scoreName << " ";
|
oss << setw(11) << left << scoreName << " ";
|
||||||
oss << right << setw(11) << setprecision(7) << fixed << score << " ";
|
oss << right << setw(11) << setprecision(7) << fixed << score << " ";
|
||||||
auto completeString = isComplete() ? "C" : "P";
|
auto completeString = isComplete() ? "C" : "P";
|
||||||
|
@ -12,7 +12,7 @@ namespace platform {
|
|||||||
public:
|
public:
|
||||||
Result(const string& path, const string& filename);
|
Result(const string& path, const string& filename);
|
||||||
json load() const;
|
json load() const;
|
||||||
string to_string() const;
|
string to_string(int maxModel) const;
|
||||||
string getFilename() const { return filename; };
|
string getFilename() const { return filename; };
|
||||||
string getDate() const { return date; };
|
string getDate() const { return date; };
|
||||||
double getScore() const { return score; };
|
double getScore() const { return score; };
|
||||||
|
Loading…
Reference in New Issue
Block a user