Free cookie consent management tool by TermsFeed Policy Generator

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

#2669: merged r14289 and r14290 from trunk to stable

Location:
stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis

  • 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()));
Note: See TracChangeset for help on using the changeset viewer.