Changeset 13784
- Timestamp:
- 04/22/16 13:47:35 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceConst.cs
r13721 r13784 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Core; … … 91 89 cov.CrossCovariance = (x, xt, i, j) => scale; 92 90 if (HasFixedScaleParameter) { 93 cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();91 cov.CovarianceGradient = (x, i, j) => new double[0]; 94 92 } else { 95 cov.CovarianceGradient = (x, i, j) => GetGradient(x, i, j, scale, columnIndices);93 cov.CovarianceGradient = (x, i, j) => new[] { 2.0 * scale }; 96 94 } 97 95 return cov; 98 96 } 99 100 private static IEnumerable<double> GetGradient(double[,] x, int i, int j, double scale, int[] columnIndices) {101 yield return 2.0 * scale;102 }103 97 } 104 98 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinear.cs
r13721 r13784 21 21 22 22 using System; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; … … 57 56 cov.Covariance = (x, i, j) => Util.ScalarProd(x, i, j, columnIndices, 1.0); 58 57 cov.CrossCovariance = (x, xt, i, j) => Util.ScalarProd(x, i, xt, j, columnIndices, 1.0); 59 cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();58 cov.CovarianceGradient = (x, i, j) => new double[0]; 60 59 return cov; 61 60 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceLinearArd.cs
r13721 r13784 90 90 cov.CrossCovariance = (x, xt, i, j) => Util.ScalarProd(x, i, xt, j, inverseLength, columnIndices); 91 91 if (fixedInverseLength) 92 cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();92 cov.CovarianceGradient = (x, i, j) => new double[0]; 93 93 else 94 94 cov.CovarianceGradient = (x, i, j) => GetGradient(x, i, j, inverseLength, columnIndices); … … 96 96 } 97 97 98 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, double[] inverseLength, int[] columnIndices) {98 private static IList<double> GetGradient(double[,] x, int i, int j, double[] inverseLength, int[] columnIndices) { 99 99 int k = 0; 100 var g = new List<double>(columnIndices.Length); 100 101 for (int c = 0; c < columnIndices.Length; c++) { 101 102 var columnIndex = columnIndices[c]; 102 yield return -2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[k] * inverseLength[k];103 g.Add(-2.0 * x[i, columnIndex] * x[j, columnIndex] * inverseLength[k] * inverseLength[k]); 103 104 k++; 104 105 } 106 return g; 105 107 } 106 108 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceMaternIso.cs
r13721 r13784 155 155 } 156 156 157 158 private static IEnumerable<double> GetGradient(double[,] x, int i, int j, int d, double scale, double inverseLength, int[] columnIndices, 157 private static IList<double> GetGradient(double[,] x, int i, int j, int d, double scale, double inverseLength, int[] columnIndices, 159 158 bool fixedInverseLength, bool fixedScale) { 160 159 double dist = i == j … … 162 161 : Math.Sqrt(Util.SqrDist(x, i, j, columnIndices, Math.Sqrt(d) * inverseLength)); 163 162 164 if (!fixedInverseLength) yield return scale * dm(d, dist); 165 if (!fixedScale) yield return 2 * scale * m(d, dist); 163 var g = new List<double>(2); 164 if (!fixedInverseLength) g.Add(scale * dm(d, dist)); 165 if (!fixedScale) g.Add(2 * scale * m(d, dist)); 166 return g; 166 167 } 167 168 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceNeuralNetwork.cs
r13721 r13784 140 140 141 141 // order of returned gradients must match the order in GetParameterValues! 142 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, double length, double scale, int[] columnIndices,142 private static IList<double> GetGradient(double[,] x, int i, int j, double length, double scale, int[] columnIndices, 143 143 bool fixedLength, bool fixedScale) { 144 { 145 double sx = 1.0; 146 double s1 = 1.0; 147 double s2 = 1.0; 148 for (int c = 0; c < columnIndices.Length; c++) { 149 var col = columnIndices[c]; 150 sx += x[i, col] * x[j, col]; 151 s1 += x[i, col] * x[i, col]; 152 s2 += x[j, col] * x[j, col]; 153 } 154 var h = (length + s1) * (length + s2); 155 var f = sx / Math.Sqrt(h); 156 if (!fixedLength) { 157 yield return -scale / Math.Sqrt(1.0 - f * f) * ((length * sx * (2.0 * length + s1 + s2)) / Math.Pow(h, 3.0 / 2.0)); 158 } 159 if (!fixedScale) { 160 yield return 2.0 * scale * Math.Asin(f); 161 } 144 double sx = 1.0; 145 double s1 = 1.0; 146 double s2 = 1.0; 147 for (int c = 0; c < columnIndices.Length; c++) { 148 var col = columnIndices[c]; 149 sx += x[i, col] * x[j, col]; 150 s1 += x[i, col] * x[i, col]; 151 s2 += x[j, col] * x[j, col]; 162 152 } 153 var h = (length + s1) * (length + s2); 154 var f = sx / Math.Sqrt(h); 155 156 var g = new List<double>(2); 157 if (!fixedLength) g.Add(-scale / Math.Sqrt(1.0 - f * f) * ((length * sx * (2.0 * length + s1 + s2)) / Math.Pow(h, 3.0 / 2.0))); 158 if (!fixedScale) g.Add(2.0 * scale * Math.Asin(f)); 159 return g; 163 160 } 164 161 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceNoise.cs
r13721 r13784 21 21 22 22 using System; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; … … 92 91 cov.CrossCovariance = (x, xt, i, j) => Util.SqrDist(x, i, xt, j, columnIndices, 1.0) < 1e-9 ? scale : 0.0; 93 92 if (fixedScale) 94 cov.CovarianceGradient = (x, i, j) => Enumerable.Empty<double>();93 cov.CovarianceGradient = (x, i, j) => new double[0]; 95 94 else 96 cov.CovarianceGradient = (x, i, j) => Enumerable.Repeat(i == j ? 2.0 * scale : 0.0, 1);95 cov.CovarianceGradient = (x, i, j) => new double[1] { i == j ? 2.0 * scale : 0.0 }; 97 96 return cov; 98 97 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovariancePeriodic.cs
r13721 r13784 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; … … 117 116 } 118 117 119 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) {118 public ParameterizedCovarianceFunction GetParameterizedCovarianceFunction(double[] p, int[] columnIndices) { 120 119 double inverseLength, period, scale; 121 120 GetParameterValues(p, out scale, out period, out inverseLength); … … 145 144 } 146 145 147 148 private static IEnumerable<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double period, double inverseLength, 146 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double period, double inverseLength, 149 147 bool fixedInverseLength, bool fixedPeriod, bool fixedScale) { 150 148 double k = i == j ? 0.0 : Math.PI * GetDistance(x, x, i, j, columnIndices) / period; 151 149 double gradient = Math.Sin(k) * inverseLength; 152 150 gradient *= gradient; 153 if (!fixedInverseLength) yield return 4.0 * scale * Math.Exp(-2.0 * gradient) * gradient; 151 var g = new List<double>(3); 152 if (!fixedInverseLength) 153 g.Add(4.0 * scale * Math.Exp(-2.0 * gradient) * gradient); 154 154 if (!fixedPeriod) { 155 155 double r = Math.Sin(k) * inverseLength; 156 yield return 2.0 * k * scale * Math.Exp(-2 * r * r) * Math.Sin(2 * k) * inverseLength * inverseLength;156 g.Add(2.0 * k * scale * Math.Exp(-2 * r * r) * Math.Sin(2 * k) * inverseLength * inverseLength); 157 157 } 158 158 if (!fixedScale) 159 yield return 2.0 * scale * Math.Exp(-2 * gradient);160 159 g.Add(2.0 * scale * Math.Exp(-2 * gradient)); 160 return g; 161 161 } 162 162 -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovariancePiecewisePolynomial.cs
r13721 r13784 69 69 Parameters.Add(new OptionalValueParameter<DoubleValue>("Scale", "The scale parameter of the piecewise polynomial covariance function.")); 70 70 71 var validValues = new ItemSet<IntValue>(new IntValue[] { 72 (IntValue)(new IntValue().AsReadOnly()), 73 (IntValue)(new IntValue(1).AsReadOnly()), 74 (IntValue)(new IntValue(2).AsReadOnly()), 71 var validValues = new ItemSet<IntValue>(new IntValue[] { 72 (IntValue)(new IntValue().AsReadOnly()), 73 (IntValue)(new IntValue(1).AsReadOnly()), 74 (IntValue)(new IntValue(2).AsReadOnly()), 75 75 (IntValue)(new IntValue(3).AsReadOnly()) }); 76 76 Parameters.Add(new ConstrainedValueParameter<IntValue>("V", "The v parameter of the piecewise polynomial function (allowed values 0, 1, 2, 3).", validValues, validValues.First())); … … 159 159 } 160 160 161 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, double length, double scale, int v, double exp, Func<double, double> f, Func<double, double> df, int[] columnIndices,161 private static IList<double> GetGradient(double[,] x, int i, int j, double length, double scale, int v, double exp, Func<double, double> f, Func<double, double> df, int[] columnIndices, 162 162 bool fixedLength, bool fixedScale) { 163 163 double k = Math.Sqrt(Util.SqrDist(x, i, x, j, columnIndices, 1.0 / length)); 164 if (!fixedLength) yield return scale * Math.Pow(Math.Max(1.0 - k, 0), exp + v - 1) * k * ((exp + v) * f(k) - Math.Max(1 - k, 0) * df(k)); 165 if (!fixedScale) yield return 2.0 * scale * Math.Pow(Math.Max(1 - k, 0), exp + v) * f(k); 164 var g = new List<double>(2); 165 if (!fixedLength) g.Add(scale * Math.Pow(Math.Max(1.0 - k, 0), exp + v - 1) * k * ((exp + v) * f(k) - Math.Max(1 - k, 0) * df(k))); 166 if (!fixedScale) g.Add(2.0 * scale * Math.Pow(Math.Max(1 - k, 0), exp + v) * f(k)); 167 return g; 166 168 } 167 169 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovariancePolynomial.cs
r13721 r13784 121 121 } 122 122 123 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, double c, double scale, int degree, int[] columnIndices,123 private static IList<double> GetGradient(double[,] x, int i, int j, double c, double scale, int degree, int[] columnIndices, 124 124 bool fixedConst, bool fixedScale) { 125 125 double s = Util.ScalarProd(x, i, j, columnIndices, 1.0); 126 if (!fixedConst) yield return c * degree * scale * Math.Pow(c + s, degree - 1); 127 if (!fixedScale) yield return 2 * scale * Math.Pow(c + s, degree); 126 var g = new List<double>(2); 127 if (!fixedConst) g.Add(c * degree * scale * Math.Pow(c + s, degree - 1)); 128 if (!fixedScale) g.Add(2 * scale * Math.Pow(c + s, degree)); 129 return g; 128 130 } 129 131 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceProduct.cs
r13721 r13784 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Linq.Expressions;26 25 using HeuristicLab.Common; 27 26 using HeuristicLab.Core; … … 93 92 } 94 93 95 public static I Enumerable<double> GetGradient(double[,] x, int i, int j, List<ParameterizedCovarianceFunction> factorFunctions) {94 public static IList<double> GetGradient(double[,] x, int i, int j, List<ParameterizedCovarianceFunction> factorFunctions) { 96 95 var covariances = factorFunctions.Select(f => f.Covariance(x, i, j)).ToArray(); 96 var gr = new List<double>(factorFunctions.Sum(f => f.CovarianceGradient(x, i, j).Count)); 97 97 for (int ii = 0; ii < factorFunctions.Count; ii++) { 98 98 foreach (var g in factorFunctions[ii].CovarianceGradient(x, i, j)) { … … 100 100 for (int jj = 0; jj < covariances.Length; jj++) 101 101 if (ii != jj) res *= covariances[jj]; 102 yield return res;102 gr.Add(res); 103 103 } 104 104 } 105 return gr; 105 106 } 106 107 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs
r13721 r13784 144 144 } 145 145 146 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, 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 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticIso.cs
r13721 r13784 139 139 } 140 140 141 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double shape, double inverseLength,141 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, double shape, double inverseLength, 142 142 bool fixedInverseLength, bool fixedScale, bool fixedShape) { 143 143 double d = i == j … … 146 146 147 147 double b = 1 + 0.5 * d / shape; 148 if (!fixedInverseLength) yield return scale * Math.Pow(b, -shape - 1) * d; 149 if (!fixedScale) yield return 2 * scale * Math.Pow(b, -shape); 150 if (!fixedShape) yield return scale * Math.Pow(b, -shape) * (0.5 * d / b - shape * Math.Log(b)); 148 var g = new List<double>(3); 149 if (!fixedInverseLength) g.Add(scale * Math.Pow(b, -shape - 1) * d); 150 if (!fixedScale) g.Add(2 * scale * Math.Pow(b, -shape)); 151 if (!fixedShape) g.Add(scale * Math.Pow(b, -shape) * (0.5 * d / b - shape * Math.Log(b))); 152 return g; 151 153 } 152 154 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceScale.cs
r13721 r13784 100 100 } 101 101 102 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, ParameterizedCovarianceFunction cov,102 private static IList<double> GetGradient(double[,] x, int i, int j, int[] columnIndices, double scale, ParameterizedCovarianceFunction cov, 103 103 bool fixedScale) { 104 var gr = new List<double>((!fixedScale ? 1 : 0) + cov.CovarianceGradient(x, i, j).Count); 104 105 if (!fixedScale) { 105 yield return 2 * scale * cov.Covariance(x, i, j);106 gr.Add(2 * scale * cov.Covariance(x, i, j)); 106 107 } 107 108 foreach (var g in cov.CovarianceGradient(x, i, j)) 108 yield return scale * g; 109 gr.Add(scale * g); 110 return gr; 109 111 } 110 112 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSpectralMixture.cs
r13721 r13784 181 181 182 182 // order of returned gradients must match the order in GetParameterValues! 183 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, int maxQ, double[] weight, double[] frequency, double[] lengthScale, int[] columnIndices,183 private static IList<double> GetGradient(double[,] x, int i, int j, int maxQ, double[] weight, double[] frequency, double[] lengthScale, int[] columnIndices, 184 184 bool fixedWeight, bool fixedFrequency, bool fixedLengthScale) { 185 185 double[] tau = Util.GetRow(x, i, columnIndices).Zip(Util.GetRow(x, j, columnIndices), (xi, xj) => xi - xj).ToArray(); 186 186 int numberOfVariables = lengthScale.Length / maxQ; 187 187 188 var g = new List<double>((!fixedWeight ? maxQ : 0) + (!fixedFrequency ? maxQ * columnIndices.Length : 0) + (!fixedLengthScale ? maxQ * columnIndices.Length : 0)); 188 189 if (!fixedWeight) { 189 190 // weight … … 198 199 idx++; 199 200 } 200 yield return k;201 g.Add(k); 201 202 } 202 203 } … … 213 214 Math.Sin(2 * Math.PI * tau[idx] * frequency[q * numberOfVariables + c]); 214 215 idx++; 215 yield return weight[q] * k;216 g.Add(weight[q] * k); 216 217 } 217 218 } … … 229 230 f2(tau[idx], frequency[q * numberOfVariables + c]); 230 231 idx++; 231 yield return weight[q] * k;232 g.Add(weight[q] * k); 232 233 } 233 234 } 234 235 } 236 237 return g; 235 238 } 236 239 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
r13721 r13784 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, 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 133 for (int c = 0; c < columnIndices.Length; c++) { 133 134 var columnIndex = columnIndices[c]; 134 135 double sqrDist = Util.SqrDist(x[i, columnIndex] * inverseLength[k], x[j, columnIndex] * inverseLength[k]); 135 yield return scale * Math.Exp(-d / 2.0) * sqrDist;136 g.Add(scale * Math.Exp(-d / 2.0) * sqrDist); 136 137 k++; 137 138 } 138 139 } 139 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; 140 142 } 141 143 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialIso.cs
r13721 r13784 126 126 127 127 // order of returned gradients must match the order in GetParameterValues! 128 private static I Enumerable<double> GetGradient(double[,] x, int i, int j, double sf2, double inverseLength, int[] columnIndices,128 private static IList<double> GetGradient(double[,] x, int i, int j, double sf2, double inverseLength, int[] columnIndices, 129 129 bool fixedInverseLength, bool fixedScale) { 130 130 double d = i == j … … 132 132 : Util.SqrDist(x, i, j, columnIndices, inverseLength); 133 133 double g = Math.Exp(-d / 2.0); 134 if (!fixedInverseLength) yield return sf2 * g * d; 135 if (!fixedScale) yield return 2.0 * sf2 * g; 134 var gr = new List<double>(2); 135 if (!fixedInverseLength) gr.Add(sf2 * g * d); 136 if (!fixedScale) gr.Add(2.0 * sf2 * g); 137 return gr; 136 138 } 137 139 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSum.cs
r13721 r13784 87 87 sum.Covariance = (x, i, j) => functions.Select(e => e.Covariance(x, i, j)).Sum(); 88 88 sum.CrossCovariance = (x, xt, i, j) => functions.Select(e => e.CrossCovariance(x, xt, i, j)).Sum(); 89 sum.CovarianceGradient = (x, i, j) => functions.Select(e => e.CovarianceGradient(x, i, j)).Aggregate(Enumerable.Concat); 89 sum.CovarianceGradient = (x, i, j) => { 90 var g = new List<double>(functions.Sum(e => e.CovarianceGradient(x, i, j).Count)); 91 foreach (var e in functions) 92 g.AddRange(e.CovarianceGradient(x, i, j)); 93 return g; 94 }; 90 95 return sum; 91 96 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
r13721 r13784 239 239 for (int i = 0; i < n; i++) { 240 240 for (int j = 0; j < i; j++) { 241 var g = cov.CovarianceGradient(x, i, j) .ToArray();241 var g = cov.CovarianceGradient(x, i, j); 242 242 for (int k = 0; k < covGradients.Length; k++) { 243 243 covGradients[k] += lCopy[i, j] * g[k]; … … 245 245 } 246 246 247 var gDiag = cov.CovarianceGradient(x, i, i) .ToArray();247 var gDiag = cov.CovarianceGradient(x, i, i); 248 248 for (int k = 0; k < covGradients.Length; k++) { 249 249 // diag -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/ICovarianceFunction.cs
r13721 r13784 27 27 public delegate double CovarianceFunctionDelegate(double[,] x, int i, int j); 28 28 public delegate double CrossCovarianceFunctionDelegate(double[,] x, double[,] xt, int i, int j); 29 public delegate I Enumerable<double> CovarianceGradientFunctionDelegate(double[,] x, int i, int j);29 public delegate IList<double> CovarianceGradientFunctionDelegate(double[,] x, int i, int j); 30 30 31 31 public class ParameterizedCovarianceFunction { -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/StudentTProcessModel.cs
r13721 r13784 252 252 for (int i = 0; i < n; i++) { 253 253 for (int j = 0; j < i; j++) { 254 var g = cov.CovarianceGradient(x, i, j) .ToArray();254 var g = cov.CovarianceGradient(x, i, j); 255 255 for (int k = 0; k < covGradients.Length; k++) { 256 256 covGradients[k] += lCopy[i, j] * g[k]; … … 258 258 } 259 259 260 var gDiag = cov.CovarianceGradient(x, i, i) .ToArray();260 var gDiag = cov.CovarianceGradient(x, i, i); 261 261 for (int k = 0; k < covGradients.Length; k++) { 262 262 // diag
Note: See TracChangeset
for help on using the changeset viewer.