- Timestamp:
- 01/04/13 16:06:26 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovariancePeriodic.cs
r8982 r9108 82 82 83 83 84 private void GetParameterValues(double[] p, out double scale, out double period, out double inverseLength) { 84 private void GetParameterValues(double[] 85 p, out double scale, out double period, out double inverseLength) { 85 86 // gather parameter values 86 87 int c = 0; -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticArd.cs
r9106 r9108 88 88 int c = 0; 89 89 // gather parameter values 90 if (InverseLengthParameter.Value != null) { 91 inverseLength = InverseLengthParameter.Value.ToArray(); 92 } else { 93 int length = p.Length; 94 if (ScaleParameter.Value == null) length--; 95 if (ShapeParameter.Value == null) length--; 96 inverseLength = p.Select(e => 1.0 / Math.Exp(e)).Take(length).ToArray(); 97 c += inverseLength.Length; 98 } 90 99 if (ScaleParameter.Value != null) { 91 100 scale = ScaleParameter.Value.Value; … … 99 108 shape = Math.Exp(p[c]); 100 109 c++; 101 }102 if (InverseLengthParameter.Value != null) {103 inverseLength = InverseLengthParameter.Value.ToArray();104 } else {105 inverseLength = p.Skip(c).Select(e => 1.0 / Math.Exp(e)).ToArray();106 c += inverseLength.Length;107 110 } 108 111 if (p.Length != c) throw new ArgumentException("The length of the parameter vector does not match the number of free parameters for CovarianceRationalQuadraticArd", "p"); -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceRationalQuadraticIso.cs
r8982 r9108 84 84 int c = 0; 85 85 // gather parameter values 86 if (InverseLengthParameter.Value != null) { 87 inverseLength = InverseLengthParameter.Value.Value; 88 } else { 89 inverseLength = 1.0 / Math.Exp(p[c]); 90 c++; 91 } 86 92 if (ScaleParameter.Value != null) { 87 93 scale = ScaleParameter.Value.Value; … … 94 100 } else { 95 101 shape = Math.Exp(p[c]); 96 c++;97 }98 if (InverseLengthParameter.Value != null) {99 inverseLength = InverseLengthParameter.Value.Value;100 } else {101 inverseLength = 1.0 / Math.Exp(p[c]);102 102 c++; 103 103 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialArd.cs
r9106 r9108 76 76 int c = 0; 77 77 // gather parameter values 78 if (InverseLengthParameter.Value != null) { 79 inverseLength = InverseLengthParameter.Value.ToArray(); 80 } else { 81 int length = p.Length; 82 if (ScaleParameter.Value == null) length--; 83 inverseLength = p.Select(e => 1.0 / Math.Exp(e)).Take(length).ToArray(); 84 c += inverseLength.Length; 85 } 78 86 if (ScaleParameter.Value != null) { 79 87 scale = ScaleParameter.Value.Value; … … 81 89 scale = Math.Exp(2 * p[c]); 82 90 c++; 83 }84 if (InverseLengthParameter.Value != null) {85 inverseLength = InverseLengthParameter.Value.ToArray();86 } else {87 inverseLength = p.Skip(c).Select(e => 1.0 / Math.Exp(e)).ToArray();88 c += inverseLength.Length;89 91 } 90 92 if (p.Length != c) throw new ArgumentException("The length of the parameter vector does not match the number of free parameters for CovarianceSquaredExponentialArd", "p"); … … 111 113 } 112 114 113 115 // order of returned gradients must match the order in GetParameterValues! 114 116 private static IEnumerable<double> GetGradient(double[,] x, int i, int j, IEnumerable<int> columnIndices, double scale, double[] inverseLength) { 115 117 if (columnIndices == null) columnIndices = Enumerable.Range(0, x.GetLength(1)); … … 117 119 ? 0.0 118 120 : Util.SqrDist(x, i, j, inverseLength, columnIndices); 121 119 122 int k = 0; 120 123 foreach (var columnIndex in columnIndices) { … … 123 126 k++; 124 127 } 125 126 128 yield return 2.0 * scale * Math.Exp(-d / 2.0); 127 129 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSquaredExponentialIso.cs
r8982 r9108 116 116 } 117 117 118 // order of returned gradients must match the order in GetParameterValues! 118 119 private static IEnumerable<double> GetGradient(double[,] x, int i, int j, double sf2, double inverseLength, IEnumerable<int> columnIndices) { 119 120 double d = i == j
Note: See TracChangeset
for help on using the changeset viewer.