Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/15/12 16:47:25 (11 years ago)
Author:
mkommend
Message:

#1763: merged changes from trunk into the tree simplifier branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs

    r8175 r8915  
    3535    private const string EstimationLimitsParameterName = "EstimationLimits";
    3636    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";
    3738
    3839    #region parameter properties
     
    4041      get { return (IFixedValueParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    4142    }
     43    public IValueParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter {
     44      get { return (IValueParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
     45    }
    4246    #endregion
    4347    #region properties
    4448    public DoubleLimit EstimationLimits {
    4549      get { return EstimationLimitsParameter.Value; }
     50    }
     51    public ISymbolicClassificationModelCreator ModelCreator {
     52      get { return ModelCreatorParameter.Value; }
    4653    }
    4754    #endregion
     
    5764      : base(new ClassificationProblemData(), new SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
    5865      Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription));
     66      Parameters.Add(new ValueParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName, "", new AccuracyMaximizingThresholdsModelCreator()));
    5967
     68      ApplyLinearScalingParameter.Value.Value = false;
    6069      EstimationLimitsParameter.Hidden = true;
    6170
     
    7180    [StorableHook(HookType.AfterDeserialization)]
    7281    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
    7587      bool changed = false;
    7688      if (!Operators.OfType<SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer>().Any()) {
     
    8395      }
    8496      if (changed) ParameterizeOperators();
     97      #endregion
     98      RegisterEventHandlers();
    8599    }
    86100
    87101    private void RegisterEventHandlers() {
    88102      SymbolicExpressionTreeGrammarParameter.ValueChanged += (o, e) => ConfigureGrammarSymbols();
     103      ModelCreatorParameter.NameChanged += (o, e) => ParameterizeOperators();
    89104    }
    90105
     
    125140      if (Parameters.ContainsKey(EstimationLimitsParameterName)) {
    126141        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>())
    128143          op.EstimationLimitsParameter.ActualName = EstimationLimitsParameter.Name;
    129         }
     144        foreach (var op in operators.OfType<ISymbolicClassificationModelCreatorOperator>())
     145          op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
    130146      }
    131147    }
Note: See TracChangeset for help on using the changeset viewer.