Changeset 8915 for branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
- Timestamp:
- 11/15/12 16:47:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r8175 r8915 35 35 private const string EstimationLimitsParameterName = "EstimationLimits"; 36 36 private const string EstimationLimitsParameterDescription = "The lower and upper limit for the estimated value that can be returned by the symbolic classification model."; 37 private const string ModelCreatorParameterName = "ModelCreator"; 37 38 38 39 #region parameter properties … … 40 41 get { return (IFixedValueParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 41 42 } 43 public IValueParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter { 44 get { return (IValueParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; } 45 } 42 46 #endregion 43 47 #region properties 44 48 public DoubleLimit EstimationLimits { 45 49 get { return EstimationLimitsParameter.Value; } 50 } 51 public ISymbolicClassificationModelCreator ModelCreator { 52 get { return ModelCreatorParameter.Value; } 46 53 } 47 54 #endregion … … 57 64 : base(new ClassificationProblemData(), new SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) { 58 65 Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription)); 66 Parameters.Add(new ValueParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName, "", new AccuracyMaximizingThresholdsModelCreator())); 59 67 68 ApplyLinearScalingParameter.Value.Value = false; 60 69 EstimationLimitsParameter.Hidden = true; 61 70 … … 71 80 [StorableHook(HookType.AfterDeserialization)] 72 81 private void AfterDeserialization() { 73 RegisterEventHandlers(); 74 // compatibility 82 // BackwardsCompatibility3.4 83 #region Backwards compatible code, remove with 3.5 84 if (!Parameters.ContainsKey(ModelCreatorParameterName)) 85 Parameters.Add(new ValueParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName, "", new AccuracyMaximizingThresholdsModelCreator())); 86 75 87 bool changed = false; 76 88 if (!Operators.OfType<SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer>().Any()) { … … 83 95 } 84 96 if (changed) ParameterizeOperators(); 97 #endregion 98 RegisterEventHandlers(); 85 99 } 86 100 87 101 private void RegisterEventHandlers() { 88 102 SymbolicExpressionTreeGrammarParameter.ValueChanged += (o, e) => ConfigureGrammarSymbols(); 103 ModelCreatorParameter.NameChanged += (o, e) => ParameterizeOperators(); 89 104 } 90 105 … … 125 140 if (Parameters.ContainsKey(EstimationLimitsParameterName)) { 126 141 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators); 127 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) {142 foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedOperator>()) 128 143 op.EstimationLimitsParameter.ActualName = EstimationLimitsParameter.Name; 129 } 144 foreach (var op in operators.OfType<ISymbolicClassificationModelCreatorOperator>()) 145 op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name; 130 146 } 131 147 }
Note: See TracChangeset
for help on using the changeset viewer.