Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/20/12 13:24:25 (12 years ago)
Author:
gkronber
Message:

#1902 fixed handling of columnIndices and inverseLength in ARD covariance functions.

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions
Files:
3 edited

Legend:

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

    r8929 r8932  
    9999      if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
    100100
    101       foreach (int k in columnIndices) {
    102         yield return -2.0 * x[i, k] * x[j, k] * inverseLength[k] * inverseLength[k];
     101      foreach (int columnIndex in columnIndices) {
     102        yield return -2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[columnIndex] * inverseLength[columnIndex];
    103103      }
    104104    }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs

    r8929 r8932  
    143143
    144144    public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) {
     145      if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
    145146      double d = i == j
    146147                   ? 0.0
    147148                   : Util.SqrDist(x, i, j, inverseLength, columnIndices);
    148149      double b = 1 + 0.5 * d / shape;
    149       for (int k = 0; k < inverseLength.Length; k++) {
    150         yield return sf2 * Math.Pow(b, -shape - 1) * Util.SqrDist(x[i, k] * inverseLength[k], x[j, k] * inverseLength[k]);
     150      foreach (var columnIndex in columnIndices) {
     151        yield return sf2 * Math.Pow(b, -shape - 1) * Util.SqrDist(x[i, columnIndex] * inverseLength[columnIndex], x[j, columnIndex] * inverseLength[columnIndex]);
    151152      }
    152153      yield return 2 * sf2 * Math.Pow(b, -shape);
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs

    r8929 r8932  
    118118
    119119    public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) {
     120      if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
    120121      double d = i == j
    121122                   ? 0.0
    122123                   : Util.SqrDist(x, i, j, inverseLength, columnIndices);
    123124
    124       for (int ii = 0; ii < inverseLength.Length; ii++) {
    125         double sqrDist = Util.SqrDist(x[i, ii] * inverseLength[ii], x[j, ii] * inverseLength[ii]);
     125      foreach (var columnIndex in columnIndices) {
     126        double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[columnIndex], x[j, columnIndex] * inverseLength[columnIndex]);
    126127        yield return sf2 * Math.Exp(-d / 2.0) * sqrDist;
    127128      }
     129
    128130      yield return 2.0 * sf2 * Math.Exp(-d / 2.0);
    129131    }
Note: See TracChangeset for help on using the changeset viewer.