From facf6f6ddd0f477af5ae4cdb6c183918950ffde1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Thu, 20 Mar 2025 15:54:13 +0100 Subject: [PATCH] Fix GridBase to eliminate uneeded GridData --- src/commands/b_grid.cpp | 2 -- src/grid/GridBase.cpp | 7 +++---- src/grid/GridBase.h | 6 +----- src/grid/GridExperiment.h | 6 +----- src/grid/GridSearch.cpp | 4 ++-- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/commands/b_grid.cpp b/src/commands/b_grid.cpp index d93b689..b6efd56 100644 --- a/src/commands/b_grid.cpp +++ b/src/commands/b_grid.cpp @@ -1,11 +1,9 @@ #include #include #include -#include #include #include #include "main/Models.h" -#include "main/modelRegister.h" #include "main/ArgumentsExperiment.h" #include "common/Paths.h" #include "common/Timer.hpp" diff --git a/src/grid/GridBase.cpp b/src/grid/GridBase.cpp index 3626db7..85bb906 100644 --- a/src/grid/GridBase.cpp +++ b/src/grid/GridBase.cpp @@ -2,9 +2,10 @@ #include #include "common/DotEnv.h" #include "common/Paths.h" -#include "common/DotEnv.h" +#include "common/Colors.h" #include "GridBase.h" + namespace platform { GridBase::GridBase(struct ConfigGrid& config) @@ -63,13 +64,11 @@ namespace platform { * This way a task consists in process all combinations of hyperparameters for a dataset, seed and fold */ auto tasks = json::array(); - auto grid = GridData(Paths::grid_input(config.model)); auto all_datasets = datasets.getNames(); auto datasets_names = filterDatasets(datasets); for (int idx_dataset = 0; idx_dataset < datasets_names.size(); ++idx_dataset) { auto dataset = datasets_names[idx_dataset]; for (const auto& seed : config.seeds) { - auto combinations = grid.getGrid(dataset); for (int n_fold = 0; n_fold < config.n_folds; n_fold++) { json task = { { "dataset", dataset }, @@ -312,4 +311,4 @@ namespace platform { } } -} \ No newline at end of file +} diff --git a/src/grid/GridBase.h b/src/grid/GridBase.h index 8ae3421..b59088a 100644 --- a/src/grid/GridBase.h +++ b/src/grid/GridBase.h @@ -1,16 +1,12 @@ #ifndef GRIDBASE_H #define GRIDBASE_H #include -#include #include #include #include "common/Datasets.h" #include "common/Timer.hpp" -#include "common/Colors.h" #include "main/HyperParameters.h" -#include "GridData.h" #include "GridConfig.h" -#include "bayesnet/network/Network.h" namespace platform { @@ -40,4 +36,4 @@ namespace platform { bayesnet::Smoothing_t smooth_type{ bayesnet::Smoothing_t::NONE }; }; } /* namespace platform */ -#endif \ No newline at end of file +#endif diff --git a/src/grid/GridExperiment.h b/src/grid/GridExperiment.h index 81503e3..7329d8a 100644 --- a/src/grid/GridExperiment.h +++ b/src/grid/GridExperiment.h @@ -1,18 +1,14 @@ #ifndef GRIDEXPERIMENT_H #define GRIDEXPERIMENT_H #include -#include #include #include #include #include "common/Datasets.h" -#include "common/DotEnv.h" #include "main/Experiment.h" #include "main/HyperParameters.h" #include "main/ArgumentsExperiment.h" -#include "GridData.h" #include "GridBase.h" -#include "bayesnet/network/Network.h" namespace platform { @@ -39,4 +35,4 @@ namespace platform { void consumer_go(struct ConfigGrid& config, struct ConfigMPI& config_mpi, json& tasks, int n_task, Datasets& datasets, Task_Result* result); }; } /* namespace platform */ -#endif \ No newline at end of file +#endif diff --git a/src/grid/GridSearch.cpp b/src/grid/GridSearch.cpp index 6fd955d..0a8010e 100644 --- a/src/grid/GridSearch.cpp +++ b/src/grid/GridSearch.cpp @@ -1,10 +1,10 @@ #include -#include #include #include #include "main/Models.h" #include "common/Paths.h" #include "common/Utils.h" +#include "common/Colors.h" #include "GridSearch.h" namespace platform { @@ -256,4 +256,4 @@ namespace platform { // std::cout << get_color_rank(config_mpi.rank) << std::flush; } -} /* namespace platform */ \ No newline at end of file +} /* namespace platform */