diff options
author | John Langford <jl@hunch.net> | 2009-08-22 20:53:12 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2009-08-22 20:53:12 +0400 |
commit | b0eec08d9409aa62572067802366251b34b31ae4 (patch) | |
tree | 0eeebdfc631c09a34cbda37dbbe1b6f65b3ca9a3 /main.cc | |
parent | 007322109ff31f4d23a4327e53a4e9095d60c559 (diff) | |
parent | 443d882e32d15c24d3833f9c3da24c5318ec88a1 (diff) |
Merge branch 'master' into cluster
Conflicts:
main.cc
parse_example.cc
vw.cc
Diffstat (limited to 'main.cc')
-rw-r--r-- | main.cc | 47 |
1 files changed, 24 insertions, 23 deletions
@@ -7,28 +7,29 @@ embodied in the content of this file are licensed under the BSD #include "vw.h" #include "gd.h" +int main(int argc, char *argv[]) { + gd_vars *vars = vw(argc, argv); -int main(int argc, char *argv[]) -{ - gd_vars *vars = vw(argc, argv); - - float best_constant = vars->weighted_labels / vars->weighted_examples; - float constant_loss = (best_constant*(1.0 - best_constant)*(1.0 - best_constant) - + (1.0 - best_constant)*best_constant*best_constant); - - if (!vars->quiet) - { - cerr.precision(4); - cerr << endl << "finished run"; - cerr << endl << "number of examples = " << vars->example_number; - cerr << endl << "weighted example sum = " << vars->weighted_examples; - cerr << endl << "weighted label sum = " << vars->weighted_labels; - cerr << endl << "average loss = " << vars->sum_loss / vars->weighted_examples; - cerr << endl << "best constant's loss = " << constant_loss; - cerr << endl << "total feature number = " << vars->total_features; - cerr << endl; - } - delete vars; - - return 0; + float best_constant = vars->weighted_labels / vars->weighted_examples; + float constant_loss = (best_constant*(1.0 - best_constant)*(1.0 - best_constant) + + (1.0 - best_constant)*best_constant*best_constant); + + if (!vars->quiet) + { + cerr.precision(4); + cerr << endl << "finished run"; + cerr << endl << "number of examples = " << vars->example_number; + cerr << endl << "weighted example sum = " << vars->weighted_examples; + cerr << endl << "weighted label sum = " << vars->weighted_labels; + cerr << endl << "average loss = " << vars->sum_loss / vars->weighted_examples; + cerr << endl << "best constant = " << best_constant; + if (vars->min_prediction == 0. && vars->max_prediction == 1. && best_constant < 1. && best_constant > 0.) + cerr << endl << "best constant's loss = " << constant_loss; + cerr << endl << "total feature number = " << vars->total_features; + cerr << endl; + } + + free(vars); + + return 0; } |