Changeset 13981 for stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs
- Timestamp:
- 07/02/16 14:38:40 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13438,13721,13724,13784,13891
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis merged: 13438,13721,13724,13784,13891
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs
r12009 r13981 121 121 } 122 122 123 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int>columnIndices) {123 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) { 124 124 double scale, shape; 125 125 double[] inverseLength; … … 144 144 } 145 145 146 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int>columnIndices, double scale, double shape, double[] inverseLength,146 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double shape, double[] inverseLength, 147 147 bool fixedInverseLength, bool fixedScale, bool fixedShape) { 148 148 double d = i == j … … 151 151 double b = 1 + 0.5 * d / shape; 152 152 int k = 0; 153 var g = new List<double>(columnIndices.Length + 2); 153 154 if (!fixedInverseLength) { 154 155 foreach (var columnIndex in columnIndices) { 155 yield return156 g.Add( 156 157 scale * Math.Pow(b, -shape - 1) * 157 Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]) ;158 Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k])); 158 159 k++; 159 160 } 160 161 } 161 if (!fixedScale) yield return 2 * scale * Math.Pow(b, -shape); 162 if (!fixedShape) yield return scale * Math.Pow(b, -shape) * (0.5 * d / b - shape * Math.Log(b)); 162 if (!fixedScale) g.Add(2 * scale * Math.Pow(b, -shape)); 163 if (!fixedShape) g.Add(scale * Math.Pow(b, -shape) * (0.5 * d / b - shape * Math.Log(b))); 164 return g; 163 165 } 164 166 }
Note: See TracChangeset
for help on using the changeset viewer.