Add show dataset detail in report
This commit is contained in:
parent
0b7beda78c
commit
64fc7bd9dd
@ -36,14 +36,21 @@ namespace platform {
|
|||||||
}
|
}
|
||||||
void ReportConsole::body()
|
void ReportConsole::body()
|
||||||
{
|
{
|
||||||
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 << "=== ============================== ====== ===== === ========= ========= ========= =============== ================== ===============" << endl;
|
||||||
json lastResult;
|
json lastResult;
|
||||||
double totalScore = 0.0;
|
double totalScore = 0.0;
|
||||||
bool odd = true;
|
bool odd = true;
|
||||||
|
int index = 0;
|
||||||
for (const auto& r : data["results"]) {
|
for (const auto& r : data["results"]) {
|
||||||
|
if (selectedIndex != -1 && index != selectedIndex) {
|
||||||
|
index++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
auto color = odd ? Colors::CYAN() : Colors::BLUE();
|
auto color = odd ? Colors::CYAN() : Colors::BLUE();
|
||||||
cout << color << setw(30) << left << r["dataset"].get<string>() << " ";
|
cout << color;
|
||||||
|
cout << setw(3) << index++ << " ";
|
||||||
|
cout << setw(30) << 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>() << " ";
|
||||||
@ -63,7 +70,7 @@ namespace platform {
|
|||||||
totalScore += r["score"].get<double>();
|
totalScore += r["score"].get<double>();
|
||||||
odd = !odd;
|
odd = !odd;
|
||||||
}
|
}
|
||||||
if (data["results"].size() == 1) {
|
if (data["results"].size() == 1 || selectedIndex != -1) {
|
||||||
cout << string(MAXL, '*') << endl;
|
cout << string(MAXL, '*') << endl;
|
||||||
cout << headerLine(fVector("Train scores: ", lastResult["scores_train"], 14, 12));
|
cout << headerLine(fVector("Train scores: ", lastResult["scores_train"], 14, 12));
|
||||||
cout << headerLine(fVector("Test scores: ", lastResult["scores_test"], 14, 12));
|
cout << headerLine(fVector("Test scores: ", lastResult["scores_test"], 14, 12));
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
|
|
||||||
namespace platform {
|
namespace platform {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
const int MAXL = 128;
|
const int MAXL = 132;
|
||||||
class ReportConsole : public ReportBase{
|
class ReportConsole : public ReportBase {
|
||||||
public:
|
public:
|
||||||
explicit ReportConsole(json data_) : ReportBase(data_) {};
|
explicit ReportConsole(json data_, int index = -1) : ReportBase(data_), selectedIndex(index) {};
|
||||||
virtual ~ReportConsole() = default;
|
virtual ~ReportConsole() = default;
|
||||||
private:
|
private:
|
||||||
|
int selectedIndex;
|
||||||
string headerLine(const string& text);
|
string headerLine(const string& text);
|
||||||
void header() override;
|
void header() override;
|
||||||
void body() override;
|
void body() override;
|
||||||
|
@ -110,6 +110,17 @@ namespace platform {
|
|||||||
reporter.show();
|
reporter.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void Results::showIndex(const int index, const int idx) const
|
||||||
|
{
|
||||||
|
auto data = files.at(index).load();
|
||||||
|
if (idx < 0 or idx >= static_cast<int>(data["results"].size())) {
|
||||||
|
cout << "Invalid index" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cout << Colors::YELLOW() << "Showing " << files.at(index).getFilename() << endl;
|
||||||
|
ReportConsole reporter(data, idx);
|
||||||
|
reporter.show();
|
||||||
|
}
|
||||||
void Results::menu()
|
void Results::menu()
|
||||||
{
|
{
|
||||||
char option;
|
char option;
|
||||||
@ -129,9 +140,16 @@ namespace platform {
|
|||||||
option = line[0];
|
option = line[0];
|
||||||
} else {
|
} else {
|
||||||
if (all_of(line.begin(), line.end(), ::isdigit)) {
|
if (all_of(line.begin(), line.end(), ::isdigit)) {
|
||||||
index = stoi(line);
|
int idx = stoi(line);
|
||||||
|
if (indexList) {
|
||||||
|
index = idx;
|
||||||
if (index >= 0 && index < files.size()) {
|
if (index >= 0 && index < files.size()) {
|
||||||
report(index, false);
|
report(index, false);
|
||||||
|
indexList = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showIndex(index, idx);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,6 +162,7 @@ namespace platform {
|
|||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
show();
|
show();
|
||||||
|
indexList = true;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
index = getIndex("delete");
|
index = getIndex("delete");
|
||||||
@ -155,6 +174,7 @@ namespace platform {
|
|||||||
files.erase(files.begin() + index);
|
files.erase(files.begin() + index);
|
||||||
cout << "File: " + filename + " deleted!" << endl;
|
cout << "File: " + filename + " deleted!" << endl;
|
||||||
show();
|
show();
|
||||||
|
indexList = true;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
index = getIndex("hide");
|
index = getIndex("hide");
|
||||||
@ -166,21 +186,25 @@ namespace platform {
|
|||||||
files.erase(files.begin() + index);
|
files.erase(files.begin() + index);
|
||||||
show();
|
show();
|
||||||
menu();
|
menu();
|
||||||
|
indexList = true;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
sortList();
|
sortList();
|
||||||
|
indexList = true;
|
||||||
show();
|
show();
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
index = getIndex("report");
|
index = getIndex("report");
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
break;
|
break;
|
||||||
|
indexList = false;
|
||||||
report(index, false);
|
report(index, false);
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
index = getIndex("excel");
|
index = getIndex("excel");
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
break;
|
break;
|
||||||
|
indexList = true;
|
||||||
report(index, true);
|
report(index, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -42,10 +42,12 @@ namespace platform {
|
|||||||
string model;
|
string model;
|
||||||
string scoreName;
|
string scoreName;
|
||||||
bool complete;
|
bool complete;
|
||||||
|
bool indexList = true;
|
||||||
vector<Result> files;
|
vector<Result> files;
|
||||||
void load(); // Loads the list of results
|
void load(); // Loads the list of results
|
||||||
void show() const;
|
void show() const;
|
||||||
void report(const int index, const bool excelReport) const;
|
void report(const int index, const bool excelReport) const;
|
||||||
|
void showIndex(const int index, const int idx) const;
|
||||||
int getIndex(const string& intent) const;
|
int getIndex(const string& intent) const;
|
||||||
void menu();
|
void menu();
|
||||||
void sortList();
|
void sortList();
|
||||||
|
Loading…
Reference in New Issue
Block a user