- for (int j = 0; j < num_players; ++j) {
- printf("%f ", fim[i][j]);
- }
- printf("\n");
+// Compute uncertainty (stddev) of mu estimates, which is 1/sqrt(H_ii),
+// where H is the Hessian (see construct_hessian()).
+void compute_mu_uncertainty(const float *mu, int num_players)
+{
+ memset(mu_stddev, 0, sizeof(mu_stddev));
+
+ for (unsigned i = 0; i < all_matches.size(); ++i) {
+ const match &m = all_matches[i];
+
+ int p1 = m.player;
+ int p2 = m.other_player;
+
+ double sigma_sq = global_sigma * global_sigma;
+ float w = m.weight;
+
+ // Temporarily use mu_stddev to store the diagonal of the Hessian.
+ mu_stddev[p1] += w / sigma_sq;
+ mu_stddev[p2] += w / sigma_sq;
+ }
+ for (int i = 0; i < num_players; ++i) {
+ mu_stddev[i] = 1.0f / sqrt(mu_stddev[i]);