Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/04/14 11:30:58 (11 years ago)
Author:
gkronber
Message:

#2125: merged r10489:10491 and r10493 from trunk into stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceNoise.cs

    r9594 r10530  
    3737      get { return (IValueParameter<DoubleValue>)Parameters["Scale"]; }
    3838    }
     39    private bool HasFixedScaleParameter {
     40      get { return ScaleParameter.Value != null; }
     41    }
    3942
    4043    [StorableConstructor]
     
    6063
    6164    public int GetNumberOfParameters(int numberOfVariables) {
    62       return ScaleParameter.Value != null ? 0 : 1;
     65      return HasFixedScaleParameter ? 0 : 1;
    6366    }
    6467
     
    7275      int c = 0;
    7376      // gather parameter values
    74       if (ScaleParameter.Value != null) {
     77      if (HasFixedScaleParameter) {
    7578        scale = ScaleParameter.Value.Value;
    7679      } else {
     
    8487      double scale;
    8588      GetParameterValues(p, out scale);
     89      var fixedScale = HasFixedScaleParameter;
    8690      // create functions
    8791      var cov = new ParameterizedCovarianceFunction();
    8892      cov.Covariance = (x, i, j) => i == j ? scale : 0.0;
    8993      cov.CrossCovariance = (x, xt, i, j) => Util.SqrDist(x, i, xt, j, 1.0, columnIndices) < 1e-9 ? scale : 0.0;
    90       cov.CovarianceGradient = (x, i, j) => Enumerable.Repeat(i == j ? 2.0 * scale : 0.0, 1);
     94      if (fixedScale)
     95        cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();
     96      else
     97        cov.CovarianceGradient = (x, i, j) => Enumerable.Repeat(i == j ? 2.0 * scale : 0.0, 1);
    9198      return cov;
    9299    }
Note: See TracChangeset for help on using the changeset viewer.