Skip to content

Commit

Permalink
reverting, sign was correct (constant from kernel trick is inverse co…
Browse files Browse the repository at this point in the history
…nstant)
  • Loading branch information
athos00 committed Nov 27, 2024
1 parent a3a28e1 commit a8677f1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ApproximateTreeDataLikelihood(MaximizerWrtParameter maximizer) {
this.likelihood = maximizer.getLikelihood();
final GradientWrtParameterProvider gradient = maximizer.getGradient();
this.parameter = gradient.getParameter();
this.marginalLikelihoodConst = - (parameter.getDimension() / 2.) * Math.log(2 * Math.PI);
this.marginalLikelihoodConst = (parameter.getDimension() / 2.) * Math.log(2 * Math.PI);
// todo: get Numerical Hessian.
if (maximizer.getTransform() != null) {
this.hessianWrtParameterProvider = constructHessian();
Expand Down Expand Up @@ -138,8 +138,8 @@ private void updateMarginalLikelihood() {
for (int i = 0; i < parameter.getDimension(); i++) {
logDiagonalDeterminant += Math.log(Math.abs(diagonalHessian[i]));
}
// 2pi^{-k/2} * det(Sigma)^{-1/2} * likelihood(map) * prior(map)
this.marginalLikelihood = marginalLikelihoodConst - 0.5 * logDiagonalDeterminant + likelihood.getLogLikelihood()
// 2pi^{+k/2} * det(Sigma)^{+1/2} * likelihood(map) * prior(map)
this.marginalLikelihood = marginalLikelihoodConst + 0.5 * logDiagonalDeterminant + likelihood.getLogLikelihood()
+ (maximizer.getTransform() == null ? 0 : maximizer.getTransform().logJacobian(parameter.getParameterValues(), 0, parameter.getDimension()));
likelihoodKnown = true;
}
Expand Down

0 comments on commit a8677f1

Please sign in to comment.