From: Steinar H. Gunderson Date: Sat, 17 Mar 2012 01:30:45 +0000 (+0100) Subject: Take weight into account in Hessian. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=156fbeb49e9aacf1b1d440b4ee352cd9bca457fc;p=wloh Take weight into account in Hessian. --- diff --git a/bayeswf.cpp b/bayeswf.cpp index 56214b5..b7abb59 100644 --- a/bayeswf.cpp +++ b/bayeswf.cpp @@ -163,8 +163,8 @@ void renormalize(float *mu, float *sigma, int num_players) /* * Compute Hessian matrix of the negative log-likelihood, ie. for each term in logL: * - * M_ij = D_i D_j (- logL) = -1 / sigma² for i != j - * 1 / sigma² for i == j + * M_ij = D_i D_j (- logL) = -w / sigma² for i != j + * w / sigma² for i == j * * Note that this does not depend on mu or the margin at all. */ @@ -182,8 +182,10 @@ void construct_hessian(const float *mu, const float *sigma, int num_players) double sigma2 = sigma[j]; double sigma_sq = sigma1 * sigma1 + sigma2 * sigma2; - hessian[i][j] -= 1.0f / sigma_sq; - hessian[i][i] += 1.0f / sigma_sq; + float w = matches_for_player[i][k].weight; + + hessian[i][j] -= w / sigma_sq; + hessian[i][i] += w / sigma_sq; } }