Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/09 13:46:57 (16 years ago)
Author:
gkronber
Message:

Refactored GP evaluation to make it possible to use different evaluators to interpret function trees. #615 (Evaluation of HL3 function trees should be equivalent to evaluation in HL2)

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/AveragePercentageChangeEvaluator.cs

    r1529 r1796  
    4242    }
    4343
    44     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     44    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4545      bool differential = GetVariableValue<BoolData>("Differential", scope, true).Data;
    4646      DoubleData apc = GetVariableValue<DoubleData>("APC", scope, false, false);
     
    5858          prevOriginal = dataset.GetValue(sample - 1, targetVariable);
    5959          originalPercentageChange = (dataset.GetValue(sample, targetVariable) - prevOriginal) / prevOriginal;
    60           estimatedPercentageChange = (evaluator.Evaluate(sample) - prevOriginal) / prevOriginal;
     60          estimatedPercentageChange = (evaluator.Evaluate(tree, sample) - prevOriginal) / prevOriginal;
    6161          if (updateTargetValues) {
    6262            dataset.SetValue(sample, targetVariable, estimatedPercentageChange * prevOriginal + prevOriginal);
     
    6464        } else {
    6565          originalPercentageChange = dataset.GetValue(sample, targetVariable);
    66           estimatedPercentageChange = evaluator.Evaluate(sample);
     66          estimatedPercentageChange = evaluator.Evaluate(tree, sample);
    6767          if (updateTargetValues) {
    6868            dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/ProfitEvaluator.cs

    r1529 r1796  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4646      int exchangeRateVarIndex = GetVariableValue<IntData>("ExchangeRate", scope, true).Data;
    4747      double transactionCost = GetVariableValue<DoubleData>("TransactionCost", scope, true).Data;
     
    5858        exchangeRate = dataset.GetValue(sample, exchangeRateVarIndex);
    5959        double originalPercentageChange = dataset.GetValue(sample, targetVariable);
    60         double estimatedPercentageChange = evaluator.Evaluate(sample);
     60        double estimatedPercentageChange = evaluator.Evaluate(tree, sample);
    6161        if (updateTargetValues) {
    6262          dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
  • trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/TheilInequalityCoefficientEvaluator.cs

    r1529 r1796  
    5454    }
    5555
    56     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     56    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    5757      #region create result variables
    5858      DoubleData theilInequaliy = GetVariableValue<DoubleData>("TheilInequalityCoefficient", scope, false, false);
     
    8585      for (int sample = start; sample < end; sample++) {
    8686        double prevValue = dataset.GetValue(sample - 1, targetVariable);
    87         double estimatedChange = evaluator.Evaluate(sample) - prevValue;
     87        double estimatedChange = evaluator.Evaluate(tree, sample) - prevValue;
    8888        double originalChange = dataset.GetValue(sample, targetVariable) - prevValue;
    8989        if (updateTargetValues) {
Note: See TracChangeset for help on using the changeset viewer.