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

main.cc - github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab93c3f11af8108d794fb1cc63fd8c6e2675e37f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Copyright (c) 2009 Yahoo! Inc.  All rights reserved.  The copyrights
embodied in the content of this file are licensed under the BSD
(revised) open source license
 */

#include "vw.h"
#include "gd.h"
#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;
}