Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/16 19:56:11 (9 years ago)
Author:
bburlacu
Message:

#2604: Revert changes to DataAnalysisSolution and IDataAnalysisSolution and implement the desired properties in model classes that implement IDataAnalysisModel, IRegressionModel and IClassificationModel.

Location:
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModel.cs

    r13157 r13921  
    5858    #endregion
    5959
     60    public string TargetVariable {
     61      get { return models.First().TargetVariable; }
     62    }
     63
     64    public IEnumerable<string> VariablesUsedForPrediction {
     65      get { return models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); }
     66    }
     67
    6068    private readonly IList<IRegressionModel> models;
    6169    public IEnumerable<IRegressionModel> Models { get { return models; } }
     
    108116      return new RegressionSolution(this, (IRegressionProblemData)problemData.Clone());
    109117    }
     118
    110119  }
    111120}
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesModelSurrogate.cs

    r13157 r13921  
    2222
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    5455    private int maxSize;
    5556
     57    public string TargetVariable {
     58      get { return trainingProblemData.TargetVariable; }
     59    }
     60
     61    public IEnumerable<string> VariablesUsedForPrediction {
     62      get { return actualModel.Models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); }
     63    }
    5664
    5765    [StorableConstructor]
     
    7381
    7482    // create only the surrogate model without an actual model
    75     public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu)
     83    public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed,
     84      ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu)
    7685      : base("Gradient boosted tree model", string.Empty) {
    7786      this.trainingProblemData = trainingProblemData;
     
    8695
    8796    // wrap an actual model in a surrograte
    88     public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed, ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu, IGradientBoostedTreesModel model)
     97    public GradientBoostedTreesModelSurrogate(IRegressionProblemData trainingProblemData, uint seed,
     98      ILossFunction lossFunction, int iterations, int maxSize, double r, double m, double nu,
     99      IGradientBoostedTreesModel model)
    89100      : this(trainingProblemData, seed, lossFunction, iterations, maxSize, r, m, nu) {
    90101      this.actualModel = model;
     
    104115      return new RegressionSolution(this, (IRegressionProblemData)problemData.Clone());
    105116    }
    106 
    107117
    108118    private IGradientBoostedTreesModel RecalculateModel() {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs

    r13895 r13921  
    3535  [Item("RegressionTreeModel", "Represents a decision tree for regression.")]
    3636  public sealed class RegressionTreeModel : NamedItem, IRegressionModel {
     37    public IEnumerable<string> VariablesUsedForPrediction {
     38      get { return Enumerable.Empty<string>(); }
     39    }
     40
     41    public string TargetVariable {
     42      get { return string.Empty; }
     43    }
    3744
    3845    // trees are represented as a flat array   
Note: See TracChangeset for help on using the changeset viewer.