Changeset 5685 for branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Timestamp:
- 03/15/11 12:35:14 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj
r5649 r5685 109 109 <ItemGroup> 110 110 <Compile Include="Interfaces\ISymbolicDiscriminantFunctionClassificationModel.cs" /> 111 <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" /> 112 <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs" /> 111 113 <Compile Include="SymbolicDiscriminantFunctionClassificationModel.cs" /> 112 114 <Compile Include="SymbolicDiscriminantFunctionClassificationSolution.cs" /> -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r5623 r5685 24 24 using HeuristicLab.Data; 25 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 using HeuristicLab.Parameters; 26 27 27 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 32 public class SymbolicClassificationMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IClassificationProblemData, ISymbolicClassificationMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator> { 32 33 private const double PunishmentFactor = 10; 34 private const int InitialMaximumTreeDepth = 8; 35 private const int InitialMaximumTreeLength = 25; 36 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 37 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 38 private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic classification model."; 39 private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic classification model."; 33 40 41 #region parameter properties 42 public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter { 43 get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 44 } 45 public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 47 } 48 #endregion 49 #region properties 50 public DoubleValue LowerEstimationLimit { 51 get { return LowerEstimationLimitParameter.Value; } 52 } 53 public DoubleValue UpperEstimationLimit { 54 get { return UpperEstimationLimitParameter.Value; } 55 } 56 #endregion 34 57 [StorableConstructor] 35 58 protected SymbolicClassificationMultiObjectiveProblem(bool deserializing) : base(deserializing) { } … … 39 62 public SymbolicClassificationMultiObjectiveProblem() 40 63 : base(new ClassificationProblemData(), new SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) { 64 Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue())); 65 Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue())); 66 41 67 Maximization = new BoolArray(new bool[] { false, false }); 42 MaximumSymbolicExpressionTreeDepth.Value = 8; 43 MaximumSymbolicExpressionTreeLength.Value = 25; 68 MaximumSymbolicExpressionTreeDepth.Value = InitialMaximumTreeDepth; 69 MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength; 70 71 InitializeOperators(); 44 72 } 45 73 46 protected override void UpdateEstimationLimits() { 74 private void InitializeOperators() { 75 Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer()); 76 Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer()); 77 ParameterizeOperators(); 78 } 79 80 private void UpdateEstimationLimits() { 47 81 if (ProblemData.TrainingPartitionStart.Value < ProblemData.TrainingPartitionEnd.Value) { 48 82 var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartitionStart.Value, ProblemData.TrainingPartitionEnd.Value); … … 54 88 } 55 89 90 protected override void OnProblemDataChanged() { 91 base.OnProblemDataChanged(); 92 UpdateEstimationLimits(); 93 } 94 95 protected new void ParameterizeOperators() { 96 base.ParameterizeOperators(); 97 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 98 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedEvaluator<IClassificationProblemData>>()) { 99 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 100 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; 101 } 102 } 103 56 104 public override void ImportProblemDataFromFile(string fileName) { 57 105 ClassificationProblemData problemData = ClassificationProblemData.ImportFromFile(fileName); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs
r5681 r5685 63 63 : base() { 64 64 Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution.")); 65 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 65 66 } 66 67 public override IDeepCloneable Clone(Cloner cloner) { … … 77 78 var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds); 78 79 return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData); 79 } 80 } 80 81 } 81 82 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r5623 r5685 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Parameters; 26 using HeuristicLab.Data; 25 27 26 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 30 32 public class SymbolicClassificationSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IClassificationProblemData, ISymbolicClassificationSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator> { 31 33 private const double PunishmentFactor = 10; 34 private const int InitialMaximumTreeDepth = 8; 35 private const int InitialMaximumTreeLength = 25; 36 private const string LowerEstimationLimitParameterName = "LowerEstimationLimit"; 37 private const string UpperEstimationLimitParameterName = "UpperEstimationLimit"; 38 private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic classification model."; 39 private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic classification model."; 32 40 41 #region parameter properties 42 public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter { 43 get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; } 44 } 45 public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter { 46 get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; } 47 } 48 #endregion 49 #region properties 50 public DoubleValue LowerEstimationLimit { 51 get { return LowerEstimationLimitParameter.Value; } 52 } 53 public DoubleValue UpperEstimationLimit { 54 get { return UpperEstimationLimitParameter.Value; } 55 } 56 #endregion 33 57 [StorableConstructor] 34 58 protected SymbolicClassificationSingleObjectiveProblem(bool deserializing) : base(deserializing) { } … … 38 62 public SymbolicClassificationSingleObjectiveProblem() 39 63 : base(new ClassificationProblemData(), new SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) { 40 MaximumSymbolicExpressionTreeDepth.Value = 8; 41 MaximumSymbolicExpressionTreeLength.Value = 25; 64 Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue())); 65 Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue())); 66 67 MaximumSymbolicExpressionTreeDepth.Value = InitialMaximumTreeDepth; 68 MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength; 69 70 InitializeOperators(); 42 71 } 43 72 44 protected override void UpdateEstimationLimits() { 73 private void InitializeOperators() { 74 Operators.Add(new SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer()); 75 Operators.Add(new SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer()); 76 ParameterizeOperators(); 77 } 78 79 private void UpdateEstimationLimits() { 45 80 if (ProblemData.TrainingPartitionStart.Value < ProblemData.TrainingPartitionEnd.Value) { 46 81 var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartitionStart.Value, ProblemData.TrainingPartitionEnd.Value); … … 52 87 } 53 88 89 protected override void OnProblemDataChanged() { 90 base.OnProblemDataChanged(); 91 UpdateEstimationLimits(); 92 } 93 94 protected override void ParameterizeOperators() { 95 base.ParameterizeOperators(); 96 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 97 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedEvaluator<IClassificationProblemData>>()) { 98 op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName; 99 op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName; 100 } 101 } 102 54 103 public override void ImportProblemDataFromFile(string fileName) { 55 104 ClassificationProblemData problemData = ClassificationProblemData.ImportFromFile(fileName); -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs
r5681 r5685 62 62 public SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer() 63 63 : base() { 64 Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution.")); 65 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 64 66 } 65 67 public override IDeepCloneable Clone(Cloner cloner) {
Note: See TracChangeset
for help on using the changeset viewer.