- Timestamp:
- 03/01/11 12:04:53 (14 years ago)
- 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 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Core; 27 using HeuristicLab. Data;25 using HeuristicLab.Parameters; 28 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Optimization;30 using HeuristicLab.Parameters;31 27 32 28 namespace HeuristicLab.Problems.DataAnalysis { 33 29 [StorableClass] 34 [Item(" RegressionProblem", "")]30 [Item("ClassificationProblem", "")] 35 31 [Creatable] 36 public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>,37 I RegressionProblem {32 public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>, 33 IClassificationProblem { 38 34 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) 53 36 : base(original, cloner) { 54 37 RegisterEventHandlers(); 55 38 } 56 39 [StorableConstructor] 57 public RegressionProblem(bool deserializing) : base(deserializing) { }58 public RegressionProblem()40 public ClassificationProblem(bool deserializing) : base(deserializing) { } 41 public ClassificationProblem() 59 42 : base() { 60 Parameters.Add(new ValueParameter<I RegressionProblemData>(ProblemDataParameterName, "", new RegressionProblemData()));43 Parameters.Add(new ValueParameter<IClassificationProblemData>(ProblemDataParameterName, "", new ClassificationProblemData())); 61 44 RegisterEventHandlers(); 62 45 } … … 68 51 69 52 public override IDeepCloneable Clone(Cloner cloner) { 70 return new RegressionProblem(this, cloner);53 return new ClassificationProblem(this, cloner); 71 54 } 72 55 … … 77 60 #region event propagation 78 61 private void Value_Changed(object sender, EventArgs e) { 79 OnReset();62 //OnReset(); 80 63 } 81 64 #endregion -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblem.cs
r5554 r5577 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HeuristicLab. Optimization;25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 27 28 namespace HeuristicLab.Problems.DataAnalysis { 28 29 [StorableClass] 29 public abstract class DataAnalysisProblem<T> : P roblem<IDataAnalysisEvaluator<T>, IDataAnalysisSolutionCreator<T>>,30 public abstract class DataAnalysisProblem<T> : ParameterizedNamedItem, 30 31 IDataAnalysisProblem<T> 31 32 where T : class, IDataAnalysisProblemData { 32 33 private const string ProblemDataParameterName = "ProblemData"; 34 private const string ProblemDataParameterDescription = ""; 33 35 #region parameter properties 34 36 IParameter IDataAnalysisProblem.ProblemDataParameter { … … 54 56 public DataAnalysisProblem() 55 57 : 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); 56 79 } 57 80 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r5559 r5577 109 109 <ItemGroup> 110 110 <Compile Include="ClassificationProblemData.cs" /> 111 <Compile Include="ClassificationProblem.cs" /> 111 112 <Compile Include="RegressionProblemData.cs" /> 112 113 <Compile Include="DataAnalysisProblemData.cs" /> … … 114 115 <Compile Include="DataAnalysisProblem.cs" /> 115 116 <Compile Include="Dataset.cs" /> 116 <Compile Include="Interfaces\Classification\IClassificationEvaluator.cs" />117 117 <Compile Include="Interfaces\Classification\IClassificationModel.cs" /> 118 118 <Compile Include="Interfaces\Classification\IClassificationProblem.cs" /> 119 119 <Compile Include="Interfaces\Classification\IClassificationProblemData.cs" /> 120 120 <Compile Include="Interfaces\Classification\IClassificationSolution.cs" /> 121 <Compile Include="Interfaces\Classification\IClassificationSolutionCreator.cs" />122 <Compile Include="Interfaces\IDataAnalysisEvaluator.cs" />123 121 <Compile Include="Interfaces\IDataAnalysisProblemData.cs" /> 124 122 <Compile Include="Interfaces\IDataAnalysisSolution.cs" /> 125 <Compile Include="Interfaces\IDataAnalysisSolutionCreator.cs" />126 123 <Compile Include="Interfaces\IOnlineEvaluator.cs" /> 127 <Compile Include="Interfaces\Regression\IRegressionEvaluator.cs" />128 124 <Compile Include="Interfaces\Regression\IRegressionModel.cs" /> 129 125 <Compile Include="Interfaces\Regression\IRegressionProblem.cs" /> 130 126 <Compile Include="Interfaces\Regression\IRegressionProblemData.cs" /> 131 127 <Compile Include="Interfaces\Regression\IRegressionSolution.cs" /> 132 <Compile Include="Interfaces\Regression\IRegressionSolutionCreator.cs" />133 128 <Compile Include="OnlineEvaluators\OnlineCovarianceEvaluator.cs" /> 134 129 <Compile Include="OnlineEvaluators\OnlineMeanAbsolutePercentageErrorEvaluator.cs" /> -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationProblem.cs
r5509 r5577 22 22 namespace HeuristicLab.Problems.DataAnalysis { 23 23 public interface IClassificationProblem : IDataAnalysisProblem<IClassificationProblemData> { 24 new IClassificationSolutionCreator SolutionCreator { get; }25 24 } 26 25 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblem.cs
r5554 r5577 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Core; 23 using HeuristicLab.Optimization;24 24 25 25 namespace HeuristicLab.Problems.DataAnalysis { 26 public interface IDataAnalysisProblem : I Problem {26 public interface IDataAnalysisProblem : IItem { 27 27 IParameter ProblemDataParameter { get; } 28 28 IDataAnalysisProblemData ProblemData { get; } 29 event EventHandler ProblemDataChanged; 29 30 } 30 31 … … 33 34 new IValueParameter<T> ProblemDataParameter { get; } 34 35 new T ProblemData { get; } 35 new IDataAnalysisEvaluator<T> Evaluator { get; }36 new IDataAnalysisSolutionCreator<T> SolutionCreator { get; }37 36 } 38 37 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblem.cs
r5509 r5577 22 22 namespace HeuristicLab.Problems.DataAnalysis { 23 23 public interface IRegressionProblem : IDataAnalysisProblem<IRegressionProblemData> { 24 new IRegressionSolutionCreator SolutionCreator { get; }25 24 } 26 25 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblem.cs
r5540 r5577 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 22 using HeuristicLab.Common; 26 23 using HeuristicLab.Core; 27 using HeuristicLab.Data;28 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Optimization;30 using HeuristicLab.Parameters;31 25 32 26 namespace HeuristicLab.Problems.DataAnalysis { … … 36 30 public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>, 37 31 IRegressionProblem { 38 private const string ProblemDataParameterName = "ProblemData";39 #region properties40 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 #endregion51 52 32 public RegressionProblem(RegressionProblem original, Cloner cloner) 53 33 : base(original, cloner) { 54 RegisterEventHandlers();55 34 } 56 35 [StorableConstructor] … … 58 37 public RegressionProblem() 59 38 : base() { 60 Parameters.Add(new ValueParameter<IRegressionProblemData>(ProblemDataParameterName, "", new RegressionProblemData()));61 RegisterEventHandlers();62 39 } 63 40 64 41 [StorableHook(HookType.AfterDeserialization)] 65 42 private void AfterDeserialization() { 66 RegisterEventHandlers();67 43 } 68 44 … … 70 46 return new RegressionProblem(this, cloner); 71 47 } 72 73 private void RegisterEventHandlers() {74 ProblemDataParameter.Value.Changed += new EventHandler(Value_Changed);75 }76 77 #region event propagation78 private void Value_Changed(object sender, EventArgs e) {79 OnReset();80 }81 #endregion82 48 } 83 49 }
Note: See TracChangeset
for help on using the changeset viewer.