Changeset 8439
- Timestamp:
- 08/08/12 17:52:27 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceProd.cs
r8416 r8439 87 87 88 88 public double[] GetGradient(int i, int j) { 89 return factors.Select(t => t.GetGradient(i, j)).SelectMany(seq => seq).ToArray(); 89 return Enumerable.Range(0, GetNumberOfParameters(numberOfVariables)).Select(k => GetGradient(i, j, k)).ToArray(); 90 } 91 public double GetGradient(int i, int j, int k) { 92 // map from parameter index to factor 93 var vi = factors.Select((f, idx) => Enumerable.Repeat(idx, f.GetNumberOfParameters(numberOfVariables))).SelectMany(x => x).ToArray(); 94 double res = 1.0; 95 int jj = Enumerable.Range(0, k).Count(e => vi[e] == vi[k]); 96 for (int ii = 0; ii < factors.Count; ii++) { 97 var f = factors[ii]; 98 if (ii == vi[k]) { 99 res *= f.GetGradient(i, j)[jj]; 100 } else { 101 res *= f.GetCovariance(i, j); 102 } 103 } 104 return res; 90 105 } 91 106 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r8419 r8439 120 120 </Compile> 121 121 <Compile Include="FixedDataAnalysisAlgorithm.cs" /> 122 <Compile Include="GaussianProcess\MeanProd.cs" /> 123 <Compile Include="GaussianProcess\MeanSum.cs" /> 122 124 <Compile Include="GaussianProcess\CovarianceProd.cs" /> 123 125 <Compile Include="GaussianProcess\CovarianceSum.cs" /> -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r8323 r8439 290 290 <Compile Include="HeuristicLab-3.3\ThreadSafeLogTest.cs" /> 291 291 <Compile Include="HeuristicLab-3.3\ToStringTest.cs" /> 292 <Compile Include="HeuristicLab.Algorithms.DataAnalysis-3.4\GaussianProcessFunctionsTest.cs" /> 292 293 <Compile Include="HeuristicLab.Analysis-3.3\MultidimensionalScalingTest.cs" /> 293 294 <Compile Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3\Auxiliary.cs" />
Note: See TracChangeset
for help on using the changeset viewer.