Skip to content

Commit 1ae7d33

Browse files
committed
Change default tolerance to -1, meaning no tolerance-based stopping
1 parent c9c9423 commit 1ae7d33

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
@@ -77,7 +77,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* conf) {
7777
("lstm_input_dim", po::value<unsigned>()->default_value(60), "LSTM input dimension")
7878
("train,t", "Should training be run?")
7979
("maxit,M", po::value<unsigned>()->default_value(8000), "Maximum number of training iterations")
80-
("tolerance", po::value<double>()->default_value(0.0), "Tolerance on dev uas for stopping training")
80+
("tolerance", po::value<double>()->default_value(-1.0), "Tolerance on dev uas for stopping training")
8181
("words,w", po::value<string>(), "Pretrained word embeddings")
8282
("use_spelling,S", "Use spelling model") //Miguel. Spelling model
8383
("help,h", "Help");
@@ -967,7 +967,9 @@ int main(int argc, char** argv) {
967967
const unsigned maxit = conf["maxit"].as<unsigned>();
968968
cerr << "Maximum number of iterations: " << maxit << "\n";
969969
const double tolerance = conf["tolerance"].as<double>();
970-
cerr << "Optimization tolerance: " << tolerance << "\n";
970+
if (tolerance > 0.0) {
971+
cerr << "Optimization tolerance: " << tolerance << "\n";
972+
}
971973
ostringstream os;
972974
os << "parser_" << (USE_POS ? "pos" : "nopos")
973975
<< '_' << LAYERS
@@ -1060,7 +1062,7 @@ int main(int argc, char** argv) {
10601062
double uas = -1;
10611063
double prev_uas = -1;
10621064
while(!requested_stop && iter < maxit &&
1063-
(uas < 0 || prev_uas < 0 || abs(prev_uas - uas) > tolerance)) {
1065+
(tolerance < 0 || uas < 0 || prev_uas < 0 || abs(prev_uas - uas) > tolerance)) {
10641066
for (unsigned sii = 0; sii < status_every_i_iterations; ++sii) {
10651067
if (si == corpus.nsentences) {
10661068
si = 0;

0 commit comments

Comments
 (0)