Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14571 for stable


Ignore:
Timestamp:
01/14/17 19:21:44 (7 years ago)
Author:
gkronber
Message:

#2669: merged r14289 and r14290 from trunk to stable

Location:
stable
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs

    r14186 r14571  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    3435  public abstract class SymbolicClassificationModel : SymbolicDataAnalysisModel, ISymbolicClassificationModel {
    3536    [Storable]
    36     private readonly string targetVariable;
     37    private string targetVariable;
    3738    public string TargetVariable {
    3839      get { return targetVariable; }
     40      set {
     41        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
     42        targetVariable = value;
     43        OnTargetVariableChanged(this, EventArgs.Empty);
     44      }
    3945    }
    4046
    4147    [StorableConstructor]
    42     protected SymbolicClassificationModel(bool deserializing) : base(deserializing) { }
     48    protected SymbolicClassificationModel(bool deserializing)
     49      : base(deserializing) {
     50      targetVariable = string.Empty;
     51    }
    4352
    4453    protected SymbolicClassificationModel(SymbolicClassificationModel original, Cloner cloner)
     
    6473      Scale(problemData, problemData.TargetVariable);
    6574    }
     75
     76    #region events
     77    public event EventHandler TargetVariableChanged;
     78    private void OnTargetVariableChanged(object sender, EventArgs args) {
     79      var changed = TargetVariableChanged;
     80      if (changed != null)
     81        changed(sender, args);
     82    }
     83    #endregion
    6684  }
    6785}
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs

    r14186 r14571  
    3535  public class SymbolicRegressionModel : SymbolicDataAnalysisModel, ISymbolicRegressionModel {
    3636    [Storable]
    37     private readonly string targetVariable;
     37    private string targetVariable;
    3838    public string TargetVariable {
    3939      get { return targetVariable; }
     40      set {
     41        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
     42        targetVariable = value;
     43        OnTargetVariableChanged(this, EventArgs.Empty);
     44      }
    4045    }
    4146
    4247    [StorableConstructor]
    43     protected SymbolicRegressionModel(bool deserializing) : base(deserializing) { }
     48    protected SymbolicRegressionModel(bool deserializing)
     49      : base(deserializing) {
     50      targetVariable = string.Empty;
     51    }
    4452
    4553    protected SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner)
     
    7482      Scale(problemData, problemData.TargetVariable);
    7583    }
     84
     85    #region events
     86    public event EventHandler TargetVariableChanged;
     87    private void OnTargetVariableChanged(object sender, EventArgs args) {
     88      var changed = TargetVariableChanged;
     89      if (changed != null)
     90        changed(sender, args);
     91    }
     92    #endregion
    7693  }
    7794}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationModel.cs

    r14027 r14571  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    3334    public string TargetVariable {
    3435      get { return targetVariable; }
    35       protected set { targetVariable = value; }
     36      set {
     37        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
     38        targetVariable = value;
     39        OnTargetVariableChanged(this, EventArgs.Empty);
     40      }
    3641    }
    3742
    38     protected ClassificationModel(bool deserializing) : base(deserializing) { }
     43    protected ClassificationModel(bool deserializing)
     44      : base(deserializing) {
     45      targetVariable = string.Empty;
     46    }
    3947    protected ClassificationModel(ClassificationModel original, Cloner cloner)
    4048      : base(original, cloner) {
     
    5563    }
    5664
    57     [StorableHook(HookType.AfterDeserialization)]
    58     private void AfterDeserialization() {
    59       // BackwardsCompatibility3.3
    60       #region Backwards compatible code, remove with 3.4
    61       targetVariable = string.Empty;
    62       #endregion
    63     }
    64 
    6565    public abstract IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows);
    6666    public abstract IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData);
     67
     68    #region events
     69    public event EventHandler TargetVariableChanged;
     70    private void OnTargetVariableChanged(object sender, EventArgs args) {
     71      var changed = TargetVariableChanged;
     72      if (changed != null)
     73        changed(sender, args);
     74    }
     75    #endregion
    6776  }
    6877}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionBase.cs

    r14186 r14571  
    8888    [StorableHook(HookType.AfterDeserialization)]
    8989    private void AfterDeserialization() {
     90      if (string.IsNullOrEmpty(Model.TargetVariable))
     91        Model.TargetVariable = this.ProblemData.TargetVariable;
     92
    9093      if (!this.ContainsKey(TrainingNormalizedGiniCoefficientResultName))
    9194        Add(new Result(TrainingNormalizedGiniCoefficientResultName, "Normalized Gini coefficient of the model on the training partition.", new DoubleValue()));
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionModel.cs

    r14027 r14571  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    3334    public string TargetVariable {
    3435      get { return targetVariable; }
    35       protected set { targetVariable = value; }
     36      set {
     37        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
     38        targetVariable = value;
     39        OnTargetVariableChanged(this, EventArgs.Empty);
     40      }
    3641    }
    3742
    38     protected RegressionModel(bool deserializing) : base(deserializing) { }
     43    protected RegressionModel(bool deserializing)
     44      : base(deserializing) {
     45      targetVariable = string.Empty;
     46    }
    3947
    4048    protected RegressionModel(RegressionModel original, Cloner cloner)
     
    5664    }
    5765
    58     [StorableHook(HookType.AfterDeserialization)]
    59     private void AfterDeserialization() {
    60       // BackwardsCompatibility3.3
    61       #region Backwards compatible code, remove with 3.4
    62       targetVariable = string.Empty;
    63       #endregion
    64     }
    6566    public abstract IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows);
    6667    public abstract IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData);
     68
     69    #region events
     70    public event EventHandler TargetVariableChanged;
     71    private void OnTargetVariableChanged(object sender, EventArgs args) {
     72      var changed = TargetVariableChanged;
     73      if (changed != null)
     74        changed(sender, args);
     75    }
     76    #endregion
    6777  }
    6878}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs

    r14186 r14571  
    176176    [StorableHook(HookType.AfterDeserialization)]
    177177    private void AfterDeserialization() {
     178      if (string.IsNullOrEmpty(Model.TargetVariable))
     179        Model.TargetVariable = this.ProblemData.TargetVariable;
     180
    178181      // BackwardsCompatibility3.4
    179182      #region Backwards compatible code, remove with 3.5
     
    230233
    231234      double trainingR = OnlinePearsonsRCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState);
    232       TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR*trainingR : double.NaN;
     235      TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR * trainingR : double.NaN;
    233236      double testR = OnlinePearsonsRCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState);
    234       TestRSquared = errorState == OnlineCalculatorError.None ? testR*testR : double.NaN;
     237      TestRSquared = errorState == OnlineCalculatorError.None ? testR * testR : double.NaN;
    235238
    236239      double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState);
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationModel.cs

    r14327 r14571  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
     24
    2325namespace HeuristicLab.Problems.DataAnalysis {
    2426  /// <summary>
     
    2931    IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows);
    3032    IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData);
    31     string TargetVariable { get; }
     33    string TargetVariable { get; set; }
     34    event EventHandler TargetVariableChanged;
    3235  }
    3336}
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionModel.cs

    r14327 r14571  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324
     
    3031    IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows);
    3132    IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData);
    32     string TargetVariable { get; }
     33    string TargetVariable { get; set; }
     34    event EventHandler TargetVariableChanged;
    3335  }
    3436}
Note: See TracChangeset for help on using the changeset viewer.