Changeset 10263 for branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic
- Timestamp:
- 12/20/13 16:17:52 (11 years ago)
- 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 2 2 *.Settings 3 3 Plugin.cs 4 *.user 5 bin
-
- Property svn:ignore
-
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicDataAnalysisSingleObjectiveEvaluator.cs
r10073 r10263 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Data; 26 using HeuristicLab.Encodings.IntegerVectorEncoding; 26 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 28 using HeuristicLab.Parameters; … … 53 54 Parameters.Add(new LookupParameter<DoubleValue>(QualityParameterName, "The quality of the evaluated symbolic data analysis solution.")); 54 55 } 55 56 public abstract double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows);57 56 } 58 57 } -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveEvaluator.cs
r10075 r10263 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Encodings.IntegerVectorEncoding; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Parameters; 23 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 29 using HeuristicLab.Problems.DataAnalysis; … … 27 32 namespace HeuristicLab.Problems.GrammaticalEvolution { 28 33 [StorableClass] 29 public abstractclass GESymbolicRegressionSingleObjectiveEvaluator : GESymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>,34 public class GESymbolicRegressionSingleObjectiveEvaluator : GESymbolicDataAnalysisSingleObjectiveEvaluator<IRegressionProblemData>, 30 35 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 31 46 [StorableConstructor] 32 47 protected GESymbolicRegressionSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { } 33 48 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 } 35 78 } 36 79 } -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveProblem.cs
r10226 r10263 61 61 62 62 public GESymbolicRegressionSingleObjectiveProblem() 63 : base(new RegressionProblemData(), new GESymbolicRegressionSingleObjective PearsonRSquaredEvaluator(), new UniformRandomIntegerVectorCreator()) {63 : base(new RegressionProblemData(), new GESymbolicRegressionSingleObjectiveEvaluator(), new UniformRandomIntegerVectorCreator()) { 64 64 Parameters.Add(new FixedValueParameter<DoubleLimit>(EstimationLimitsParameterName, EstimationLimitsParameterDescription)); 65 65 … … 81 81 private void AfterDeserialization() { 82 82 RegisterEventHandlers(); 83 // compatibility84 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 }96 83 } 97 84 -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/IGESymbolicDataAnalysisSingleObjectiveEvaluator.cs
r10073 r10263 22 22 using System.Collections.Generic; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Encodings.IntegerVectorEncoding; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 26 using HeuristicLab.Optimization; … … 30 31 where T : class,IDataAnalysisProblemData { 31 32 bool Maximization { get; } 32 33 double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, T problemData, IEnumerable<int> rows);34 33 } 35 34 }
Note: See TracChangeset
for help on using the changeset viewer.