Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/16 15:23:22 (8 years ago)
Author:
mkommend
Message:

#2597: Merged all changesets from HeuristiLab.RegressionSolutionGradientView into the trunk.

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis

  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r13941 r14095  
    341341    }
    342342
    343     public IEnumerable<double> GetEstimatedVariance(IDataset dataset, IEnumerable<int> rows) {
     343    public IEnumerable<double> GetEstimatedVariances(IDataset dataset, IEnumerable<int> rows) {
    344344      try {
    345345        if (x == null) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs

    r12012 r14095  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
     
    3331  [Item("GaussianProcessRegressionSolution", "Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.")]
    3432  [StorableClass]
    35   public sealed class GaussianProcessRegressionSolution : RegressionSolution, IGaussianProcessSolution {
    36     private new readonly Dictionary<int, double> evaluationCache;
     33  public sealed class GaussianProcessRegressionSolution : ConfidenceBoundRegressionSolution, IGaussianProcessSolution {
    3734
    3835    public new IGaussianProcessModel Model {
     
    4441    private GaussianProcessRegressionSolution(bool deserializing)
    4542      : base(deserializing) {
    46       evaluationCache = new Dictionary<int, double>();
    47 
    4843    }
    4944    private GaussianProcessRegressionSolution(GaussianProcessRegressionSolution original, Cloner cloner)
    50       : base(original, cloner) {
    51       evaluationCache = new Dictionary<int, double>(original.evaluationCache);
    52     }
     45      : base(original, cloner) { }
    5346    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) { }
    5848
    5949    public override IDeepCloneable Clone(Cloner cloner) {
    6050      return new GaussianProcessRegressionSolution(this, cloner);
    6151    }
    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     }
    9352  }
    9453}
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeBuilder.cs

    r13993 r14095  
    2222
    2323using System;
    24 using System.Collections;
    2524using System.Collections.Generic;
    2625using System.Diagnostics;
     
    129128
    130129      // y and curPred are changed in gradient boosting
    131       this.y = y; 
    132       this.curPred = curPred; 
     130      this.y = y;
     131      this.curPred = curPred;
    133132
    134133      // shuffle row idx
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs

    r12509 r14095  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    2322using HeuristicLab.Problems.DataAnalysis;
    2423
     
    2726  /// Interface to represent a Gaussian process posterior
    2827  /// </summary>
    29   public interface IGaussianProcessModel : IRegressionModel {
     28  public interface IGaussianProcessModel : IConfidenceBoundRegressionModel {
    3029    double NegativeLogLikelihood { get; }
    3130    double SigmaNoise { get; }
     
    3433    double[] HyperparameterGradients { get; }
    3534
    36     IEnumerable<double> GetEstimatedVariance(IDataset ds, IEnumerable<int> rows);
    3735    void FixParameters();
    3836  }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs

    r12012 r14095  
    2626  /// Interface to represent a Gaussian process solution (either regression or classification)
    2727  /// </summary>
    28   public interface IGaussianProcessSolution : IDataAnalysisSolution {
     28  public interface IGaussianProcessSolution : IConfidenceBoundRegressionSolution {
    2929    new IGaussianProcessModel Model { get; }
    3030  }
Note: See TracChangeset for help on using the changeset viewer.