diff options
author | ariel faigon <github.2009@yendor.com> | 2014-01-04 04:58:55 +0400 |
---|---|---|
committer | ariel faigon <github.2009@yendor.com> | 2014-01-04 04:58:55 +0400 |
commit | 5fe418a71aa273a0de8bdc8258d011256b66b095 (patch) | |
tree | aaf8b5a3101f16663cd26b2a9d97f3147a443ebf /vowpalwabbit/parse_args.cc | |
parent | db2bd6dc5ce4974c6cbb32ba07bd3fc519f0d4b6 (diff) |
--quiet wins over --progress. Default --progress is "2.0"
Diffstat (limited to 'vowpalwabbit/parse_args.cc')
-rw-r--r-- | vowpalwabbit/parse_args.cc | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/vowpalwabbit/parse_args.cc b/vowpalwabbit/parse_args.cc index 08542342..96b21558 100644 --- a/vowpalwabbit/parse_args.cc +++ b/vowpalwabbit/parse_args.cc @@ -134,7 +134,7 @@ vw* parse_args(int argc, char *argv[]) ("raw_predictions,r", po::value< string >(), "File to output unnormalized predictions to") ("sendto", po::value< vector<string> >(), "send examples to <host>") ("quiet", "Don't output disgnostics and progress updates") - ("progress,P", po::value< string >(), "Progress update frequency. int: additive, float: multiplicative") + ("progress,P", po::value< string >()->default_value("2.0"), "Progress update frequency. int: additive, float: multiplicative") ("binary", "report loss as binary classification on -1,1") ("min_prediction", po::value<float>(&(all->sd->min_label)), "Smallest prediction to output") ("max_prediction", po::value<float>(&(all->sd->max_label)), "Largest prediction to output") @@ -328,42 +328,41 @@ vw* parse_args(int argc, char *argv[]) exit(0); } - if (vm.count("progress")) { - if (vm.count("quiet")) { - cerr << "warning: both --progress and --quiet requested:" - << " --progress wins\n"; - } - all->progress_arg = ::atof(vm["progress"].as<string>().c_str()); - string progress_str = vm["progress"].as<string>(); - if (progress_str.find_first_of(".") == string::npos) { - // No dot in arg: assume integer -> additive + if (vm.count("quiet")) { + all->quiet = true; + // --quiet wins over --progress + } else { + all->quiet = false; + + if (vm.count("progress")) { + all->progress_arg = ::atof(vm["progress"].as<string>().c_str()); + string progress_str = vm["progress"].as<string>(); + + // --progress interval is dual: either integer or floating-point + if (progress_str.find_first_of(".") == string::npos) { + // No "." in arg: assume integer -> additive all->progress_add = true; - // all->progress_arg = vm["progress"].as<float>(); if (all->progress_arg < 1) { - cerr << "warning: additive --progress <int>" - << " can't be < 1: forcing to 1\n"; - all->progress_arg = 1; + cerr << "warning: additive --progress <int>" + << " can't be < 1: forcing to 1\n"; + all->progress_arg = 1; } - } else { - // There's a dot in arg: assume floating-point -> multiplicative + } else { + // A "." in arg: assume floating-point -> multiplicative all->progress_add = false; // all->progress_arg = vm["progress"].as<float>(); if (all->progress_arg <= 1.0) { - cerr << "warning: multiplicative --progress <float>: " - << vm["progress"].as<string>() - << " is <= 1.0: adding 1.0\n"; - all->progress_arg += 1.0; + cerr << "warning: multiplicative --progress <float>: " + << vm["progress"].as<string>() + << " is <= 1.0: adding 1.0\n"; + all->progress_arg += 1.0; } else if (all->progress_arg > 9.0) { - cerr << "warning: multiplicative --progress <float>" - << " is > 9.0: you probably meant to use an integer\n"; + cerr << "warning: multiplicative --progress <float>" + << " is > 9.0: you probably meant to use an integer\n"; } + } } - } else { - if (vm.count("quiet")) - all->quiet = true; - else - all->quiet = false; } msrand48(random_seed); |