Add significance level as parameter in best
This commit is contained in:
parent
57c27f739c
commit
93e4ff94db
@ -271,7 +271,6 @@ namespace platform {
|
||||
}
|
||||
void BestResults::reportAll(bool excel)
|
||||
{
|
||||
double significance = 0.05;
|
||||
auto models = getModels();
|
||||
// Build the table of results
|
||||
json table = buildTableResults(models);
|
||||
|
@ -7,7 +7,7 @@ using json = nlohmann::json;
|
||||
namespace platform {
|
||||
class BestResults {
|
||||
public:
|
||||
explicit BestResults(const string& path, const string& score, const string& model, bool friedman) : path(path), score(score), model(model), friedman(friedman) {}
|
||||
explicit BestResults(const string& path, const string& score, const string& model, bool friedman, double significance = 0.05) : path(path), score(score), model(model), friedman(friedman), significance(significance) {}
|
||||
string build();
|
||||
void reportSingle();
|
||||
void reportAll(bool excel);
|
||||
@ -24,6 +24,7 @@ namespace platform {
|
||||
string score;
|
||||
string model;
|
||||
bool friedman;
|
||||
double significance;
|
||||
int maxModelName = 0;
|
||||
int maxDatasetName = 0;
|
||||
};
|
||||
|
@ -15,6 +15,20 @@ argparse::ArgumentParser manageArguments(int argc, char** argv)
|
||||
program.add_argument("--report").help("report of best score results file").default_value(false).implicit_value(true);
|
||||
program.add_argument("--friedman").help("Friedman test").default_value(false).implicit_value(true);
|
||||
program.add_argument("--excel").help("Output to excel").default_value(false).implicit_value(true);
|
||||
program.add_argument("--level").help("significance level").default_value(0.05).scan<'g', double>().action([](const string& value) {
|
||||
try {
|
||||
auto k = stod(value);
|
||||
if (k < 0.01 || k > 0.15) {
|
||||
throw runtime_error("Significance level hast to be a number in [0.01, 0.15]");
|
||||
}
|
||||
return k;
|
||||
}
|
||||
catch (const runtime_error& err) {
|
||||
throw runtime_error(err.what());
|
||||
}
|
||||
catch (...) {
|
||||
throw runtime_error("Number of folds must be an decimal number");
|
||||
}});
|
||||
try {
|
||||
program.parse_args(argc, argv);
|
||||
auto model = program.get<string>("model");
|
||||
@ -23,6 +37,7 @@ argparse::ArgumentParser manageArguments(int argc, char** argv)
|
||||
auto report = program.get<bool>("report");
|
||||
auto friedman = program.get<bool>("friedman");
|
||||
auto excel = program.get<bool>("excel");
|
||||
auto level = program.get<double>("level");
|
||||
if (model == "" || score == "") {
|
||||
throw runtime_error("Model and score name must be supplied");
|
||||
}
|
||||
@ -59,7 +74,8 @@ int main(int argc, char** argv)
|
||||
auto report = program.get<bool>("report");
|
||||
auto friedman = program.get<bool>("friedman");
|
||||
auto excel = program.get<bool>("excel");
|
||||
auto results = platform::BestResults(platform::Paths::results(), score, model, friedman);
|
||||
auto level = program.get<double>("level");
|
||||
auto results = platform::BestResults(platform::Paths::results(), score, model, friedman, level);
|
||||
if (build) {
|
||||
if (model == "any") {
|
||||
results.buildAll();
|
||||
|
Loading…
Reference in New Issue
Block a user