Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/22/16 13:47:35 (8 years ago)
Author:
pfleck
Message:

#2591 Made the creation of a GaussianProcessModel faster by avoiding additional iterators during calculation of the hyperparameter gradients.
The gradients of the hyperparameters are now calculated in one sweep and returned as IList, instead of returning an iterator (with yield return).
This avoids a large amount of Move-calls of the iterator, especially for covariance functions with a lot of hyperparameters.
Besides, the signature of the CovarianceGradientFunctionDelegate is changed, to return an IList instead of an IEnumerable to avoid unnececary ToList or ToArray calls.

File:
1 edited

Legend:

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

    r13721 r13784  
    2121
    2222using System;
    23 using System.Linq;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
     
    9291      cov.CrossCovariance = (x, xt, i, j) => Util.SqrDist(x, i, xt, j, columnIndices, 1.0) < 1e-9 ? scale : 0.0;
    9392      if (fixedScale)
    94         cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();
     93        cov.CovarianceGradient = (x, i, j) => new double[0];
    9594      else
    96         cov.CovarianceGradient = (x, i, j) => Enumerable.Repeat(i == j ? 2.0 * scale : 0.0, 1);
     95        cov.CovarianceGradient = (x, i, j) => new double[1] { i == j ? 2.0 * scale : 0.0 };
    9796      return cov;
    9897    }
Note: See TracChangeset for help on using the changeset viewer.