Replace #define ... with pragma once
This commit is contained in:
@@ -42,7 +42,7 @@ add_executable(b_main ${main_sources} common/Datasets.cc common/Dataset.cc repor
|
||||
target_link_libraries(b_main "${PyClassifiers}" "${BayesNet}" ArffFiles mdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" ${LIBTORCH_PYTHON} Boost::python Boost::numpy)
|
||||
|
||||
# b_manage
|
||||
set(manage_sources b_manage.cc ManageResults.cc CommandParser.cc Results.cc)
|
||||
set(manage_sources b_manage.cc ManageResults.cc CommandParser.cc ResultsManager.cc)
|
||||
list(TRANSFORM manage_sources PREPEND manage/)
|
||||
add_executable(
|
||||
b_manage ${manage_sources} main/Result.cc
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#ifndef BESTRESULTS_H
|
||||
#define BESTRESULTS_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <nlohmann/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
@@ -34,4 +34,3 @@ namespace platform {
|
||||
int maxDatasetName = 0;
|
||||
};
|
||||
}
|
||||
#endif //BESTRESULTS_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef BESTRESULTS_EXCEL_H
|
||||
#define BESTRESULTS_EXCEL_H
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
@@ -34,4 +34,3 @@ namespace platform {
|
||||
int datasetNameSize = 25; // Min size of the column
|
||||
};
|
||||
}
|
||||
#endif //BESTRESULTS_EXCEL_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef BESTSCORE_H
|
||||
#define BESTSCORE_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
@@ -24,5 +24,3 @@ namespace platform {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef STATISTICS_H
|
||||
#define STATISTICS_H
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -60,4 +60,3 @@ namespace platform {
|
||||
std::map<std::string, std::map<std::string, float>> ranksModels;
|
||||
};
|
||||
}
|
||||
#endif // !STATISTICS_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef LOCALE_H
|
||||
#define LOCALE_H
|
||||
#pragma once
|
||||
|
||||
#include <locale>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -19,4 +19,3 @@ namespace platform {
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef COLORS_H
|
||||
#define COLORS_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
class Colors {
|
||||
public:
|
||||
@@ -13,4 +13,3 @@ public:
|
||||
static std::string IBLUE() { return "\033[0;94m"; }
|
||||
static std::string RESET() { return "\033[0m"; }
|
||||
};
|
||||
#endif // COLORS_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef DATASET_H
|
||||
#define DATASET_H
|
||||
#pragma once
|
||||
|
||||
#include <torch/torch.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -75,4 +75,3 @@ namespace platform {
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef DATASETS_H
|
||||
#define DATASETS_H
|
||||
#pragma once
|
||||
|
||||
#include "Dataset.h"
|
||||
namespace platform {
|
||||
class Datasets {
|
||||
@@ -27,5 +27,3 @@ namespace platform {
|
||||
std::string toString() const;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef DOTENV_H
|
||||
#define DOTENV_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
@@ -52,4 +52,3 @@ namespace platform {
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef PATHS_H
|
||||
#define PATHS_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include "DotEnv.h"
|
||||
@@ -36,4 +36,3 @@ namespace platform {
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef SYMBOLS_H
|
||||
#define SYMBOLS_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
namespace platform {
|
||||
class Symbols {
|
||||
@@ -15,4 +15,3 @@ namespace platform {
|
||||
inline static const std::string notebook{ "\U0001F5C8" };
|
||||
};
|
||||
}
|
||||
#endif // !SYMBOLS_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef TIMER_H
|
||||
#define TIMER_H
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@@ -40,4 +40,3 @@ namespace platform {
|
||||
}
|
||||
};
|
||||
} /* namespace platform */
|
||||
#endif /* TIMER_H */
|
@@ -1,5 +1,5 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -27,4 +27,3 @@ namespace platform {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef GRIDDATA_H
|
||||
#define GRIDDATA_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -23,4 +23,3 @@ namespace platform {
|
||||
std::map<std::string, json> grid;
|
||||
};
|
||||
} /* namespace platform */
|
||||
#endif /* GRIDDATA_H */
|
@@ -1,5 +1,5 @@
|
||||
#ifndef GRIDSEARCH_H
|
||||
#define GRIDSEARCH_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <mpi.h>
|
||||
@@ -57,4 +57,3 @@ namespace platform {
|
||||
Timer timer; // used to measure the time of the whole process
|
||||
};
|
||||
} /* namespace platform */
|
||||
#endif /* GRIDSEARCH_H */
|
@@ -1,5 +1,5 @@
|
||||
#ifndef DATASETS_EXCEL_H
|
||||
#define DATASETS_EXCEL_H
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
@@ -16,4 +16,3 @@ namespace platform {
|
||||
void report(json& data);
|
||||
};
|
||||
}
|
||||
#endif //DATASETS_EXCEL_H
|
@@ -75,6 +75,9 @@ void list_datasets(argparse::ArgumentParser& program)
|
||||
void list_results(argparse::ArgumentParser& program)
|
||||
{
|
||||
std::cout << "Results" << std::endl;
|
||||
auto dataset = program.get<string>("--dataset");
|
||||
auto score = program.get<string>("--score");
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
@@ -107,6 +110,7 @@ int main(int argc, char** argv)
|
||||
throw std::runtime_error("Dataset must be one of " + datasets.toString());
|
||||
}
|
||||
);
|
||||
program.add_argument("-s", "--score").default_value("accuracy").help("Filter results of the score name supplied");
|
||||
// Add subparsers
|
||||
program.add_subparser(datasets_command);
|
||||
program.add_subparser(results_command);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#ifndef EXPERIMENT_H
|
||||
#define EXPERIMENT_H
|
||||
#pragma once
|
||||
|
||||
#include <torch/torch.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
@@ -43,4 +43,3 @@ namespace platform {
|
||||
int max_name{ 7 }; // max length of dataset name for formatting (default 7)
|
||||
};
|
||||
}
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef HYPERPARAMETERS_H
|
||||
#define HYPERPARAMETERS_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -20,4 +20,3 @@ namespace platform {
|
||||
std::map<std::string, json> hyperparameters;
|
||||
};
|
||||
} /* namespace platform */
|
||||
#endif /* HYPERPARAMETERS_H */
|
@@ -1,5 +1,5 @@
|
||||
#ifndef MODELS_H
|
||||
#define MODELS_H
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <bayesnet/BaseClassifier.h>
|
||||
#include <bayesnet/ensembles/AODE.h>
|
||||
@@ -39,4 +39,3 @@ namespace platform {
|
||||
Registrar(const std::string& className, function<bayesnet::BaseClassifier* (void)> classFactoryFunction);
|
||||
};
|
||||
}
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef RESULT_H
|
||||
#define RESULT_H
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -48,4 +48,3 @@ namespace platform {
|
||||
double score = 0.0;
|
||||
};
|
||||
};
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef MODEL_REGISTER_H
|
||||
#define MODEL_REGISTER_H
|
||||
#pragma once
|
||||
|
||||
static platform::Registrar registrarT("TAN",
|
||||
[](void) -> bayesnet::BaseClassifier* { return new bayesnet::TAN();});
|
||||
static platform::Registrar registrarTLD("TANLd",
|
||||
@@ -28,4 +28,3 @@ static platform::Registrar registrarRaF("RandomForest",
|
||||
[](void) -> bayesnet::BaseClassifier* { return new pywrap::RandomForest();});
|
||||
static platform::Registrar registrarXGB("XGBoost",
|
||||
[](void) -> bayesnet::BaseClassifier* { return new pywrap::XGBoost();});
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef COMMAND_PARSER_H
|
||||
#define COMMAND_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
@@ -17,4 +17,3 @@ namespace platform {
|
||||
int index;
|
||||
};
|
||||
} /* namespace platform */
|
||||
#endif /* COMMAND_PARSER_H */
|
@@ -12,7 +12,7 @@
|
||||
namespace platform {
|
||||
|
||||
ManageResults::ManageResults(int numFiles, const std::string& model, const std::string& score, bool complete, bool partial, bool compare) :
|
||||
numFiles{ numFiles }, complete{ complete }, partial{ partial }, compare{ compare }, results(Results(Paths::results(), model, score, complete, partial))
|
||||
numFiles{ numFiles }, complete{ complete }, partial{ partial }, compare{ compare }, results(ResultsManager(model, score, complete, partial))
|
||||
{
|
||||
indexList = true;
|
||||
openExcel = false;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef MANAGE_RESULTS_H
|
||||
#define MANAGE_RESULTS_H
|
||||
#pragma once
|
||||
|
||||
#include <xlsxwriter.h>
|
||||
#include "Results.h"
|
||||
#include "ResultsManager.h"
|
||||
|
||||
namespace platform {
|
||||
class ManageResults {
|
||||
@@ -23,9 +23,7 @@ namespace platform {
|
||||
bool complete;
|
||||
bool partial;
|
||||
bool compare;
|
||||
Results results;
|
||||
ResultsManager results;
|
||||
lxw_workbook* workbook;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* MANAGE_RESULTS_H */
|
@@ -1,9 +1,10 @@
|
||||
#include <algorithm>
|
||||
#include "Results.h"
|
||||
#include "common/Paths.h"
|
||||
#include "ResultsManager.h"
|
||||
|
||||
namespace platform {
|
||||
Results::Results(const std::string& path, const std::string& model, const std::string& score, bool complete, bool partial) :
|
||||
path(path), model(model), scoreName(score), complete(complete), partial(partial)
|
||||
ResultsManager::ResultsManager(const std::string& model, const std::string& score, bool complete, bool partial) :
|
||||
path(Paths::results()), model(model), scoreName(score), complete(complete), partial(partial)
|
||||
{
|
||||
load();
|
||||
if (!files.empty()) {
|
||||
@@ -12,7 +13,7 @@ namespace platform {
|
||||
maxModel = 0;
|
||||
}
|
||||
}
|
||||
void Results::load()
|
||||
void ResultsManager::load()
|
||||
{
|
||||
using std::filesystem::directory_iterator;
|
||||
for (const auto& file : directory_iterator(path)) {
|
||||
@@ -28,47 +29,47 @@ namespace platform {
|
||||
}
|
||||
}
|
||||
}
|
||||
void Results::hideResult(int index, const std::string& pathHidden)
|
||||
void ResultsManager::hideResult(int index, const std::string& pathHidden)
|
||||
{
|
||||
auto filename = files.at(index).getFilename();
|
||||
rename((path + "/" + filename).c_str(), (pathHidden + "/" + filename).c_str());
|
||||
files.erase(files.begin() + index);
|
||||
}
|
||||
void Results::deleteResult(int index)
|
||||
void ResultsManager::deleteResult(int index)
|
||||
{
|
||||
auto filename = files.at(index).getFilename();
|
||||
remove((path + "/" + filename).c_str());
|
||||
files.erase(files.begin() + index);
|
||||
}
|
||||
int Results::size() const
|
||||
int ResultsManager::size() const
|
||||
{
|
||||
return files.size();
|
||||
}
|
||||
void Results::sortDate()
|
||||
void ResultsManager::sortDate()
|
||||
{
|
||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||
return a.getDate() > b.getDate();
|
||||
});
|
||||
}
|
||||
void Results::sortModel()
|
||||
void ResultsManager::sortModel()
|
||||
{
|
||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||
return a.getModel() > b.getModel();
|
||||
});
|
||||
}
|
||||
void Results::sortDuration()
|
||||
void ResultsManager::sortDuration()
|
||||
{
|
||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||
return a.getDuration() > b.getDuration();
|
||||
});
|
||||
}
|
||||
void Results::sortScore()
|
||||
void ResultsManager::sortScore()
|
||||
{
|
||||
sort(files.begin(), files.end(), [](const Result& a, const Result& b) {
|
||||
return a.getScore() > b.getScore();
|
||||
});
|
||||
}
|
||||
bool Results::empty() const
|
||||
bool ResultsManager::empty() const
|
||||
{
|
||||
return files.empty();
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
#ifndef RESULTS_H
|
||||
#define RESULTS_H
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "main/Result.h"
|
||||
namespace platform {
|
||||
using json = nlohmann::json;
|
||||
class Results {
|
||||
class ResultsManager {
|
||||
public:
|
||||
Results(const std::string& path, const std::string& model, const std::string& score, bool complete, bool partial);
|
||||
ResultsManager(const std::string& model, const std::string& score, bool complete, bool partial);
|
||||
void sortDate();
|
||||
void sortScore();
|
||||
void sortModel();
|
||||
@@ -33,4 +33,3 @@ namespace platform {
|
||||
void load(); // Loads the list of results
|
||||
};
|
||||
};
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef EXCELFILE_H
|
||||
#define EXCELFILE_H
|
||||
#pragma once
|
||||
|
||||
#include <locale>
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -42,4 +42,3 @@ namespace platform {
|
||||
void setDefault();
|
||||
};
|
||||
}
|
||||
#endif // !EXCELFILE_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef REPORTBASE_H
|
||||
#define REPORTBASE_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
@@ -33,4 +33,3 @@ namespace platform {
|
||||
bool existBestFile = true;
|
||||
};
|
||||
};
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef REPORTCONSOLE_H
|
||||
#define REPORTCONSOLE_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "common/Colors.h"
|
||||
#include "ReportBase.h"
|
||||
@@ -19,4 +19,3 @@ namespace platform {
|
||||
void showSummary() override;
|
||||
};
|
||||
};
|
||||
#endif
|
@@ -1,5 +1,5 @@
|
||||
#ifndef REPORTEXCEL_H
|
||||
#define REPORTEXCEL_H
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <xlsxwriter.h>
|
||||
#include "common/Colors.h"
|
||||
@@ -22,4 +22,3 @@ namespace platform {
|
||||
void header_notes(int row);
|
||||
};
|
||||
};
|
||||
#endif // !REPORTEXCEL_H
|
@@ -1,5 +1,5 @@
|
||||
#ifndef TEST_UTILS_H
|
||||
#define TEST_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include <torch/torch.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -40,4 +40,3 @@ public:
|
||||
double epsilon = 1e-5;
|
||||
};
|
||||
|
||||
#endif //TEST_UTILS_H
|
Reference in New Issue
Block a user