Changeset 14095 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Timestamp:
- 07/18/16 15:23:22 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis (added) merged: 13819,13823-13824,13858,13948,13994
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs
r13941 r14095 341 341 } 342 342 343 public IEnumerable<double> GetEstimatedVariance (IDataset dataset, IEnumerable<int> rows) {343 public IEnumerable<double> GetEstimatedVariances(IDataset dataset, IEnumerable<int> rows) { 344 344 try { 345 345 if (x == null) { -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs
r12012 r14095 20 20 #endregion 21 21 22 using System.Collections.Generic;23 using System.Linq;24 22 using HeuristicLab.Common; 25 23 using HeuristicLab.Core; … … 33 31 [Item("GaussianProcessRegressionSolution", "Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.")] 34 32 [StorableClass] 35 public sealed class GaussianProcessRegressionSolution : RegressionSolution, IGaussianProcessSolution { 36 private new readonly Dictionary<int, double> evaluationCache; 33 public sealed class GaussianProcessRegressionSolution : ConfidenceBoundRegressionSolution, IGaussianProcessSolution { 37 34 38 35 public new IGaussianProcessModel Model { … … 44 41 private GaussianProcessRegressionSolution(bool deserializing) 45 42 : base(deserializing) { 46 evaluationCache = new Dictionary<int, double>();47 48 43 } 49 44 private GaussianProcessRegressionSolution(GaussianProcessRegressionSolution original, Cloner cloner) 50 : base(original, cloner) { 51 evaluationCache = new Dictionary<int, double>(original.evaluationCache); 52 } 45 : base(original, cloner) { } 53 46 public GaussianProcessRegressionSolution(IGaussianProcessModel model, IRegressionProblemData problemData) 54 : base(model, problemData) { 55 56 evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows); 57 } 47 : base(model, problemData) { } 58 48 59 49 public override IDeepCloneable Clone(Cloner cloner) { 60 50 return new GaussianProcessRegressionSolution(this, cloner); 61 51 } 62 63 public IEnumerable<double> EstimatedVariance {64 get { return GetEstimatedVariance(Enumerable.Range(0, ProblemData.Dataset.Rows)); }65 }66 public IEnumerable<double> EstimatedTrainingVariance {67 get { return GetEstimatedVariance(ProblemData.TrainingIndices); }68 }69 public IEnumerable<double> EstimatedTestVariance {70 get { return GetEstimatedVariance(ProblemData.TestIndices); }71 }72 73 public IEnumerable<double> GetEstimatedVariance(IEnumerable<int> rows) {74 var rowsToEvaluate = rows.Except(evaluationCache.Keys);75 var rowsEnumerator = rowsToEvaluate.GetEnumerator();76 var valuesEnumerator = Model.GetEstimatedVariance(ProblemData.Dataset, rowsToEvaluate).GetEnumerator();77 78 while (rowsEnumerator.MoveNext() & valuesEnumerator.MoveNext()) {79 evaluationCache.Add(rowsEnumerator.Current, valuesEnumerator.Current);80 }81 82 return rows.Select(row => evaluationCache[row]);83 }84 85 protected override void OnModelChanged() {86 evaluationCache.Clear();87 base.OnModelChanged();88 }89 protected override void OnProblemDataChanged() {90 evaluationCache.Clear();91 base.OnProblemDataChanged();92 }93 52 } 94 53 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeBuilder.cs
r13993 r14095 22 22 23 23 using System; 24 using System.Collections;25 24 using System.Collections.Generic; 26 25 using System.Diagnostics; … … 129 128 130 129 // y and curPred are changed in gradient boosting 131 this.y = y; 132 this.curPred = curPred; 130 this.y = y; 131 this.curPred = curPred; 133 132 134 133 // shuffle row idx -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs
r12509 r14095 20 20 #endregion 21 21 22 using System.Collections.Generic;23 22 using HeuristicLab.Problems.DataAnalysis; 24 23 … … 27 26 /// Interface to represent a Gaussian process posterior 28 27 /// </summary> 29 public interface IGaussianProcessModel : I RegressionModel {28 public interface IGaussianProcessModel : IConfidenceBoundRegressionModel { 30 29 double NegativeLogLikelihood { get; } 31 30 double SigmaNoise { get; } … … 34 33 double[] HyperparameterGradients { get; } 35 34 36 IEnumerable<double> GetEstimatedVariance(IDataset ds, IEnumerable<int> rows);37 35 void FixParameters(); 38 36 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs
r12012 r14095 26 26 /// Interface to represent a Gaussian process solution (either regression or classification) 27 27 /// </summary> 28 public interface IGaussianProcessSolution : I DataAnalysisSolution {28 public interface IGaussianProcessSolution : IConfidenceBoundRegressionSolution { 29 29 new IGaussianProcessModel Model { get; } 30 30 }
Note: See TracChangeset
for help on using the changeset viewer.