Skip to content
Snippets Groups Projects
Commit 28d34359 authored by Franck Dary's avatar Franck Dary
Browse files

Added a way to have step by step output

parent 289b9717
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ po::options_description getOptionsDescription()
opt.add_options()
("help,h", "Produce this help message")
("debug,d", "Print infos on stderr")
("delayedOutput", "Print the output only at the end")
("showActions", "Print actions predicted by each classifier")
("dicts", po::value<std::string>()->default_value(""),
"The .dict file describing all the dictionaries to be used in the experiement. By default the filename specified in the .tm file will be used")
......@@ -140,6 +141,7 @@ int main(int argc, char * argv[])
ProgramParameters::input = vm["input"].as<std::string>();
ProgramParameters::mcdName = vm["mcd"].as<std::string>();
ProgramParameters::debug = vm.count("debug") == 0 ? false : true;
ProgramParameters::delayedOutput = vm.count("delayedOutput") == 0 ? false : true;
ProgramParameters::showActions = vm.count("showActions") == 0 ? false : true;
ProgramParameters::interactive = vm["interactive"].as<bool>();
ProgramParameters::errorAnalysis = vm.count("errorAnalysis") == 0 ? false : true;
......
......@@ -78,6 +78,7 @@ struct ProgramParameters
static bool alwaysSave;
static bool noNeuralNetwork;
static bool showActions;
static bool delayedOutput;
private :
......
......@@ -6,6 +6,8 @@ ProgramOutput ProgramOutput::instance;
void ProgramOutput::print(FILE * output)
{
if (!ProgramParameters::delayedOutput)
return;
for (auto & line : matrix)
for (unsigned int i = 0; i < line.size(); i++)
fprintf(output, "%s%s%s", ProgramParameters::printOutputEntropy ? ("<"+float2str(line[i].second,"%f")+">").c_str() : "", line[i].first.c_str(), i == line.size()-1 ? "\n" : "\t");
......@@ -13,6 +15,14 @@ void ProgramOutput::print(FILE * output)
void ProgramOutput::addLine(const std::vector< std::pair<std::string, float> > & line, unsigned int index)
{
if (!ProgramParameters::delayedOutput)
{
for (unsigned int i = 0; i < line.size(); i++)
fprintf(stdout, "%s%s", line[i].first.c_str(), i == line.size()-1 ? "\n" : "\t");
return;
}
while (matrix.size() < index+1)
matrix.emplace_back();
......
......@@ -72,3 +72,5 @@ float ProgramParameters::randomDebugProbability;
bool ProgramParameters::alwaysSave;
bool ProgramParameters::noNeuralNetwork;
bool ProgramParameters::showActions;
bool ProgramParameters::delayedOutput;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment