Changeset 10530 for stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceNoise.cs
- Timestamp:
- 03/04/14 11:30:58 (11 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10489-10491,10493
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis merged: 10489-10491,10493
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceNoise.cs
r9594 r10530 37 37 get { return (IValueParameter<DoubleValue>)Parameters["Scale"]; } 38 38 } 39 private bool HasFixedScaleParameter { 40 get { return ScaleParameter.Value != null; } 41 } 39 42 40 43 [StorableConstructor] … … 60 63 61 64 public int GetNumberOfParameters(int numberOfVariables) { 62 return ScaleParameter.Value != null? 0 : 1;65 return HasFixedScaleParameter ? 0 : 1; 63 66 } 64 67 … … 72 75 int c = 0; 73 76 // gather parameter values 74 if ( ScaleParameter.Value != null) {77 if (HasFixedScaleParameter) { 75 78 scale = ScaleParameter.Value.Value; 76 79 } else { … … 84 87 double scale; 85 88 GetParameterValues(p, out scale); 89 var fixedScale = HasFixedScaleParameter; 86 90 // create functions 87 91 var cov = new ParameterizedCovarianceFunction(); 88 92 cov.Covariance = (x, i, j) => i == j ? scale : 0.0; 89 93 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); 91 98 return cov; 92 99 }
Note: See TracChangeset
for help on using the changeset viewer.