Changeset 8732 for trunk/sources
- Timestamp:
- 10/04/12 12:01:26 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessHyperparameterInitializer.cs
r8463 r8732 91 91 var rand = RandomParameter.ActualValue; 92 92 for (int i = 0; i < r.Length; i++) 93 r[i] = rand.NextDouble() * 2 - 1;93 r[i] = rand.NextDouble() * 10 - 5; 94 94 95 95 HyperparameterParameter.ActualValue = r; -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs
r8473 r8732 34 34 [StorableClass] 35 35 public sealed class GaussianProcessRegressionSolution : RegressionSolution, IGaussianProcessSolution { 36 private new readonly Dictionary<int, double> evaluationCache; 36 37 37 38 public new IGaussianProcessModel Model { … … 41 42 42 43 [StorableConstructor] 43 private GaussianProcessRegressionSolution(bool deserializing) : base(deserializing) { } 44 private GaussianProcessRegressionSolution(bool deserializing) 45 : base(deserializing) { 46 evaluationCache = new Dictionary<int, double>(); 47 48 } 44 49 private GaussianProcessRegressionSolution(GaussianProcessRegressionSolution original, Cloner cloner) 45 50 : base(original, cloner) { 51 evaluationCache = new Dictionary<int, double>(original.evaluationCache); 46 52 } 47 53 public GaussianProcessRegressionSolution(IGaussianProcessModel model, IRegressionProblemData problemData) 48 54 : base(model, problemData) { 55 56 evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows); 49 57 RecalculateResults(); 50 58 } … … 65 73 66 74 public IEnumerable<double> GetEstimatedVariance(IEnumerable<int> rows) { 67 return Model.GetEstimatedVariance(ProblemData.Dataset, rows); 75 var rowsToEvaluate = rows.Except(evaluationCache.Keys); 76 var rowsEnumerator = rowsToEvaluate.GetEnumerator(); 77 var valuesEnumerator = Model.GetEstimatedVariance(ProblemData.Dataset, rowsToEvaluate).GetEnumerator(); 78 79 while (rowsEnumerator.MoveNext() & valuesEnumerator.MoveNext()) { 80 evaluationCache.Add(rowsEnumerator.Current, valuesEnumerator.Current); 81 } 82 83 return rows.Select(row => evaluationCache[row]); 84 } 85 86 protected override void OnModelChanged() { 87 evaluationCache.Clear(); 88 base.OnModelChanged(); 89 } 90 protected override void OnProblemDataChanged() { 91 evaluationCache.Clear(); 92 base.OnProblemDataChanged(); 68 93 } 69 94 }
Note: See TracChangeset
for help on using the changeset viewer.