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
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationEnsembleModel.cs

    r12509 r13921  
    3333  [Item("ClassificationEnsembleModel", "A classification model that contains an ensemble of multiple classification models")]
    3434  public class ClassificationEnsembleModel : NamedItem, IClassificationEnsembleModel {
     35    public IEnumerable<string> VariablesUsedForPrediction {
     36      get { return models.SelectMany(x => x.VariablesUsedForPrediction).Distinct().OrderBy(x => x); }
     37    }
     38
     39    public string TargetVariable {
     40      get { return models.First().TargetVariable; }
     41    }
    3542
    3643    [Storable]
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationModel.cs

    r12509 r13921  
    3434  [Item("DiscriminantFunctionClassificationModel", "Represents a classification model that uses a discriminant function and classification thresholds.")]
    3535  public class DiscriminantFunctionClassificationModel : NamedItem, IDiscriminantFunctionClassificationModel {
     36    public IEnumerable<string> VariablesUsedForPrediction {
     37      get { return model.VariablesUsedForPrediction; }
     38    }
     39
     40    public string TargetVariable { get { return model.TargetVariable; } }
     41
    3642    [Storable]
    3743    private IRegressionModel model;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/ConstantModel.cs

    r13154 r13921  
    3232  [Item("Constant Model", "A model that always returns the same constant value regardless of the presented input data.")]
    3333  public class ConstantModel : NamedItem, IRegressionModel, IClassificationModel, ITimeSeriesPrognosisModel, IStringConvertibleValue {
     34    public IEnumerable<string> VariablesUsedForPrediction { get { return Enumerable.Empty<string>(); } }
     35
    3436    [Storable]
    35     private double constant;
     37    private readonly string targetVariable;
     38    public string TargetVariable {
     39      get { return targetVariable; }
     40    }
     41
     42    [Storable]
     43    private readonly double constant;
    3644    public double Constant {
    3745      get { return constant; }
     
    4452      : base(original, cloner) {
    4553      this.constant = original.constant;
     54      this.targetVariable = original.targetVariable;
    4655    }
     56
    4757    public override IDeepCloneable Clone(Cloner cloner) { return new ConstantModel(this, cloner); }
    4858
    49     public ConstantModel(double constant)
     59    public ConstantModel(double constant, string targetVariable = "Target")
    5060      : base() {
    5161      this.name = ItemName;
     
    5363      this.constant = constant;
    5464      this.ReadOnly = true; // changing a constant regression model is not supported
     65      this.targetVariable = targetVariable;
    5566    }
    5667
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisSolution.cs

    r13826 r13921  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    111111    protected override void DeregisterItemEvents(IEnumerable<IResult> items) { }
    112112
    113     public virtual IEnumerable<string> GetUsedVariablesForPrediction() {
    114       return this.ProblemData.AllowedInputVariables;
    115     }
    116 
    117113    #region INamedItem Members
    118114    [Storable]
  • 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
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/Models/TimeSeriesPrognosisAutoRegressiveModel.cs

    r12509 r13921  
    3131  [Item("Autoregressive TimeSeries Model", "A linear autoregressive time series model used to predict future values.")]
    3232  public class TimeSeriesPrognosisAutoRegressiveModel : NamedItem, ITimeSeriesPrognosisModel {
     33    public IEnumerable<string> VariablesUsedForPrediction {
     34      get { return Enumerable.Empty<string>(); } // what to return here?
     35    }
     36
    3337    [Storable]
    3438    public double[] Phi { get; private set; }
Note: See TracChangeset for help on using the changeset viewer.