Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
- Timestamp:
- 07/08/16 14:40:02 (8 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
r12012 r14029 99 99 } 100 100 101 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, IEnumerable<int>columnIndices) {101 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) { 102 102 double scale; 103 103 double[] inverseLength; … … 122 122 123 123 // order of returned gradients must match the order in GetParameterValues! 124 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int>columnIndices, double scale, double[] inverseLength,124 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double[] inverseLength, 125 125 bool fixedInverseLength, bool fixedScale) { 126 126 double d = i == j … … 129 129 130 130 int k = 0; 131 var g = new List<double>((!fixedInverseLength ? columnIndices.Length : 0) + (!fixedScale ? 1 : 0)); 131 132 if (!fixedInverseLength) { 132 foreach (var columnIndex in columnIndices) { 133 for (int c = 0; c < columnIndices.Length; c++) { 134 var columnIndex = columnIndices[c]; 133 135 double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]); 134 yield return scale * Math.Exp(-d / 2.0) * sqrDist;136 g.Add(scale * Math.Exp(-d / 2.0) * sqrDist); 135 137 k++; 136 138 } 137 139 } 138 if (!fixedScale) yield return 2.0 * scale * Math.Exp(-d / 2.0); 140 if (!fixedScale) g.Add(2.0 * scale * Math.Exp(-d / 2.0)); 141 return g; 139 142 } 140 143 }
Note: See TracChangeset
for help on using the changeset viewer.