Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@hunch.net>2015-01-02 23:23:49 +0300
committerJohn Langford <jl@hunch.net>2015-01-02 23:23:49 +0300
commit7e2cb1a93fc3b232a8a4702990162756214eeed7 (patch)
tree1141c3af0bb9a2cfbc65256f6b91a30174f408b0
parentf1e951b711eefd8c28d32a81f8a34ffebeef38f8 (diff)
more pointer/ref fixes
-rw-r--r--vowpalwabbit/main.cc82
1 files changed, 39 insertions, 43 deletions
diff --git a/vowpalwabbit/main.cc b/vowpalwabbit/main.cc
index c7f40326..95e9d2f9 100644
--- a/vowpalwabbit/main.cc
+++ b/vowpalwabbit/main.cc
@@ -21,11 +21,11 @@ using namespace std;
int main(int argc, char *argv[])
{
try {
- vw *all = parse_args(argc, argv);
+ vw& all = parse_args(argc, argv);
struct timeb t_start, t_end;
ftime(&t_start);
- if (!all->quiet && !all->bfgs && !all->searchstr)
+ if (!all.quiet && !all.bfgs && !all.searchstr)
{
const char * header_fmt = "%-10s %-10s %10s %11s %8s %8s %8s\n";
fprintf(stderr, header_fmt,
@@ -36,67 +36,63 @@ int main(int argc, char *argv[])
cerr.precision(5);
}
- VW::start_parser(*all);
- LEARNER::generic_driver(*all);
- VW::end_parser(*all);
+ VW::start_parser(all);
+ LEARNER::generic_driver(all);
+ VW::end_parser(all);
ftime(&t_end);
double net_time = (int) (1000.0 * (t_end.time - t_start.time) + (t_end.millitm - t_start.millitm));
- if(!all->quiet && all->span_server != "")
+ if(!all.quiet && all.span_server != "")
cerr<<"Net time taken by process = "<<net_time/(double)(1000)<<" seconds\n";
- if(all->span_server != "") {
- float loss = (float)all->sd->sum_loss;
- all->sd->sum_loss = (double)accumulate_scalar(*all, all->span_server, loss);
- float weighted_examples = (float)all->sd->weighted_examples;
- all->sd->weighted_examples = (double)accumulate_scalar(*all, all->span_server, weighted_examples);
- float weighted_labels = (float)all->sd->weighted_labels;
- all->sd->weighted_labels = (double)accumulate_scalar(*all, all->span_server, weighted_labels);
- float weighted_unlabeled_examples = (float)all->sd->weighted_unlabeled_examples;
- all->sd->weighted_unlabeled_examples = (double)accumulate_scalar(*all, all->span_server, weighted_unlabeled_examples);
- float example_number = (float)all->sd->example_number;
- all->sd->example_number = (uint64_t)accumulate_scalar(*all, all->span_server, example_number);
- float total_features = (float)all->sd->total_features;
- all->sd->total_features = (uint64_t)accumulate_scalar(*all, all->span_server, total_features);
+ if(all.span_server != "") {
+ float loss = (float)all.sd->sum_loss;
+ all.sd->sum_loss = (double)accumulate_scalar(all, all.span_server, loss);
+ float weighted_examples = (float)all.sd->weighted_examples;
+ all.sd->weighted_examples = (double)accumulate_scalar(all, all.span_server, weighted_examples);
+ float weighted_labels = (float)all.sd->weighted_labels;
+ all.sd->weighted_labels = (double)accumulate_scalar(all, all.span_server, weighted_labels);
+ float weighted_unlabeled_examples = (float)all.sd->weighted_unlabeled_examples;
+ all.sd->weighted_unlabeled_examples = (double)accumulate_scalar(all, all.span_server, weighted_unlabeled_examples);
+ float example_number = (float)all.sd->example_number;
+ all.sd->example_number = (uint64_t)accumulate_scalar(all, all.span_server, example_number);
+ float total_features = (float)all.sd->total_features;
+ all.sd->total_features = (uint64_t)accumulate_scalar(all, all.span_server, total_features);
}
- if (!all->quiet)
+ if (!all.quiet)
{
cerr.precision(6);
cerr << endl << "finished run";
- if(all->current_pass == 0)
- cerr << endl << "number of examples = " << all->sd->example_number;
+ if(all.current_pass == 0)
+ cerr << endl << "number of examples = " << all.sd->example_number;
else{
- cerr << endl << "number of examples per pass = " << all->sd->example_number / all->current_pass;
- cerr << endl << "passes used = " << all->current_pass;
- }
- cerr << endl << "weighted example sum = " << all->sd->weighted_examples;
- cerr << endl << "weighted label sum = " << all->sd->weighted_labels;
- if(all->holdout_set_off || (all->sd->holdout_best_loss == FLT_MAX))
- {
- cerr << endl << "average loss = " << all->sd->sum_loss / all->sd->weighted_examples;
- }
- else
- {
- cerr << endl << "average loss = " << all->sd->holdout_best_loss << " h";
+ cerr << endl << "number of examples per pass = " << all.sd->example_number / all.current_pass;
+ cerr << endl << "passes used = " << all.current_pass;
}
+ cerr << endl << "weighted example sum = " << all.sd->weighted_examples;
+ cerr << endl << "weighted label sum = " << all.sd->weighted_labels;
+ if(all.holdout_set_off || (all.sd->holdout_best_loss == FLT_MAX))
+ cerr << endl << "average loss = " << all.sd->sum_loss / all.sd->weighted_examples;
+ else
+ cerr << endl << "average loss = " << all.sd->holdout_best_loss << " h";
float best_constant; float best_constant_loss;
- if (get_best_constant(*all, best_constant, best_constant_loss))
- {
+ if (get_best_constant(all, best_constant, best_constant_loss))
+ {
cerr << endl << "best constant = " << best_constant;
if (best_constant_loss != FLT_MIN)
- cerr << endl << "best constant's loss = " << best_constant_loss;
- }
-
- cerr << endl << "total feature number = " << all->sd->total_features;
- if (all->sd->queries > 0)
- cerr << endl << "total queries = " << all->sd->queries << endl;
+ cerr << endl << "best constant's loss = " << best_constant_loss;
+ }
+
+ cerr << endl << "total feature number = " << all.sd->total_features;
+ if (all.sd->queries > 0)
+ cerr << endl << "total queries = " << all.sd->queries << endl;
cerr << endl;
}
- VW::finish(*all);
+ VW::finish(all);
} catch (exception& e) {
// vw is implemented as a library, so we use 'throw exception()'
// error 'handling' everywhere. To reduce stderr pollution