diff --git a/parser/lstm-parse.cc b/parser/lstm-parse.cc index b96732e..a3816ce 100644 --- a/parser/lstm-parse.cc +++ b/parser/lstm-parse.cc @@ -71,7 +71,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) { ("lstm_input_dim", po::value()->default_value(60), "LSTM input dimension") ("train,t", "Should training be run?") ("maxit,M", po::value()->default_value(8000), "Maximum number of training iterations") - ("tolerance", po::value()->default_value(0.0), "Tolerance on dev uas for stopping training") + ("tolerance", po::value()->default_value(-1.0), "Tolerance on dev uas for stopping training") ("words,w", po::value(), "Pretrained word embeddings") ("help,h", "Help"); po::options_description dcmdline_options; @@ -546,7 +546,9 @@ int main(int argc, char** argv) { const unsigned maxit = conf["maxit"].as(); cerr << "Maximum number of iterations: " << maxit << "\n"; const double tolerance = conf["tolerance"].as(); - cerr << "Optimization tolerance: " << tolerance << "\n"; + if (tolerance > 0.0) { + cerr << "Optimization tolerance: " << tolerance << "\n"; + } ostringstream os; os << "parser_" << (USE_POS ? "pos" : "nopos") << '_' << LAYERS @@ -634,7 +636,7 @@ int main(int argc, char** argv) { time_t time_start = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); cerr << "TRAINING STARTED AT: " << put_time(localtime(&time_start), "%c %Z") << endl; while(!requested_stop && iter < maxit && - (uas < 0 || prev_uas < 0 || abs(prev_uas - uas) > tolerance)) { + (tolerance < 0 || uas < 0 || prev_uas < 0 || abs(prev_uas - uas) > tolerance)) { for (unsigned sii = 0; sii < status_every_i_iterations; ++sii) { if (si == corpus.nsentences) { si = 0;