Skip to content

Commit 00aefb3

Browse files
committed
Change default tolerance to -1, meaning no tolerance-based stopping
1 parent 1c557b0 commit 00aefb3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

parser/lstm-parse.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) {
7171
("lstm_input_dim", po::value<unsigned>()->default_value(60), "LSTM input dimension")
7272
("train,t", "Should training be run?")
7373
("maxit,M", po::value<unsigned>()->default_value(8000), "Maximum number of training iterations")
74-
("tolerance", po::value<double>()->default_value(0.0), "Tolerance on dev uas for stopping training")
74+
("tolerance", po::value<double>()->default_value(-1.0), "Tolerance on dev uas for stopping training")
7575
("words,w", po::value<string>(), "Pretrained word embeddings")
7676
("help,h", "Help");
7777
po::options_description dcmdline_options;
@@ -546,7 +546,9 @@ int main(int argc, char** argv) {
546546
const unsigned maxit = conf["maxit"].as<unsigned>();
547547
cerr << "Maximum number of iterations: " << maxit << "\n";
548548
const double tolerance = conf["tolerance"].as<double>();
549-
cerr << "Optimization tolerance: " << tolerance << "\n";
549+
if (tolerance > 0.0) {
550+
cerr << "Optimization tolerance: " << tolerance << "\n";
551+
}
550552
ostringstream os;
551553
os << "parser_" << (USE_POS ? "pos" : "nopos")
552554
<< '_' << LAYERS
@@ -634,7 +636,7 @@ int main(int argc, char** argv) {
634636
time_t time_start = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
635637
cerr << "TRAINING STARTED AT: " << put_time(localtime(&time_start), "%c %Z") << endl;
636638
while(!requested_stop && iter < maxit &&
637-
(uas < 0 || prev_uas < 0 || abs(prev_uas - uas) > tolerance)) {
639+
(tolerance < 0 || uas < 0 || prev_uas < 0 || abs(prev_uas - uas) > tolerance)) {
638640
for (unsigned sii = 0; sii < status_every_i_iterations; ++sii) {
639641
if (si == corpus.nsentences) {
640642
si = 0;

0 commit comments

Comments
 (0)