Changeset 8932
- Timestamp:
- 11/20/12 13:24:25 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinearArd.cs
r8929 r8932 99 99 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 100 100 101 foreach (int kin columnIndices) {102 yield return -2.0 * x[i, k] * x[j, k] * inverseLength[k] * inverseLength[k];101 foreach (int columnIndex in columnIndices) { 102 yield return -2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[columnIndex] * inverseLength[columnIndex]; 103 103 } 104 104 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs
r8929 r8932 143 143 144 144 public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) { 145 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 145 146 double d = i == j 146 147 ? 0.0 147 148 : Util.SqrDist(x, i, j, inverseLength, columnIndices); 148 149 double b = 1 + 0.5 * d / shape; 149 for (int k = 0; k < inverseLength.Length; k++) {150 yield return sf2 * Math.Pow(b, -shape - 1) * Util.SqrDist(x[i, k] * inverseLength[k], x[j, k] * inverseLength[k]);150 foreach (var columnIndex in columnIndices) { 151 yield return sf2 * Math.Pow(b, -shape - 1) * Util.SqrDist(x[i, columnIndex] * inverseLength[columnIndex], x[j, columnIndex] * inverseLength[columnIndex]); 151 152 } 152 153 yield return 2 * sf2 * Math.Pow(b, -shape); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
r8929 r8932 118 118 119 119 public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) { 120 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 120 121 double d = i == j 121 122 ? 0.0 122 123 : Util.SqrDist(x, i, j, inverseLength, columnIndices); 123 124 124 for (int ii = 0; ii < inverseLength.Length; ii++) {125 double sqrDist = Util.SqrDist(x[i, ii] * inverseLength[ii], x[j, ii] * inverseLength[ii]);125 foreach (var columnIndex in columnIndices) { 126 double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[columnIndex], x[j, columnIndex] * inverseLength[columnIndex]); 126 127 yield return sf2 * Math.Exp(-d / 2.0) * sqrDist; 127 128 } 129 128 130 yield return 2.0 * sf2 * Math.Exp(-d / 2.0); 129 131 }
Note: See TracChangeset
for help on using the changeset viewer.