diff options
author | ariel faigon <github.2009@yendor.com> | 2014-01-04 03:53:09 +0400 |
---|---|---|
committer | ariel faigon <github.2009@yendor.com> | 2014-01-04 03:53:09 +0400 |
commit | d90f649b627e89fd8c092ae96eba9e53c7194479 (patch) | |
tree | 4fd98e694bf67eb1411f63e93687223031b3dada /vowpalwabbit/parse_args.cc | |
parent | f5648703929713d9f251d893823f0b75105d5eac (diff) |
Add --progress <arg> support
Diffstat (limited to 'vowpalwabbit/parse_args.cc')
-rw-r--r-- | vowpalwabbit/parse_args.cc | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/vowpalwabbit/parse_args.cc b/vowpalwabbit/parse_args.cc index 99502cb8..c8079ba5 100644 --- a/vowpalwabbit/parse_args.cc +++ b/vowpalwabbit/parse_args.cc @@ -131,10 +131,10 @@ vw* parse_args(int argc, char *argv[]) out_opt.add_options() ("audit,a", "print weights of features") ("predictions,p", po::value< string >(), "File to output predictions to") - ("raw_predictions,r", po::value< string >(), - "File to output unnormalized predictions to") + ("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 diagnostics") + ("quiet", "Don't output progress updates") + ("progress,P", po::value< string >(), "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,10 +328,43 @@ vw* parse_args(int argc, char *argv[]) exit(0); } - if (vm.count("quiet")) - all->quiet = true; - else - all->quiet = false; + 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 + 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; + } + } else { + // There's a dot 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; + + } else if (all->progress_arg > 9.0) { + 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); |