Changeset 8933 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions
- Timestamp:
- 11/20/12 14:04:29 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinearArd.cs
r8932 r8933 99 99 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); 100 100 101 int k = 0; 101 102 foreach (int columnIndex in columnIndices) { 102 yield return -2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[columnIndex] * inverseLength[columnIndex]; 103 yield return -2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[k] * inverseLength[k]; 104 k++; 103 105 } 104 106 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceMask.cs
r8929 r8933 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 111 112 112 113 public double GetCovariance(double[,] x, int i, int j, IEnumerable<int> columnIndices) { 114 // cov mask overwrites the previously selected columnIndices 115 // -> stacking of CovarianceMask is not supported 116 if (columnIndices != null && columnIndices.Count() != x.GetLength(1)) 117 throw new InvalidOperationException("Stacking of masking covariance functions is not supported."); 118 113 119 return cov.GetCovariance(x, i, j, selectedDimensions); 114 120 } 115 121 116 122 public IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices) { 123 if (columnIndices != null && columnIndices.Count() != x.GetLength(1)) 124 throw new InvalidOperationException("Stacking of masking covariance functions is not supported."); 125 117 126 return cov.GetGradient(x, i, j, selectedDimensions); 118 127 } 119 128 120 129 public double GetCrossCovariance(double[,] x, double[,] xt, int i, int j, IEnumerable<int> columnIndices) { 130 if (columnIndices != null && columnIndices.Count() != x.GetLength(1)) 131 throw new InvalidOperationException("Stacking of masking covariance functions is not supported."); 132 121 133 return cov.GetCrossCovariance(x, xt, i, j, selectedDimensions); 122 134 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs
r8932 r8933 148 148 : Util.SqrDist(x, i, j, inverseLength, columnIndices); 149 149 double b = 1 + 0.5 * d / shape; 150 int k = 0; 150 151 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]); 152 yield return sf2 * Math.Pow(b, -shape - 1) * Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]); 153 k++; 152 154 } 153 155 yield return 2 * sf2 * Math.Pow(b, -shape); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
r8932 r8933 122 122 ? 0.0 123 123 : Util.SqrDist(x, i, j, inverseLength, columnIndices); 124 124 int k = 0; 125 125 foreach (var columnIndex in columnIndices) { 126 double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[ columnIndex], x[j, columnIndex] * inverseLength[columnIndex]);126 double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]); 127 127 yield return sf2 * Math.Exp(-d / 2.0) * sqrDist; 128 k++; 128 129 } 129 130
Note: See TracChangeset
for help on using the changeset viewer.