Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5579


Ignore:
Timestamp:
03/01/11 14:42:45 (14 years ago)
Author:
mkommend
Message:

#1418: Adapted new ProblemData classes.

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblem.cs

    r5577 r5579  
    2020#endregion
    2121
    22 using System;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
    25 using HeuristicLab.Parameters;
    2624using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2725
     
    3028  [Item("ClassificationProblem", "")]
    3129  [Creatable]
    32   public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>,
    33     IClassificationProblem {
    34     private const string ProblemDataParameterName = "ProblemData";
    35     public ClassificationProblem(ClassificationProblem original, Cloner cloner)
    36       : base(original, cloner) {
    37       RegisterEventHandlers();
    38     }
     30  public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>, IClassificationProblem {
    3931    [StorableConstructor]
    4032    public ClassificationProblem(bool deserializing) : base(deserializing) { }
     33    public ClassificationProblem(ClassificationProblem original, Cloner cloner) : base(original, cloner) { }
     34    public override IDeepCloneable Clone(Cloner cloner) { return new ClassificationProblem(this, cloner); }
     35
    4136    public ClassificationProblem()
    4237      : base() {
    43       Parameters.Add(new ValueParameter<IClassificationProblemData>(ProblemDataParameterName, "", new ClassificationProblemData()));
    44       RegisterEventHandlers();
     38      ProblemData = new ClassificationProblemData();
    4539    }
    46 
    47     [StorableHook(HookType.AfterDeserialization)]
    48     private void AfterDeserialization() {
    49       RegisterEventHandlers();
    50     }
    51 
    52     public override IDeepCloneable Clone(Cloner cloner) {
    53       return new ClassificationProblem(this, cloner);
    54     }
    55 
    56     private void RegisterEventHandlers() {
    57       ProblemDataParameter.Value.Changed += new EventHandler(Value_Changed);
    58     }
    59 
    60     #region event propagation
    61     private void Value_Changed(object sender, EventArgs e) {
    62       //OnReset();
    63     }
    64     #endregion
    6540  }
    6641}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblemData.cs

    r5559 r5579  
    288288    public void SetClassificationPenalty(double correctClassValue, double estimatedClassValue, double penalty) {
    289289      var key = Tuple.Create(correctClassValue, estimatedClassValue);
    290       if (misclassificationMatrix[key] != penalty) {
     290      if (!misclassificationMatrix.ContainsKey(key) || misclassificationMatrix[key] != penalty) {
    291291        misclassificationMatrix[key] = penalty;
    292292        OnClassificationPenaltyChanged();
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblem.cs

    r5577 r5579  
    2828  [Item("RegressionProblem", "")]
    2929  [Creatable]
    30   public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>,
    31     IRegressionProblem {
    32     public RegressionProblem(RegressionProblem original, Cloner cloner)
    33       : base(original, cloner) {
    34     }
     30  public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IRegressionProblem {
    3531    [StorableConstructor]
    3632    public RegressionProblem(bool deserializing) : base(deserializing) { }
     33    public RegressionProblem(RegressionProblem original, Cloner cloner) : base(original, cloner) { }
     34    public override IDeepCloneable Clone(Cloner cloner) { return new RegressionProblem(this, cloner); }
     35
    3736    public RegressionProblem()
    3837      : base() {
    39     }
    40 
    41     [StorableHook(HookType.AfterDeserialization)]
    42     private void AfterDeserialization() {
    43     }
    44 
    45     public override IDeepCloneable Clone(Cloner cloner) {
    46       return new RegressionProblem(this, cloner);
     38      ProblemData = new RegressionProblemData();
    4739    }
    4840  }
Note: See TracChangeset for help on using the changeset viewer.