]> git.sesse.net Git - wloh/commitdiff
Make the output more machine-friendly.
authorSteinar H. Gunderson <Steinar H. Gunderson sesse@debian.org>
Sat, 17 Mar 2012 12:03:32 +0000 (13:03 +0100)
committerSteinar H. Gunderson <Steinar H. Gunderson sesse@debian.org>
Sat, 17 Mar 2012 12:03:32 +0000 (13:03 +0100)
bayeswf.cpp

index 344300155ad7d68e4d964a4682b006758beba8f4..8b144da34e3a40f966f29a4cc5f57e70637e67b5 100644 (file)
@@ -49,9 +49,8 @@ void dump_scores(const vector<string> &players, const float *mu, const float *si
        printf("\n");
 #else
        for (int i = 0; i < num_players; ++i) {
-               printf("%5.1f %s\n", mu[i], players[i].c_str());
+               printf("%f %s\n", mu[i], players[i].c_str());
        }
-       printf("\n");
 #endif
 }
 
@@ -231,7 +230,7 @@ int main(int argc, char **argv)
                float weight;
 
                if (scanf("%s %s %d %d %f", pl1, pl2, &score1, &score2, &weight) != 5) {
-                       fprintf(stderr, "Read %d matches.\n", num_matches);
+                       //fprintf(stderr, "Read %d matches.\n", num_matches);
                        break;
                }
 
@@ -289,12 +288,14 @@ int main(int argc, char **argv)
                        sumdiff += (sigma[i] - old_sigma[i]) * (sigma[i] - old_sigma[i]);
                }
                if (sumdiff < EPSILON) {
-                       fprintf(stderr, "Converged after %d iterations. Stopping.\n", j);
+                       //fprintf(stderr, "Converged after %d iterations. Stopping.\n", j);
+                       printf("%d -1\n", j + 1);
                        break;
                }
        }
        dump_scores(players, mu, sigma, num_players);
-       fprintf(stderr, "Optimal sigma: %f (two-player: %f)\n", sigma[0], sigma[0] * sqrt(2.0f));
+       //fprintf(stderr, "Optimal sigma: %f (two-player: %f)\n", sigma[0], sigma[0] * sqrt(2.0f));
+       printf("%f -2\n", sigma[0]);
 
 //     construct_hessian(mu, sigma, num_players);
 }