Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9357


Ignore:
Timestamp:
04/15/13 10:43:42 (11 years ago)
Author:
gkronber
Message:

#1902 minor code improvements: removed commented code, always supply non-null columnIndizes.

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

Legend:

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

    r8982 r9357  
    9090
    9191    private static IEnumerable<double> GetGradient(double[,] x, int i, int j, double[] inverseLength, IEnumerable<int> columnIndices) {
    92       if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
    93 
    9492      int k = 0;
    9593      foreach (int columnIndex in columnIndices) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceMask.cs

    r8982 r9357  
    7474
    7575    public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int> columnIndices) {
    76       if (columnIndices != null)
    77         throw new InvalidOperationException("Stacking of masking covariance functions is not supported.");
    7876      var cov = CovarianceFunctionParameter.Value;
    7977      var selectedDimensions = SelectedDimensionsParameter.Value;
    8078
    81       return cov.GetParameterizedCovarianceFunction(p, selectedDimensions);
     79      return cov.GetParameterizedCovarianceFunction(p, selectedDimensions.Intersect(columnIndices));
    8280    }
    8381  }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovariancePeriodic.cs

    r9211 r9357  
    141141      yield return 2.0 * k * scale * Math.Exp(-2 * r * r) *Math.Sin(2*k) * inverseLength * inverseLength;
    142142      yield return 2.0 * scale * Math.Exp(-2 * gradient);
    143       /*
    144        *  double s = Math.Log(scale) / 2.0;
    145       double l = Math.Log(1.0 / inverseLength);
    146       double p = Math.Log(period);
    147143
    148       double v;
    149       {
    150         v = i == j ? 0.0 : Math.PI * GetDistance(x, x, i, j, columnIndices) * Math.Exp(-p);
    151         double sin = Math.Sin(v);
    152         double sin2 = sin * sin;
    153         yield return 4.0 * sin2 * Math.Exp(-2.0 * Math.Exp(-2 * l) * sin2 - 2 * l + 2 * s);
    154       }
    155       {
    156         double pi_d = i == j ? 0.0 : Math.PI * GetDistance(x, x, i, j, columnIndices);
    157         double sin = Math.Sin(Math.Exp(-p)*pi_d);
    158         double sin2 = Math.Sin(2*Math.Exp(-p)*pi_d);
    159         yield return 2*pi_d*sin2*Math.Exp(-2*Math.Exp(-2*l)*sin*sin - 2*l - p + 2*s);
    160       }
    161       {
    162         double pi_d = i == j ? 0.0 : Math.PI * GetDistance(x, x, i, j, columnIndices);
    163         double sin = Math.Sin(Math.Exp(-p) * pi_d);
    164         yield return 2 * Math.Exp(2 * scale - 2 * Math.Exp(-2 * l) * sin * sin);
    165       }*/
    166144    }
    167145
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs

    r9108 r9357  
    133133
    134134    private static IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices, double scale, double shape, double[] inverseLength) {
    135       if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
    136135      double d = i == j
    137136                   ? 0.0
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs

    r9108 r9357  
    115115    // order of returned gradients must match the order in GetParameterValues!
    116116    private static IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices, double scale, double[] inverseLength) {
    117       if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1));
    118117      double d = i == j
    119118                   ? 0.0
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r9104 r9357  
    155155        .ToArray();
    156156
    157       var cov = covarianceFunction.GetParameterizedCovarianceFunction(covarianceParameter, null);
     157      var cov = covarianceFunction.GetParameterizedCovarianceFunction(covarianceParameter, Enumerable.Range(0, x.GetLength(1)));
    158158      for (int i = 0; i < n; i++) {
    159159        for (int j = i; j < n; j++) {
     
    284284      var kss = new double[newN];
    285285      double[,] sWKs = new double[n, newN];
    286       var cov = covarianceFunction.GetParameterizedCovarianceFunction(covarianceParameter, null);
     286      var cov = covarianceFunction.GetParameterizedCovarianceFunction(covarianceParameter, Enumerable.Range(0, x.GetLength(1)));
    287287
    288288      // for stddev
Note: See TracChangeset for help on using the changeset viewer.