Skip to content

Commit

Permalink
Change default tolerance to -1, meaning no tolerance-based stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhers committed Aug 9, 2015
1 parent 1c557b0 commit 00aefb3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions parser/lstm-parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) {
("lstm_input_dim", po::value<unsigned>()->default_value(60), "LSTM input dimension")
("train,t", "Should training be run?")
("maxit,M", po::value<unsigned>()->default_value(8000), "Maximum number of training iterations")
("tolerance", po::value<double>()->default_value(0.0), "Tolerance on dev uas for stopping training")
("tolerance", po::value<double>()->default_value(-1.0), "Tolerance on dev uas for stopping training")
("words,w", po::value<string>(), "Pretrained word embeddings")
("help,h", "Help");
po::options_description dcmdline_options;
Expand Down Expand Up @@ -546,7 +546,9 @@ int main(int argc, char** argv) {
const unsigned maxit = conf["maxit"].as<unsigned>();
cerr << "Maximum number of iterations: " << maxit << "\n";
const double tolerance = conf["tolerance"].as<double>();
cerr << "Optimization tolerance: " << tolerance << "\n";
if (tolerance > 0.0) {
cerr << "Optimization tolerance: " << tolerance << "\n";
}
ostringstream os;
os << "parser_" << (USE_POS ? "pos" : "nopos")
<< '_' << LAYERS
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 00aefb3

Please sign in to comment.