Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15165


Ignore:
Timestamp:
07/06/17 17:58:04 (7 years ago)
Author:
gkronber
Message:

#2782: fixed calculation of log pseudo-likelihood by adding the noise term to the covariance function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r15163 r15165  
    230230      for (int i = 0; i < n; i++) {
    231231        for (int j = 0; j < n; j++) ki[j] = cov.Covariance(x, i, j);
     232        ki[i] += sqrSigmaNoise;
     233
    232234        var yi = Util.ScalarProd(ki, alpha);
    233235        var yi_loo = yi - alpha[i] / (lCopy[i, i] / sqrSigmaNoise);
    234         var s2_loo = sqrSigmaNoise / lCopy[i, i];
     236        var s2_loo = 1.0 / (lCopy[i, i] / sqrSigmaNoise);
    235237        var err = ym[i] - yi_loo;
    236         var nll_loo = Math.Log(s2_loo) + err * err / s2_loo;
     238        var nll_loo = 0.5 * Math.Log(2 * Math.PI * s2_loo) + 0.5 * err * err / s2_loo;
    237239        sumLoo += nll_loo;
    238240      }
    239       sumLoo += n * Math.Log(2 * Math.PI);
    240       loocvNegLogPseudoLikelihood = 0.5 * sumLoo;
     241      loocvNegLogPseudoLikelihood = sumLoo;
    241242
    242243      for (int i = 0; i < n; i++) {
Note: See TracChangeset for help on using the changeset viewer.