Add support to old format results
This commit is contained in:
@@ -250,6 +250,10 @@ namespace platform {
|
||||
//
|
||||
// Results
|
||||
//
|
||||
if (results.empty()) {
|
||||
std::cout << "No results found!" << std::endl;
|
||||
return;
|
||||
}
|
||||
auto [index_from, index_to] = paginator[static_cast<int>(output_type)].getOffset();
|
||||
for (int i = index_from; i <= index_to; i++) {
|
||||
auto color = (i % 2) ? Colors::BLUE() : Colors::CYAN();
|
||||
|
@@ -27,9 +27,23 @@ namespace platform {
|
||||
std::string discretiz_algo = data.find("discretization_algorithm") != data.end() ? data["discretization_algorithm"].get<std::string>() : "ORIGINAL";
|
||||
std::string algorithm = data["discretized"].get<bool>() ? " (" + discretiz_algo + ")" : "";
|
||||
std::string smooth = data.find("smooth_strategy") != data.end() ? data["smooth_strategy"].get<std::string>() : "ORIGINAL";
|
||||
std::string stratified;
|
||||
try {
|
||||
stratified = data["stratified"].get<bool>() ? "True" : "False";
|
||||
}
|
||||
catch (nlohmann::json::type_error) {
|
||||
stratified = data["stratified"].get<int>() == 1 ? "True" : "False";
|
||||
}
|
||||
std::string discretized;
|
||||
try {
|
||||
discretized = data["discretized"].get<bool>() ? "True" : "False";
|
||||
}
|
||||
catch (nlohmann::json::type_error) {
|
||||
discretized = data["discretized"].get<int>() == 1 ? "True" : "False";
|
||||
}
|
||||
sheader << headerLine(
|
||||
"Random seeds: " + fromVector("seeds") + " Discretized: " + (data["discretized"].get<bool>() ? "True" : "False") + algorithm
|
||||
+ " Stratified: " + (data["stratified"].get<bool>() ? "True" : "False") + " Smooth Strategy: " + smooth
|
||||
"Random seeds: " + fromVector("seeds") + " Discretized: " + discretized + " " + algorithm
|
||||
+ " Stratified: " + stratified + " Smooth Strategy: " + smooth
|
||||
);
|
||||
Timer timer;
|
||||
oss << "Execution took " << timer.translate2String(data["duration"].get<float>())
|
||||
|
@@ -72,20 +72,39 @@ namespace platform {
|
||||
std::string Result::getFilename() const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "results_" << data.at("score_name").get<std::string>() << "_" << data.at("model").get<std::string>() << "_"
|
||||
<< data.at("platform").get<std::string>() << "_" << data["date"].get<std::string>() << "_"
|
||||
<< data["time"].get<std::string>() << "_" << (data["stratified"] ? "1" : "0") << ".json";
|
||||
std::string stratified;
|
||||
try {
|
||||
stratified = data["stratified"].get<bool>() ? "1" : "0";
|
||||
}
|
||||
catch (nlohmann::json_abi_v3_11_3::detail::type_error) {
|
||||
stratified = data["stratified"].get<int>() == 1 ? "1" : "0";
|
||||
}
|
||||
oss << "results_"
|
||||
<< data.at("score_name").get<std::string>() << "_"
|
||||
<< data.at("model").get<std::string>() << "_"
|
||||
<< data.at("platform").get<std::string>() << "_"
|
||||
<< data["date"].get<std::string>() << "_"
|
||||
<< data["time"].get<std::string>() << "_"
|
||||
<< stratified << ".json";
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
||||
std::string Result::to_string(int maxModel, int maxTitle) const
|
||||
{
|
||||
auto tmp = ConfigLocale();
|
||||
std::stringstream oss;
|
||||
std::string s = data["stratified"].get<bool>() ? "S" : "";
|
||||
std::string d = data["discretized"].get<bool>() ? "D" : "";
|
||||
std::string sd = s + d;
|
||||
std::string s, d;
|
||||
try {
|
||||
s = data["stratified"].get<bool>() ? "S" : " ";
|
||||
}
|
||||
catch (nlohmann::json_abi_v3_11_3::detail::type_error) {
|
||||
s = data["stratified"].get<int>() == 1 ? "S" : " ";
|
||||
}
|
||||
try {
|
||||
d = data["discretized"].get<bool>() ? "D" : " ";
|
||||
}
|
||||
catch (nlohmann::json_abi_v3_11_3::detail::type_error) {
|
||||
d = data["discretized"].get<int>() == 1 ? "D" : " ";
|
||||
}
|
||||
auto duration = data["duration"].get<double>();
|
||||
double durationShow = duration > 3600 ? duration / 3600 : duration > 60 ? duration / 60 : duration;
|
||||
std::string durationUnit = duration > 3600 ? "h" : duration > 60 ? "m" : "s";
|
||||
@@ -94,7 +113,7 @@ namespace platform {
|
||||
oss << std::setw(11) << std::left << data["score_name"].get<std::string>() << " ";
|
||||
oss << std::right << std::setw(10) << std::setprecision(7) << std::fixed << score << " ";
|
||||
oss << std::left << std::setw(12) << data["platform"].get<std::string>() << " ";
|
||||
oss << std::left << std::setw(2) << sd << " ";
|
||||
oss << s << d << " ";
|
||||
auto completeString = isComplete() ? "C" : "P";
|
||||
oss << std::setw(1) << " " << completeString << " ";
|
||||
oss << std::setw(5) << std::right << std::setprecision(2) << std::fixed << durationShow << " " << durationUnit << " ";
|
||||
|
Reference in New Issue
Block a user