Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/29/16 10:36:52 (9 years ago)
Author:
pfleck
Message:

#2597

  • Merged recent trunk changes.
  • Adapted VariablesUsedForPrediction property for RegressionSolutionTargetResponseGradientView.
  • Fixed a reference (.dll to project ref).
Location:
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis

  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceProduct.cs

    r13784 r13948  
    9494    public static IList<double> GetGradient(double[,] x, int i, int j, List<ParameterizedCovarianceFunction> factorFunctions) {
    9595      var covariances = factorFunctions.Select(f => f.Covariance(x, i, j)).ToArray();
    96       var gr = new List<double>(factorFunctions.Sum(f => f.CovarianceGradient(x, i, j).Count));
     96      var gr = new List<double>();
    9797      for (int ii = 0; ii < factorFunctions.Count; ii++) {
    9898        foreach (var g in factorFunctions[ii].CovarianceGradient(x, i, j)) {
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/CovarianceFunctions/CovarianceSum.cs

    r13784 r13948  
    8888      sum.CrossCovariance = (x, xt, i, j) => functions.Select(e => e.CrossCovariance(x, xt, i, j)).Sum();
    8989      sum.CovarianceGradient = (x, i, j) => {
    90         var g = new List<double>(functions.Sum(e => e.CovarianceGradient(x, i, j).Count));
     90        var g = new List<double>();
    9191        foreach (var e in functions)
    9292          g.AddRange(e.CovarianceGradient(x, i, j));
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r13823 r13948  
    3434  [StorableClass]
    3535  [Item("GaussianProcessModel", "Represents a Gaussian process posterior.")]
    36   public sealed class GaussianProcessModel : NamedItem, IGaussianProcessModel {
     36  public sealed class GaussianProcessModel : RegressionModel, IGaussianProcessModel {
     37    public override IEnumerable<string> VariablesUsedForPrediction {
     38      get { return allowedInputVariables; }
     39    }
     40
    3741    [Storable]
    3842    private double negativeLogLikelihood;
     
    6165      get { return meanFunction; }
    6266    }
    63     [Storable]
    64     private string targetVariable;
    65     public string TargetVariable {
    66       get { return targetVariable; }
    67     }
     67
    6868    [Storable]
    6969    private string[] allowedInputVariables;
     
    128128      this.trainingDataset = cloner.Clone(original.trainingDataset);
    129129      this.negativeLogLikelihood = original.negativeLogLikelihood;
    130       this.targetVariable = original.targetVariable;
    131130      this.sqrSigmaNoise = original.sqrSigmaNoise;
    132131      if (original.meanParameter != null) {
     
    147146      IEnumerable<double> hyp, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction,
    148147      bool scaleInputs = true)
    149       : base() {
     148      : base(targetVariable) {
    150149      this.name = ItemName;
    151150      this.description = ItemDescription;
    152151      this.meanFunction = (IMeanFunction)meanFunction.Clone();
    153152      this.covarianceFunction = (ICovarianceFunction)covarianceFunction.Clone();
    154       this.targetVariable = targetVariable;
    155153      this.allowedInputVariables = allowedInputVariables.ToArray();
    156154
     
    182180
    183181      IEnumerable<double> y;
    184       y = ds.GetDoubleValues(targetVariable, rows);
     182      y = ds.GetDoubleValues(TargetVariable, rows);
    185183
    186184      int n = x.GetLength(0);
     
    301299
    302300    #region IRegressionModel Members
    303     public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
     301    public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
    304302      return GetEstimatedValuesHelper(dataset, rows);
    305303    }
    306     public GaussianProcessRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
     304    public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
    307305      return new GaussianProcessRegressionSolution(this, new RegressionProblemData(problemData));
    308     }
    309     IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {
    310       return CreateRegressionSolution(problemData);
    311306    }
    312307    #endregion
     
    392387      }
    393388    }
     389
    394390  }
    395391}
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/StudentTProcessModel.cs

    r13823 r13948  
    3434  [StorableClass]
    3535  [Item("StudentTProcessModel", "Represents a Student-t process posterior.")]
    36   public sealed class StudentTProcessModel : NamedItem, IGaussianProcessModel {
     36  public sealed class StudentTProcessModel : RegressionModel, IGaussianProcessModel {
     37    public override IEnumerable<string> VariablesUsedForPrediction {
     38      get { return allowedInputVariables; }
     39    }
     40
    3741    [Storable]
    3842    private double negativeLogLikelihood;
     
    6165      get { return meanFunction; }
    6266    }
    63     [Storable]
    64     private string targetVariable;
    65     public string TargetVariable {
    66       get { return targetVariable; }
    67     }
     67
    6868    [Storable]
    6969    private string[] allowedInputVariables;
     
    131131      this.trainingDataset = cloner.Clone(original.trainingDataset);
    132132      this.negativeLogLikelihood = original.negativeLogLikelihood;
    133       this.targetVariable = original.targetVariable;
    134133      if (original.meanParameter != null) {
    135134        this.meanParameter = (double[])original.meanParameter.Clone();
     
    151150      IEnumerable<double> hyp, IMeanFunction meanFunction, ICovarianceFunction covarianceFunction,
    152151      bool scaleInputs = true)
    153       : base() {
     152      : base(targetVariable) {
    154153      this.name = ItemName;
    155154      this.description = ItemDescription;
    156155      this.meanFunction = (IMeanFunction)meanFunction.Clone();
    157156      this.covarianceFunction = (ICovarianceFunction)covarianceFunction.Clone();
    158       this.targetVariable = targetVariable;
    159157      this.allowedInputVariables = allowedInputVariables.ToArray();
    160158
     
    186184
    187185      IEnumerable<double> y;
    188       y = ds.GetDoubleValues(targetVariable, rows);
     186      y = ds.GetDoubleValues(TargetVariable, rows);
    189187
    190188      int n = x.GetLength(0);
     
    318316
    319317    #region IRegressionModel Members
    320     public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
     318    public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
    321319      return GetEstimatedValuesHelper(dataset, rows);
    322320    }
    323     public GaussianProcessRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
     321    public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
    324322      return new GaussianProcessRegressionSolution(this, new RegressionProblemData(problemData));
    325     }
    326     IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {
    327       return CreateRegressionSolution(problemData);
    328323    }
    329324    #endregion
Note: See TracChangeset for help on using the changeset viewer.