Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 16:46:35 (12 years ago)
Author:
gkronber
Message:

#1847: merged r8084:8205 from trunk into GP move operators branch

Location:
branches/GP-MoveOperators
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators

  • branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs

    r8085 r8206  
    4848    [StorableConstructor]
    4949    protected SymbolicClassificationSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
    50     protected SymbolicClassificationSingleObjectiveProblem(SymbolicClassificationSingleObjectiveProblem original, Cloner cloner) : base(original, cloner) { }
     50    protected SymbolicClassificationSingleObjectiveProblem(SymbolicClassificationSingleObjectiveProblem original, Cloner cloner)
     51      : base(original, cloner) {
     52      RegisterEventHandlers();
     53    }
    5154    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationSingleObjectiveProblem(this, cloner); }
    5255
     
    6063      MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength;
    6164
    62       SymbolicExpressionTreeGrammarParameter.ValueChanged += (o, e) => ConfigureGrammarSymbols();
    63 
     65      RegisterEventHandlers();
    6466      ConfigureGrammarSymbols();
    6567      InitializeOperators();
    6668      UpdateEstimationLimits();
     69    }
     70
     71    [StorableHook(HookType.AfterDeserialization)]
     72    private void AfterDeserialization() {
     73      RegisterEventHandlers();
     74      // compatibility
     75      bool changed = false;
     76      if (!Operators.OfType<SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer>().Any()) {
     77        Operators.Add(new SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer());
     78        changed = true;
     79      }
     80      if (!Operators.OfType<SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer>().Any()) {
     81        Operators.Add(new SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer());
     82        changed = true;
     83      }
     84      if (changed) ParameterizeOperators();
     85    }
     86
     87    private void RegisterEventHandlers() {
     88      SymbolicExpressionTreeGrammarParameter.ValueChanged += (o, e) => ConfigureGrammarSymbols();
    6789    }
    6890
     
    82104
    83105    private void UpdateEstimationLimits() {
    84       if (ProblemData.TrainingIndizes.Any()) {
    85         var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).ToList();
     106      if (ProblemData.TrainingIndices.Any()) {
     107        var targetValues = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).ToList();
    86108        var mean = targetValues.Average();
    87109        var range = targetValues.Max() - targetValues.Min();
  • branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs

    r7734 r8206  
    3333  [Item("SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that collects the training Pareto-best symbolic classification solutions for single objective symbolic classification problems.")]
    3434  [StorableClass]
    35   public sealed class SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<ISymbolicClassificationSolution>,
    36   ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator {
    37     private const string ProblemDataParameterName = "ProblemData";
    38     private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
    39     private const string EstimationLimitsParameterName = "EstimationLimits";
     35  public sealed class SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<IClassificationProblemData, ISymbolicClassificationSolution> {
    4036    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    4137    #region parameter properties
    42     public ILookupParameter<IClassificationProblemData> ProblemDataParameter {
    43       get { return (ILookupParameter<IClassificationProblemData>)Parameters[ProblemDataParameterName]; }
    44     }
    45     public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
    46       get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
    47     }
    48     public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
    49       get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    50     }
    5138    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
    5239      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
     
    6552    public SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer()
    6653      : base() {
    67       Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution."));
    68       Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
    69       Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model."));
    7054      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    7155    }
  • branches/GP-MoveOperators/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs

    r7734 r8206  
    3333  [Item("SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that collects the validation Pareto-best symbolic classification solutions for single objective symbolic classification problems.")]
    3434  [StorableClass]
    35   public sealed class SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>,
    36   ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator {
    37     private const string EstimationLimitsParameterName = "EstimationLimits";
     35  public sealed class SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData> {
    3836    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
    3937    #region parameter properties
    40     public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
    41       get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    42     }
    4338    public IValueParameter<BoolValue> ApplyLinearScalingParameter {
    4439      get { return (IValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
     
    5752    public SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer()
    5853      : base() {
    59       Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model."));
    6054      Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic classification solution should be linearly scaled.", new BoolValue(false)));
    6155    }
Note: See TracChangeset for help on using the changeset viewer.