From 2dd04a6c44fae3a1e242a985c15347683c79edee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Mon, 21 Aug 2023 11:57:45 +0200 Subject: [PATCH] enhance saving results and add Makefile copy --- Makefile | 13 +++++++++++++ src/Platform/main.cc | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b883892..23db4eb 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,19 @@ setup: ## Install dependencies for tests and coverage pip install gcovr; \ fi +copy: ## Copy binary files to selected folder + @echo "Destination folder: $(dest)" + @if test "$(dest)" == "" ; then \ + echo "Destination folder is empty"; \ + exit 1; \ + fi + make build + @echo ">>> Copying files to $(dest)" + @cp build/src/Platform/main $(dest) + @cp build/src/Platform/list $(dest) + @cp build/src/Platform/manage $(dest) + @echo ">>> Done" + dependency: ## Create a dependency graph diagram of the project (build/dependency.png) cd build && cmake .. --graphviz=dependency.dot && dot -Tpng dependency.dot -o dependency.png diff --git a/src/Platform/main.cc b/src/Platform/main.cc index b375915..9f8e00b 100644 --- a/src/Platform/main.cc +++ b/src/Platform/main.cc @@ -34,6 +34,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv) ); program.add_argument("--title").default_value("").help("Experiment title"); program.add_argument("--discretize").help("Discretize input dataset").default_value((bool)stoi(env.get("discretize"))).implicit_value(true); + program.add_argument("--save").help("Save result (always save if no dataset is supplied)").default_value(false).implicit_value(true); program.add_argument("--stratified").help("If Stratified KFold is to be done").default_value((bool)stoi(env.get("stratified"))).implicit_value(true); program.add_argument("-f", "--folds").help("Number of folds").default_value(stoi(env.get("n_folds"))).scan<'i', int>().action([](const string& value) { try { @@ -63,6 +64,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv) auto complete_file_name = path + file_name + ".arff"; auto title = program.get("title"); auto hyperparameters = program.get("hyperparameters"); + auto saveResults = program.get("save"); if (title == "" && file_name == "") { throw runtime_error("title is mandatory if dataset is not provided"); } @@ -89,6 +91,7 @@ int main(int argc, char** argv) vector filesToTest; auto datasets = platform::Datasets(path, true, platform::ARFF); auto title = program.get("title"); + auto saveResults = program.get("save"); if (file_name != "") { if (!datasets.isDataset(file_name)) { cerr << "Dataset " << file_name << " not found" << endl; @@ -100,6 +103,7 @@ int main(int argc, char** argv) filesToTest.push_back(file_name); } else { filesToTest = platform::Datasets(path, true, platform::ARFF).getNames(); + saveResults = true; } /* * Begin Processing @@ -117,7 +121,9 @@ int main(int argc, char** argv) timer.start(); experiment.go(filesToTest, path); experiment.setDuration(timer.getDuration()); - experiment.save(platform::Paths::results()); + if (saveResults) { + experiment.save(platform::Paths::results()); + } experiment.report(); cout << "Done!" << endl; return 0;