Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/16 19:56:11 (8 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.Problems.DataAnalysis/3.4/Implementation/Regression
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConstantRegressionModel.cs

    r13100 r13921  
    3333  [Obsolete]
    3434  public class ConstantRegressionModel : NamedItem, IRegressionModel, IStringConvertibleValue {
     35    public IEnumerable<string> VariablesUsedForPrediction { get { return Enumerable.Empty<string>(); } }
     36
     37    [Storable]
     38    private readonly string targetVariable;
     39    public string TargetVariable {
     40      get { return targetVariable; }
     41    }
     42
    3543    [Storable]
    3644    private double constant;
     
    4553      : base(original, cloner) {
    4654      this.constant = original.constant;
     55      this.targetVariable = original.targetVariable;
    4756    }
     57
    4858    public override IDeepCloneable Clone(Cloner cloner) { return new ConstantRegressionModel(this, cloner); }
    4959
    50     public ConstantRegressionModel(double constant)
     60    public ConstantRegressionModel(double constant, string targetVariable = "Target")
    5161      : base() {
    5262      this.name = ItemName;
     
    5464      this.constant = constant;
    5565      this.ReadOnly = true; // changing a constant regression model is not supported
     66      this.targetVariable = targetVariable;
    5667    }
    5768
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs

    r13715 r13921  
    3434  [Item("RegressionEnsembleModel", "A regression model that contains an ensemble of multiple regression models")]
    3535  public sealed class RegressionEnsembleModel : NamedItem, IRegressionEnsembleModel {
     36    public IEnumerable<string> VariablesUsedForPrediction {
     37      get { return models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); }
     38    }
    3639
    3740    private List<IRegressionModel> models;
    3841    public IEnumerable<IRegressionModel> Models {
    3942      get { return new List<IRegressionModel>(models); }
     43    }
     44
     45    [Storable]
     46    private readonly string target;
     47    public string TargetVariable {
     48      get { return models.First().TargetVariable; }
    4049    }
    4150
Note: See TracChangeset for help on using the changeset viewer.