Ignore:
Timestamp:
04/22/16 13:47:35 (5 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/StudentTProcessModel.cs

    r13721 r13784  
    252252        for (int i = 0; i < n; i++) {
    253253          for (int j = 0; j < i; j++) {
    254             var g = cov.CovarianceGradient(x, i, j).ToArray();
     254            var g = cov.CovarianceGradient(x, i, j);
    255255            for (int k = 0; k < covGradients.Length; k++) {
    256256              covGradients[k] += lCopy[i, j] * g[k];
     
    258258          }
    259259
    260           var gDiag = cov.CovarianceGradient(x, i, i).ToArray();
     260          var gDiag = cov.CovarianceGradient(x, i, i);
    261261          for (int k = 0; k < covGradients.Length; k++) {
    262262            // diag
Note: See TracChangeset for help on using the changeset viewer.