Complete file output in ResultsDataset & ReportDataset
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "common/Paths.h"
|
||||
#include "CommandParser.h"
|
||||
#include "ManageResults.h"
|
||||
//#include "reports/DatasetsConsole.h"
|
||||
#include "reports/DatasetsConsole.h"
|
||||
#include "reports/ReportConsole.h"
|
||||
#include "reports/ReportExcel.h"
|
||||
#include "reports/ReportExcelCompared.h"
|
||||
@@ -114,10 +114,10 @@ namespace platform {
|
||||
}
|
||||
void ManageResults::list_datasets(const std::string& status_message, const std::string& status_color)
|
||||
{
|
||||
// auto report = DatasetsConsole();
|
||||
// report.list_datasets();
|
||||
// auto output = report.getOutput();
|
||||
// paginator[static_cast<int>(output_type)].setTotal(report.getNumLines());
|
||||
auto report = DatasetsConsole();
|
||||
report.list_datasets();
|
||||
auto output = report.getOutput();
|
||||
paginator[static_cast<int>(output_type)].setTotal(report.getNumLines());
|
||||
//
|
||||
// header
|
||||
//
|
||||
|
@@ -18,10 +18,10 @@ namespace platform {
|
||||
}
|
||||
void DatasetsConsole::list_datasets()
|
||||
{
|
||||
output.str("");
|
||||
auto datasets = platform::Datasets(false, platform::Paths::datasets());
|
||||
locale mylocale(std::cout.getloc(), new separated_datasets);
|
||||
locale::global(mylocale);
|
||||
output.imbue(mylocale);
|
||||
auto loc = std::locale("es_ES");
|
||||
output.imbue(loc);
|
||||
output << Colors::GREEN() << " # Dataset Sampl. Feat. Cls Balance" << std::endl;
|
||||
std::string balanceBars = std::string(DatasetsConsole::BALANCE_LENGTH, '=');
|
||||
output << "=== ============================== ====== ===== === " << balanceBars << std::endl;
|
||||
|
@@ -7,11 +7,6 @@
|
||||
namespace platform {
|
||||
using json = nlohmann::json;
|
||||
|
||||
struct separated_datasets : numpunct<char> {
|
||||
char do_decimal_point() const { return ','; }
|
||||
char do_thousands_sep() const { return '.'; }
|
||||
std::string do_grouping() const { return "\03"; }
|
||||
};
|
||||
|
||||
class DatasetsConsole {
|
||||
public:
|
||||
|
@@ -6,13 +6,6 @@
|
||||
#include <xlsxwriter.h>
|
||||
|
||||
namespace platform {
|
||||
struct separated : std::numpunct<char> {
|
||||
char do_decimal_point() const { return ','; }
|
||||
|
||||
char do_thousands_sep() const { return '.'; }
|
||||
|
||||
std::string do_grouping() const { return "\03"; }
|
||||
};
|
||||
class ExcelFile {
|
||||
public:
|
||||
ExcelFile();
|
||||
|
@@ -60,9 +60,8 @@ namespace platform {
|
||||
|
||||
void ReportExcel::header()
|
||||
{
|
||||
std::locale mylocale(std::cout.getloc(), new separated);
|
||||
std::locale::global(mylocale);
|
||||
std::cout.imbue(mylocale);
|
||||
auto loc = std::locale("es_ES");
|
||||
std::cout.imbue(loc);
|
||||
std::stringstream oss;
|
||||
std::string message = data["model"].get<std::string>() + " ver. " + data["version"].get<std::string>() + " " +
|
||||
data["language"].get<std::string>() + " ver. " + data["language_version"].get<std::string>() +
|
||||
|
@@ -6,6 +6,8 @@ namespace platform {
|
||||
void ResultsDatasetsConsole::list_results(const std::string& dataset, const std::string& score, const std::string& model)
|
||||
{
|
||||
output.str("");
|
||||
auto loc = std::locale("es_ES");
|
||||
output.imbue(loc);
|
||||
auto results = platform::ResultsDataset(dataset, model, score);
|
||||
results.load();
|
||||
results.sortModel();
|
||||
@@ -16,8 +18,16 @@ namespace platform {
|
||||
int maxModel = results.maxModelSize();
|
||||
int maxHyper = results.maxHyperSize();
|
||||
double maxResult = results.maxResultScore();
|
||||
//
|
||||
// Build data for the Report
|
||||
json data = json::object();
|
||||
//
|
||||
data = json::object();
|
||||
data["dataset"] = dataset;
|
||||
data["score"] = score;
|
||||
data["model"] = model;
|
||||
data["lengths"]["maxModel"] = maxModel;
|
||||
data["lengths"]["maxHyper"] = maxHyper;
|
||||
data["maxResult"] = maxResult;
|
||||
data["results"] = json::array();
|
||||
data["max_models"] = json::object(); // Max score per model
|
||||
for (const auto& result : results) {
|
||||
@@ -27,7 +37,6 @@ namespace platform {
|
||||
}
|
||||
for (const auto& item : results["results"]) {
|
||||
if (item["dataset"] == dataset) {
|
||||
|
||||
// Store data for Excel report
|
||||
json res = json::object();
|
||||
res["date"] = result.getDate();
|
||||
@@ -65,12 +74,6 @@ namespace platform {
|
||||
output << item["hyperparameters"].get<std::string>() << std::endl;
|
||||
numLines++;
|
||||
}
|
||||
data["dataset"] = dataset;
|
||||
data["score"] = score;
|
||||
data["model"] = model;
|
||||
data["lengths"]["maxModel"] = maxModel;
|
||||
data["lengths"]["maxHyper"] = maxHyper;
|
||||
data["maxResult"] = maxResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@ namespace platform {
|
||||
~ResultsDatasetsConsole() = default;
|
||||
std::string getOutput() const { return output.str(); }
|
||||
int getNumLines() const { return numLines; }
|
||||
json getData() { return data; }
|
||||
json& getData() { return data; }
|
||||
void list_results(const std::string& dataset, const std::string& score, const std::string& model);
|
||||
private:
|
||||
std::stringstream output;
|
||||
|
Reference in New Issue
Block a user