From d0706da887554faf762dad38923ce3e5221b4e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Tue, 21 Jan 2025 20:38:07 +0100 Subject: [PATCH] Fix sort order in bgrid report --- src/commands/b_grid.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/b_grid.cpp b/src/commands/b_grid.cpp index cce453d..2306b26 100644 --- a/src/commands/b_grid.cpp +++ b/src/commands/b_grid.cpp @@ -140,7 +140,8 @@ void list_results(json& results, std::string& model) std::cout << std::string(MAXL, '*') << std::endl; int spaces = 7; int hyperparameters_spaces = 15; - for (const auto& item : results["results"].items()) { + nlohmann::json temp = results["results"]; // To show in alphabetical order of the dataset + for (const auto& item : temp.items()) { auto key = item.key(); auto value = item.value(); if (key.size() > spaces) { @@ -155,7 +156,7 @@ void list_results(json& results, std::string& model) std::cout << "=== " << string(spaces, '=') << " " << string(19, '=') << " " << string(8, '=') << " " << string(8, '=') << " " << string(hyperparameters_spaces, '=') << std::endl; int index = 0; - for (const auto& item : results["results"].items()) { + for (const auto& item : temp.items()) { auto color = (index % 2) ? Colors::CYAN() : Colors::BLUE(); auto value = item.value(); std::cout << color;