diff --git a/decoder/src/Decoder.cpp b/decoder/src/Decoder.cpp index bfd694e266719173aa9e73cd806e30c74e4e4f0e..b4ae4fe8a8f50a9c50bc3b55d06bb2f127e92b57 100644 --- a/decoder/src/Decoder.cpp +++ b/decoder/src/Decoder.cpp @@ -67,6 +67,17 @@ void Decoder::decode() if (classifier->needsTrain() && ProgramParameters::errorAnalysis && (classifier->name == ProgramParameters::classifierName || ProgramParameters::classifierName.empty())) { auto zeroCostActions = classifier->getZeroCostActions(config); + if (zeroCostActions.empty()) + { + fprintf(stderr, "ERROR (%s) : could not find zero cost action for classifier \'%s\'. Aborting.\n", ERRINFO, classifier->name.c_str()); + config.printForDebug(stderr); + for (auto & a : weightedActions) + { + fprintf(stderr, "%s : ", a.second.second.c_str()); + Oracle::explainCostOfAction(stderr, config, a.second.second); + } + exit(1); + } std::string oAction = zeroCostActions[0]; for (auto & s : zeroCostActions) if (action->name == s) diff --git a/decoder/src/macaon_decode.cpp b/decoder/src/macaon_decode.cpp index 87aa954a0b45c7897258547c1738810063cb88fa..f4012928b003bf7b94678bc0f18aae69bef5ee1f 100644 --- a/decoder/src/macaon_decode.cpp +++ b/decoder/src/macaon_decode.cpp @@ -57,6 +57,8 @@ po::options_description getOptionsDescription() ("errorAnalysis", "Print an analysis of errors") ("meanEntropy", "Print the mean entropy for error types") ("onlyPrefixes", "Only uses the prefixes of error categories") + ("nbErrorsToShow", po::value<int>()->default_value(10), + "Display only the X most common errors") ("classifier", po::value<std::string>()->default_value(""), "Name of the monitored classifier, if not specified monitor everyone"); @@ -120,6 +122,7 @@ int main(int argc, char * argv[]) ProgramParameters::mcdName = vm["mcd"].as<std::string>(); ProgramParameters::debug = vm.count("debug") == 0 ? false : true; ProgramParameters::errorAnalysis = vm.count("errorAnalysis") == 0 ? false : true; + ProgramParameters::nbErrorsToShow = vm["nbErrorsToShow"].as<int>(); ProgramParameters::meanEntropy = vm.count("meanEntropy") == 0 ? false : true; ProgramParameters::onlyPrefixes = vm.count("onlyPrefixes") == 0 ? false : true; ProgramParameters::dicts = vm["dicts"].as<std::string>(); diff --git a/error_correction/src/Error.cpp b/error_correction/src/Error.cpp index 141e0e11b848e6af4623087065704b77121dd260..ca50de4f150543174a8535fc6c5653cfd6f02c53 100644 --- a/error_correction/src/Error.cpp +++ b/error_correction/src/Error.cpp @@ -89,8 +89,8 @@ void Errors::printStats() { unsigned int minDistanceToCheck = 1; unsigned int maxDistanceToCheck = 5; - int window = 10; - int nbErrorsToKeep = 10; + int window = 20; + int nbErrorsToKeep = ProgramParameters::nbErrorsToShow; std::map<std::string, int> nbErrorOccurencesByType; std::map<std::string, int> nbFirstErrorOccurencesByType; std::map<std::string, float> nbFirstErrorIntroduced; diff --git a/maca_common/include/ProgramParameters.hpp b/maca_common/include/ProgramParameters.hpp index ce26f3a79aa2b3446b2716d178f07ad1efa0d507..fe1efb06c1638be860ec40ee1304c01e6d38667c 100644 --- a/maca_common/include/ProgramParameters.hpp +++ b/maca_common/include/ProgramParameters.hpp @@ -59,6 +59,7 @@ struct ProgramParameters static bool meanEntropy; static bool onlyPrefixes; static std::map<std::string,std::string> featureModelByClassifier; + static int nbErrorsToShow; private : diff --git a/maca_common/src/ProgramParameters.cpp b/maca_common/src/ProgramParameters.cpp index c5fe5eaa9592cc2c78a9777dbfdab53c2af3e2e8..64d01ac8f768c9a1643bd656613a0175f9e9fe22 100644 --- a/maca_common/src/ProgramParameters.cpp +++ b/maca_common/src/ProgramParameters.cpp @@ -53,3 +53,4 @@ std::string ProgramParameters::classifierName; int ProgramParameters::batchSize; std::string ProgramParameters::loss; std::map<std::string,std::string> ProgramParameters::featureModelByClassifier; +int ProgramParameters::nbErrorsToShow;