diff options
author | John Langford <jl@jl-desktop.(none)> | 2010-12-03 19:19:09 +0300 |
---|---|---|
committer | John Langford <jl@jl-desktop.(none)> | 2010-12-03 19:19:09 +0300 |
commit | c13ae76b0e85fa4987b31862ba47a1f17f17ae03 (patch) | |
tree | 9941fb3af44da8f4c99fe4667a675014cd23688a /main.cc | |
parent | 5d424bddd267c28e5bb15ece8781214080d0d182 (diff) |
synced lda
Diffstat (limited to 'main.cc')
-rw-r--r-- | main.cc | 57 |
1 files changed, 29 insertions, 28 deletions
@@ -9,32 +9,33 @@ embodied in the content of this file are licensed under the BSD #include <stdlib.h> int main(int argc, char *argv[]) { - drand48(); - gd_vars *vars = vw(argc, argv); - - float weighted_labeled_examples = global.weighted_examples - global.weighted_unlabeled_examples; - float best_constant = (global.weighted_labels - global.initial_t) / weighted_labeled_examples; - float constant_loss = (best_constant*(1.0 - best_constant)*(1.0 - best_constant) - + (1.0 - best_constant)*best_constant*best_constant); - - if (!global.quiet) - { - cerr.precision(4); - cerr << endl << "finished run"; - cerr << endl << "number of examples = " << global.example_number; - cerr << endl << "weighted example sum = " << global.weighted_examples; - cerr << endl << "weighted label sum = " << global.weighted_labels; - cerr << endl << "average loss = " << global.sum_loss / global.weighted_examples; - cerr << endl << "best constant = " << best_constant; - if (global.min_label == 0. && global.max_label == 1. && best_constant < 1. && best_constant > 0.) - cerr << endl << "best constant's loss = " << constant_loss; - cerr << endl << "total feature number = " << global.total_features; - if (global.active_simulation) - cerr << endl << "total queries = " << global.queries << endl; - cerr << endl; - } - - free(vars); - - return 0; + srand48(100001); + drand48(); + gd_vars *vars = vw(argc, argv); + + float weighted_labeled_examples = global.weighted_examples - global.weighted_unlabeled_examples; + float best_constant = (global.weighted_labels - global.initial_t) / weighted_labeled_examples; + float constant_loss = (best_constant*(1.0 - best_constant)*(1.0 - best_constant) + + (1.0 - best_constant)*best_constant*best_constant); + + if (!global.quiet) + { + cerr.precision(4); + cerr << endl << "finished run"; + cerr << endl << "number of examples = " << global.example_number; + cerr << endl << "weighted example sum = " << global.weighted_examples; + cerr << endl << "weighted label sum = " << global.weighted_labels; + cerr << endl << "average loss = " << global.sum_loss / global.weighted_examples; + cerr << endl << "best constant = " << best_constant; + if (global.min_label == 0. && global.max_label == 1. && best_constant < 1. && best_constant > 0.) + cerr << endl << "best constant's loss = " << constant_loss; + cerr << endl << "total feature number = " << global.total_features; + if (global.active_simulation) + cerr << endl << "total queries = " << global.queries << endl; + cerr << endl; + } + + free(vars); + + return 0; } |