Adjust filename and hyperparameters in reports
This commit is contained in:
parent
38423048bd
commit
04e754b2f5
@ -3,6 +3,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
#include "BestResults.h"
|
#include "BestResults.h"
|
||||||
#include "Result.h"
|
#include "Result.h"
|
||||||
#include "Colors.h"
|
#include "Colors.h"
|
||||||
@ -155,12 +156,19 @@ namespace platform {
|
|||||||
auto data = loadFile(bestFileName);
|
auto data = loadFile(bestFileName);
|
||||||
auto datasets = getDatasets(data);
|
auto datasets = getDatasets(data);
|
||||||
int maxDatasetName = (*max_element(datasets.begin(), datasets.end(), [](const string& a, const string& b) { return a.size() < b.size(); })).size();
|
int maxDatasetName = (*max_element(datasets.begin(), datasets.end(), [](const string& a, const string& b) { return a.size() < b.size(); })).size();
|
||||||
|
int maxFileName = 0;
|
||||||
|
int maxHyper = 0;
|
||||||
|
for (auto const& item : data.items()) {
|
||||||
|
maxHyper = max(maxHyper, (int)item.value().at(1).dump().size());
|
||||||
|
maxFileName = max(maxFileName, (int)item.value().at(2).get<string>().size());
|
||||||
|
}
|
||||||
|
cout << "Hola" << endl;
|
||||||
stringstream oss;
|
stringstream oss;
|
||||||
oss << Colors::GREEN() << "Best results for " << model << " as of " << date << endl;
|
oss << Colors::GREEN() << "Best results for " << model << " as of " << date << endl;
|
||||||
cout << oss.str();
|
cout << oss.str();
|
||||||
cout << string(oss.str().size() - 8, '-') << endl;
|
cout << string(oss.str().size() - 8, '-') << endl;
|
||||||
cout << Colors::GREEN() << " # " << setw(maxDatasetName + 1) << left << string("Dataset") << "Score File Hyperparameters" << endl;
|
cout << Colors::GREEN() << " # " << setw(maxDatasetName + 1) << left << string("Dataset") << "Score File Hyperparameters" << endl;
|
||||||
cout << "=== " << string(maxDatasetName, '=') << " =========== ================================================================== ================================================= " << endl;
|
cout << "=== " << string(maxDatasetName, '=') << " =========== " << string(maxFileName, '=') << " " << string(maxHyper, '=') << endl;
|
||||||
auto i = 0;
|
auto i = 0;
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
double total = 0;
|
double total = 0;
|
||||||
@ -170,7 +178,7 @@ namespace platform {
|
|||||||
cout << color << setw(3) << fixed << right << i++ << " ";
|
cout << color << setw(3) << fixed << right << i++ << " ";
|
||||||
cout << setw(maxDatasetName) << left << item.key() << " ";
|
cout << setw(maxDatasetName) << left << item.key() << " ";
|
||||||
cout << setw(11) << setprecision(9) << fixed << value << " ";
|
cout << setw(11) << setprecision(9) << fixed << value << " ";
|
||||||
cout << setw(66) << item.value().at(2).get<string>() << " ";
|
cout << setw(maxFileName) << item.value().at(2).get<string>() << " ";
|
||||||
cout << item.value().at(1) << " ";
|
cout << item.value().at(1) << " ";
|
||||||
cout << endl;
|
cout << endl;
|
||||||
total += value;
|
total += value;
|
||||||
|
@ -60,14 +60,7 @@ namespace platform {
|
|||||||
writeString(row, 1, item.key().c_str(), "text");
|
writeString(row, 1, item.key().c_str(), "text");
|
||||||
writeDouble(row, 2, item.value().at(0).get<double>(), "result");
|
writeDouble(row, 2, item.value().at(0).get<double>(), "result");
|
||||||
writeString(row, 3, item.value().at(2).get<string>(), "text");
|
writeString(row, 3, item.value().at(2).get<string>(), "text");
|
||||||
try {
|
hyperparameters = item.value().at(1).dump();
|
||||||
hyperparameters = item.value().at(1).get<string>();
|
|
||||||
}
|
|
||||||
catch (const exception& err) {
|
|
||||||
stringstream oss;
|
|
||||||
oss << item.value().at(1);
|
|
||||||
hyperparameters = oss.str();
|
|
||||||
}
|
|
||||||
if (hyperparameters.size() > hypSize) {
|
if (hyperparameters.size() > hypSize) {
|
||||||
hypSize = hyperparameters.size();
|
hypSize = hyperparameters.size();
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,12 @@ namespace platform {
|
|||||||
void ReportConsole::body()
|
void ReportConsole::body()
|
||||||
{
|
{
|
||||||
auto tmp = ConfigLocale();
|
auto tmp = ConfigLocale();
|
||||||
|
int maxHyper = 0;
|
||||||
|
for (const auto& r : data["results"]) {
|
||||||
|
maxHyper = max(maxHyper, (int)r["hyperparameters"].dump().size());
|
||||||
|
}
|
||||||
cout << Colors::GREEN() << " # Dataset Sampl. Feat. Cls Nodes Edges States Score Time Hyperparameters" << endl;
|
cout << Colors::GREEN() << " # Dataset Sampl. Feat. Cls Nodes Edges States Score Time Hyperparameters" << endl;
|
||||||
cout << "=== ========================= ====== ===== === ========= ========= ========= =============== =================== ====================" << endl;
|
cout << "=== ========================= ====== ===== === ========= ========= ========= =============== =================== " << string(maxHyper, '=') << endl;
|
||||||
json lastResult;
|
json lastResult;
|
||||||
double totalScore = 0.0;
|
double totalScore = 0.0;
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
|
@ -115,14 +115,7 @@ namespace platform {
|
|||||||
writeString(row, col + 9, status, "textCentered");
|
writeString(row, col + 9, status, "textCentered");
|
||||||
writeDouble(row, col + 10, r["time"].get<double>(), "time");
|
writeDouble(row, col + 10, r["time"].get<double>(), "time");
|
||||||
writeDouble(row, col + 11, r["time_std"].get<double>(), "time");
|
writeDouble(row, col + 11, r["time_std"].get<double>(), "time");
|
||||||
try {
|
hyperparameters = r["hyperparameters"].dump();
|
||||||
hyperparameters = r["hyperparameters"].get<string>();
|
|
||||||
}
|
|
||||||
catch (const exception& err) {
|
|
||||||
stringstream oss;
|
|
||||||
oss << r["hyperparameters"];
|
|
||||||
hyperparameters = oss.str();
|
|
||||||
}
|
|
||||||
if (hyperparameters.size() > hypSize) {
|
if (hyperparameters.size() > hypSize) {
|
||||||
hypSize = hyperparameters.size();
|
hypSize = hyperparameters.size();
|
||||||
}
|
}
|
||||||
@ -130,7 +123,6 @@ namespace platform {
|
|||||||
lastResult = r;
|
lastResult = r;
|
||||||
totalScore += r["score"].get<double>();
|
totalScore += r["score"].get<double>();
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Set the right column width of hyperparameters with the maximum length
|
// Set the right column width of hyperparameters with the maximum length
|
||||||
worksheet_set_column(worksheet, 12, 12, hypSize + 5, NULL);
|
worksheet_set_column(worksheet, 12, 12, hypSize + 5, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user