Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/01/11 12:04:53 (14 years ago)
Author:
mkommend
Message:

#1418: worked on data analysis problem representation.

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4
Files:
6 edited
1 copied

Legend:

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

    r5561 r5577  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2523using HeuristicLab.Common;
    2624using HeuristicLab.Core;
    27 using HeuristicLab.Data;
     25using HeuristicLab.Parameters;
    2826using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Optimization;
    30 using HeuristicLab.Parameters;
    3127
    3228namespace HeuristicLab.Problems.DataAnalysis {
    3329  [StorableClass]
    34   [Item("RegressionProblem", "")]
     30  [Item("ClassificationProblem", "")]
    3531  [Creatable]
    36   public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>,
    37     IRegressionProblem {
     32  public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>,
     33    IClassificationProblem {
    3834    private const string ProblemDataParameterName = "ProblemData";
    39     #region properties
    40     public new IDataAnalysisEvaluator<IRegressionProblemData> Evaluator {
    41       get { throw new NotImplementedException(); }
    42     }
    43 
    44     public new IRegressionSolutionCreator SolutionCreator {
    45       get { throw new NotImplementedException(); }
    46     }
    47     IDataAnalysisSolutionCreator<IRegressionProblemData> IDataAnalysisProblem<IRegressionProblemData>.SolutionCreator {
    48       get { throw new NotImplementedException(); }
    49     }
    50     #endregion
    51 
    52     public RegressionProblem(RegressionProblem original, Cloner cloner)
     35    public ClassificationProblem(ClassificationProblem original, Cloner cloner)
    5336      : base(original, cloner) {
    5437      RegisterEventHandlers();
    5538    }
    5639    [StorableConstructor]
    57     public RegressionProblem(bool deserializing) : base(deserializing) { }
    58     public RegressionProblem()
     40    public ClassificationProblem(bool deserializing) : base(deserializing) { }
     41    public ClassificationProblem()
    5942      : base() {
    60       Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "", new RegressionProblemData()));
     43      Parameters.Add(new ValueParameter<IClassificationProblemData>(ProblemDataParameterName, "", new ClassificationProblemData()));
    6144      RegisterEventHandlers();
    6245    }
     
    6851
    6952    public override IDeepCloneable Clone(Cloner cloner) {
    70       return new RegressionProblem(this, cloner);
     53      return new ClassificationProblem(this, cloner);
    7154    }
    7255
     
    7760    #region event propagation
    7861    private void Value_Changed(object sender, EventArgs e) {
    79       OnReset();
     62      //OnReset();
    8063    }
    8164    #endregion
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblem.cs

    r5554 r5577  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HeuristicLab.Optimization;
     25using HeuristicLab.Parameters;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627
    2728namespace HeuristicLab.Problems.DataAnalysis {
    2829  [StorableClass]
    29   public abstract class DataAnalysisProblem<T> : Problem<IDataAnalysisEvaluator<T>, IDataAnalysisSolutionCreator<T>>,
     30  public abstract class DataAnalysisProblem<T> : ParameterizedNamedItem,
    3031    IDataAnalysisProblem<T>
    3132    where T : class, IDataAnalysisProblemData {
    3233    private const string ProblemDataParameterName = "ProblemData";
     34    private const string ProblemDataParameterDescription = "";
    3335    #region parameter properties
    3436    IParameter IDataAnalysisProblem.ProblemDataParameter {
     
    5456    public DataAnalysisProblem()
    5557      : base() {
     58      Parameters.Add(new ValueParameter<T>(ProblemDataParameterName, ProblemDataParameterDescription));
     59    }
     60
     61    private void RegisterEventHandlers() {
     62      ProblemDataParameter.Value.Changed += new EventHandler(ProblemDataParameter_ValueChanged);
     63    }
     64    private void ProblemDataParameter_ValueChanged(object sender, EventArgs e) {
     65      OnProblemDataChanged();
     66      OnReset();
     67    }
     68
     69    public event EventHandler ProblemDataChanged;
     70    protected virtual void OnProblemDataChanged() {
     71      var handler = ProblemDataChanged;
     72      if (handler != null) handler(this, EventArgs.Empty);
     73    }
     74
     75    public event EventHandler Reset;
     76    protected virtual void OnReset() {
     77      var handler = Reset;
     78      if (handler != null) handler(this, EventArgs.Empty);
    5679    }
    5780  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r5559 r5577  
    109109  <ItemGroup>
    110110    <Compile Include="ClassificationProblemData.cs" />
     111    <Compile Include="ClassificationProblem.cs" />
    111112    <Compile Include="RegressionProblemData.cs" />
    112113    <Compile Include="DataAnalysisProblemData.cs" />
     
    114115    <Compile Include="DataAnalysisProblem.cs" />
    115116    <Compile Include="Dataset.cs" />
    116     <Compile Include="Interfaces\Classification\IClassificationEvaluator.cs" />
    117117    <Compile Include="Interfaces\Classification\IClassificationModel.cs" />
    118118    <Compile Include="Interfaces\Classification\IClassificationProblem.cs" />
    119119    <Compile Include="Interfaces\Classification\IClassificationProblemData.cs" />
    120120    <Compile Include="Interfaces\Classification\IClassificationSolution.cs" />
    121     <Compile Include="Interfaces\Classification\IClassificationSolutionCreator.cs" />
    122     <Compile Include="Interfaces\IDataAnalysisEvaluator.cs" />
    123121    <Compile Include="Interfaces\IDataAnalysisProblemData.cs" />
    124122    <Compile Include="Interfaces\IDataAnalysisSolution.cs" />
    125     <Compile Include="Interfaces\IDataAnalysisSolutionCreator.cs" />
    126123    <Compile Include="Interfaces\IOnlineEvaluator.cs" />
    127     <Compile Include="Interfaces\Regression\IRegressionEvaluator.cs" />
    128124    <Compile Include="Interfaces\Regression\IRegressionModel.cs" />
    129125    <Compile Include="Interfaces\Regression\IRegressionProblem.cs" />
    130126    <Compile Include="Interfaces\Regression\IRegressionProblemData.cs" />
    131127    <Compile Include="Interfaces\Regression\IRegressionSolution.cs" />
    132     <Compile Include="Interfaces\Regression\IRegressionSolutionCreator.cs" />
    133128    <Compile Include="OnlineEvaluators\OnlineCovarianceEvaluator.cs" />
    134129    <Compile Include="OnlineEvaluators\OnlineMeanAbsolutePercentageErrorEvaluator.cs" />
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblem.cs

    r5509 r5577  
    2222namespace HeuristicLab.Problems.DataAnalysis {
    2323  public interface IClassificationProblem : IDataAnalysisProblem<IClassificationProblemData> {
    24     new IClassificationSolutionCreator SolutionCreator { get; }
    2524  }
    2625}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblem.cs

    r5554 r5577  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Optimization;
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis {
    26   public interface IDataAnalysisProblem : IProblem {
     26  public interface IDataAnalysisProblem : IItem {
    2727    IParameter ProblemDataParameter { get; }
    2828    IDataAnalysisProblemData ProblemData { get; }
     29    event EventHandler ProblemDataChanged;
    2930  }
    3031
     
    3334    new IValueParameter<T> ProblemDataParameter { get; }
    3435    new T ProblemData { get; }
    35     new IDataAnalysisEvaluator<T> Evaluator { get; }
    36     new IDataAnalysisSolutionCreator<T> SolutionCreator { get; }
    3736  }
    3837}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblem.cs

    r5509 r5577  
    2222namespace HeuristicLab.Problems.DataAnalysis {
    2323  public interface IRegressionProblem : IDataAnalysisProblem<IRegressionProblemData> {
    24     new IRegressionSolutionCreator SolutionCreator { get; }
    2524  }
    2625}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblem.cs

    r5540 r5577  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2522using HeuristicLab.Common;
    2623using HeuristicLab.Core;
    27 using HeuristicLab.Data;
    2824using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Optimization;
    30 using HeuristicLab.Parameters;
    3125
    3226namespace HeuristicLab.Problems.DataAnalysis {
     
    3630  public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>,
    3731    IRegressionProblem {
    38     private const string ProblemDataParameterName = "ProblemData";
    39     #region properties
    40     public new IDataAnalysisEvaluator<IRegressionProblemData> Evaluator {
    41       get { throw new NotImplementedException(); }
    42     }
    43 
    44     public new IRegressionSolutionCreator SolutionCreator {
    45       get { throw new NotImplementedException(); }
    46     }
    47     IDataAnalysisSolutionCreator<IRegressionProblemData> IDataAnalysisProblem<IRegressionProblemData>.SolutionCreator {
    48       get { throw new NotImplementedException(); }
    49     }
    50     #endregion
    51 
    5232    public RegressionProblem(RegressionProblem original, Cloner cloner)
    5333      : base(original, cloner) {
    54       RegisterEventHandlers();
    5534    }
    5635    [StorableConstructor]
     
    5837    public RegressionProblem()
    5938      : base() {
    60       Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "", new RegressionProblemData()));
    61       RegisterEventHandlers();
    6239    }
    6340
    6441    [StorableHook(HookType.AfterDeserialization)]
    6542    private void AfterDeserialization() {
    66       RegisterEventHandlers();
    6743    }
    6844
     
    7046      return new RegressionProblem(this, cloner);
    7147    }
    72 
    73     private void RegisterEventHandlers() {
    74       ProblemDataParameter.Value.Changed += new EventHandler(Value_Changed);
    75     }
    76 
    77     #region event propagation
    78     private void Value_Changed(object sender, EventArgs e) {
    79       OnReset();
    80     }
    81     #endregion
    8248  }
    8349}
Note: See TracChangeset for help on using the changeset viewer.