Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/13 16:17:52 (11 years ago)
Author:
gkronber
Message:

#2109 implemented a wrapper for evaluators that transforms genotypes to phenotypes for symbolic regression (deleted obsolete evaluators)

Location:
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution
Files:
5 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution

    • Property svn:ignore
      •  

        old new  
        22*.Settings
        33Plugin.cs
         4*.user
         5bin
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicDataAnalysisSingleObjectiveEvaluator.cs

    r10073 r10263  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Encodings.IntegerVectorEncoding;
    2627using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2728using HeuristicLab.Parameters;
     
    5354      Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName, "The quality of the evaluated symbolic data analysis solution."));
    5455    }
    55 
    56     public abstract double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows);
    5756  }
    5857}
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveEvaluator.cs

    r10075 r10263  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223using HeuristicLab.Common;
     24using HeuristicLab.Core;
     25using HeuristicLab.Encodings.IntegerVectorEncoding;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     27using HeuristicLab.Parameters;
    2328using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2429using HeuristicLab.Problems.DataAnalysis;
     
    2732namespace HeuristicLab.Problems.GrammaticalEvolution {
    2833  [StorableClass]
    29   public abstract class GESymbolicRegressionSingleObjectiveEvaluator : GESymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>,
     34  public class GESymbolicRegressionSingleObjectiveEvaluator : GESymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>,
    3035                                                                       IGESymbolicRegressionSingleObjectiveEvaluator {
     36
     37    public const string EvaluatorParameterName = "Evaluator";
     38    public IValueParameter<ISymbolicRegressionSingleObjectiveEvaluator> EvaluatorParameter {
     39      get { return (IValueParameter<ISymbolicRegressionSingleObjectiveEvaluator>)Parameters[EvaluatorParameterName]; }
     40    }
     41
     42    private ISymbolicRegressionSingleObjectiveEvaluator Evaluator {
     43      get { return EvaluatorParameter.Value; }
     44    }
     45
    3146    [StorableConstructor]
    3247    protected GESymbolicRegressionSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { }
    3348    protected GESymbolicRegressionSingleObjectiveEvaluator(GESymbolicRegressionSingleObjectiveEvaluator original, Cloner cloner) : base(original, cloner) { }
    34     protected GESymbolicRegressionSingleObjectiveEvaluator() : base() { }
     49    public GESymbolicRegressionSingleObjectiveEvaluator()
     50      : base() {
     51      Parameters.Add(new ValueParameter<ISymbolicRegressionSingleObjectiveEvaluator>(EvaluatorParameterName, "The symbolic regression evaluator that should be used to assess the quality of trees.", new SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator()));
     52    }
     53
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new GESymbolicRegressionSingleObjectiveEvaluator(this, cloner);
     56    }
     57
     58    public override bool Maximization {
     59      get { return Evaluator.Maximization; }
     60    }
     61
     62    public override IOperation Apply() {
     63      var genotype = IntegerVectorParameter.ActualValue;
     64
     65      // translate to phenotype
     66      var tree = GenotypeToPhenotypeMapperParameter.ActualValue.Map(
     67        SymbolicExpressionTreeGrammarParameter.ActualValue,
     68        genotype
     69      );
     70      SymbolicExpressionTreeParameter.ActualValue = tree; // write to scope for analyzers
     71
     72      // create operation for evaluation
     73      var evalOp = ExecutionContext.CreateChildOperation(Evaluator);
     74      var successorOp = base.Apply();
     75
     76      return new OperationCollection(evalOp, successorOp);
     77    }
    3578  }
    3679}
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveProblem.cs

    r10226 r10263  
    6161
    6262    public GESymbolicRegressionSingleObjectiveProblem()
    63       : base(new RegressionProblemData(), new GESymbolicRegressionSingleObjectivePearsonRSquaredEvaluator(), new UniformRandomIntegerVectorCreator()) {
     63      : base(new RegressionProblemData(), new GESymbolicRegressionSingleObjectiveEvaluator(), new UniformRandomIntegerVectorCreator()) {
    6464      Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription));
    6565
     
    8181    private void AfterDeserialization() {
    8282      RegisterEventHandlers();
    83       // compatibility
    84       bool changed = false;
    85       if (!Operators.OfType<SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer>().Any()) {
    86         Operators.Add(new SymbolicRegressionSingleObjectiveTrainingParetoBestSolutionAnalyzer());
    87         changed = true;
    88       }
    89       if (!Operators.OfType<SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer>().Any()) {
    90         Operators.Add(new SymbolicRegressionSingleObjectiveValidationParetoBestSolutionAnalyzer());
    91         changed = true;
    92       }
    93       if (changed) {
    94         ParameterizeOperators();
    95       }
    9683    }
    9784
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/IGESymbolicDataAnalysisSingleObjectiveEvaluator.cs

    r10073 r10263  
    2222using System.Collections.Generic;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Encodings.IntegerVectorEncoding;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2526using HeuristicLab.Optimization;
     
    3031    where T : class,IDataAnalysisProblemData {
    3132    bool Maximization { get; }
    32 
    33     double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows);
    3433  }
    3534}
Note: See TracChangeset for help on using the changeset viewer.