refactor gridsearch to have only one go method

This commit is contained in:
2023-12-02 10:59:05 +01:00
parent 33cd32c639
commit 03e4437fea
5 changed files with 176 additions and 137 deletions

View File

@@ -6,6 +6,7 @@
#include "Datasets.h"
#include "HyperParameters.h"
#include "GridData.h"
#include "Timer.h"
namespace platform {
using json = nlohmann::json;
@@ -13,6 +14,7 @@ namespace platform {
std::string model;
std::string score;
std::string continue_from;
std::string platform;
bool quiet;
bool only; // used with continue_from to only compute that dataset
bool discretize;
@@ -24,16 +26,18 @@ namespace platform {
class GridSearch {
public:
explicit GridSearch(struct ConfigGrid& config);
void goSingle();
void goNested();
void go();
~GridSearch() = default;
json getResults();
static inline std::string NO_CONTINUE() { return "NO_CONTINUE"; }
private:
void save(json& results) const;
void save(json& results);
json initializeResults();
vector<std::string> processDatasets(Datasets& datasets);
double processFileSingle(std::string fileName, Datasets& datasets, HyperParameters& hyperparameters);
pair<double, json> processFileSingle(std::string fileName, Datasets& datasets, std::vector<json>& combinations);
pair<double, json> processFileNested(std::string fileName, Datasets& datasets, std::vector<json>& combinations);
struct ConfigGrid config;
Timer timer; // used to measure the time of the whole process
};
} /* namespace platform */
#endif /* GRIDSEARCH_H */