Changeset 2640


Ignore:
Timestamp:
01/18/10 16:46:24 (10 years ago)
Author:
gkronber
Message:

Removed the restriction of the estimated value to the range [LowerBound..UpperBound] because the estimation is scaled anyway. However the scaled values are restricted to that range. #823 (Implement tree evaluator with linear scaling to improve convergence in symbolic regression.)

File:
1 edited

Legend:

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

    r2634 r2640  
    3636  public class ScalingTreeEvaluator : HL3TreeEvaluator, ITreeEvaluator {
    3737    public ScalingTreeEvaluator() : base() { } // for persistence
    38     public ScalingTreeEvaluator(double minValue, double maxValue) : base(minValue, maxValue) { }
     38    public ScalingTreeEvaluator(double minValue, double maxValue)
     39      : base(minValue, maxValue) {
     40    }
    3941
    4042    private string targetVariable;
     
    4244      get { return targetVariable; }
    4345      set { targetVariable = value; }
     46    }
     47
     48
     49    public override double Evaluate(int sampleIndex) {
     50      PC = 0;
     51      this.sampleIndex = sampleIndex;
     52      double estimation = EvaluateBakedCode();
     53      if (double.IsPositiveInfinity(estimation)) estimation = UpperEvaluationLimit;
     54      else if (double.IsNegativeInfinity(estimation)) estimation = LowerEvaluationLimit;
     55      else if (double.IsNaN(estimation)) estimation = UpperEvaluationLimit;
     56      return estimation;
    4457    }
    4558
Note: See TracChangeset for help on using the changeset viewer.