Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/04/08 17:30:24 (16 years ago)
Author:
gkronber
Message:
  • implemented operator to store the best of run solution, in regard of a specific fitness variable).
  • adapted struct-id infrastructure to allow evaluation of models on validation data.

ticket #194

Location:
trunk/sources/HeuristicLab.Functions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/BakedFunctionTree.cs

    r344 r363  
    262262    }
    263263
    264     bool evaluatorReset = false;
    265     public double Evaluate(Dataset dataset, int sampleIndex) {
     264    public void PrepareEvaluation(Dataset dataset) {
    266265      FlattenVariables();
    267266      FlattenTrees();
    268       if(!evaluatorReset) {
    269         BakedTreeEvaluator.ResetEvaluator(linearRepresentation);
    270         evaluatorReset = true;
    271       }
    272       return BakedTreeEvaluator.Evaluate(dataset, sampleIndex);
     267      BakedTreeEvaluator.ResetEvaluator(dataset, linearRepresentation);
     268    }
     269
     270    public double Evaluate(int sampleIndex) {
     271      return BakedTreeEvaluator.Evaluate(sampleIndex);
    273272    }
    274273
  • trunk/sources/HeuristicLab.Functions/BakedTreeEvaluator.cs

    r322 r363  
    5353    }
    5454
    55     public static void ResetEvaluator(List<LightWeightFunction> linearRepresentation) {
     55    public static void ResetEvaluator(Dataset dataset, List<LightWeightFunction> linearRepresentation) {
    5656      int i = 0;
     57      BakedTreeEvaluator.dataset = dataset;
    5758      foreach(LightWeightFunction f in linearRepresentation) {
    5859        TranslateToInstr(f, codeArr[i++]);
     
    7879    }
    7980
    80     internal static double Evaluate(Dataset dataset, int sampleIndex) {
     81    internal static double Evaluate(int sampleIndex) {
    8182      PC = 0;
    8283      BakedTreeEvaluator.sampleIndex = sampleIndex;
    83       BakedTreeEvaluator.dataset = dataset;
    8484      return EvaluateBakedCode();
    8585    }
  • trunk/sources/HeuristicLab.Functions/IFunctionTree.cs

    r324 r363  
    4040    void RemoveSubTree(int index);
    4141
    42     double Evaluate(Dataset dataset, int sampleIndex);
     42    void PrepareEvaluation(Dataset dataset);
     43    double Evaluate(int sampleIndex);
    4344  }
    4445}
Note: See TracChangeset for help on using the changeset viewer.