Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/25/09 17:46:17 (16 years ago)
Author:
gkronber
Message:

Fixed #645 (Tree evaluators precompile the model for each evaluation of a row).

Location:
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3
Files:
5 edited

Legend:

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

    r1796 r1891  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4646      DoubleData accuracy = GetVariableValue<DoubleData>("Accuracy", scope, false, false);
    4747      if (accuracy == null) {
     
    5353      int nCorrect = 0;
    5454      for (int sample = start; sample < end; sample++) {
    55         double est = evaluator.Evaluate(tree, sample);
     55        double est = evaluator.Evaluate(sample);
    5656        double origClass = dataset.GetValue(sample, targetVariable);
    5757        double estClass = double.NaN;
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ClassificationMeanSquaredErrorEvaluator.cs

    r1796 r1891  
    4343    }
    4444
    45     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
     45    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4646      double errorsSquaredSum = 0;
    4747      for (int sample = start; sample < end; sample++) {
    48         double estimated = evaluator.Evaluate(tree, sample);
     48        double estimated = evaluator.Evaluate(sample);
    4949        double original = dataset.GetValue(sample, targetVariable);
    5050        if (!double.IsNaN(original) && !double.IsInfinity(original)) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ConfusionMatrixEvaluator.cs

    r1796 r1891  
    4141    }
    4242
    43     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
     43    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4444      IntMatrixData matrix = GetVariableValue<IntMatrixData>("ConfusionMatrix", scope, false, false);
    4545      if (matrix == null) {
     
    5050      int nSamples = end - start;
    5151      for (int sample = start; sample < end; sample++) {
    52         double est = evaluator.Evaluate(tree, sample);
     52        double est = evaluator.Evaluate(sample);
    5353        double origClass = dataset.GetValue(sample, targetVariable);
    5454        int estClassIndex = -1;
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/GPClassificationEvaluatorBase.cs

    r1796 r1891  
    3737    }
    3838
    39     public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
     39    public override void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
    4040
    4141      ItemList<DoubleData> classes = GetVariableValue<ItemList<DoubleData>>("TargetClassValues", scope, true);
     
    4848      }
    4949
    50       Evaluate(scope, evaluator, tree, dataset, targetVariable, classesArr, thresholds, start, end);
     50      Evaluate(scope, evaluator, dataset, targetVariable, classesArr, thresholds, start, end);
    5151    }
    5252
    53     public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end);
     53    public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end);
    5454  }
    5555}
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/MulticlassOneVsOneAnalyzer.cs

    r1796 r1891  
    8686        BakedTreeEvaluator evaluator = new BakedTreeEvaluator();
    8787        evaluator.ResetEvaluator(dataset, targetVariable, trainingSamplesStart, trainingSamplesEnd, 1.0);
    88 
     88        evaluator.PrepareForEvaluation(functionTree);
    8989        for(int i = 0; i < (samplesEnd - samplesStart); i++) {
    90           double est = evaluator.Evaluate(functionTree, i + samplesStart);
     90          double est = evaluator.Evaluate(i + samplesStart);
    9191          if(est < 0.5) {
    9292            CastVote(votes, i, classAValue, classValues);
Note: See TracChangeset for help on using the changeset viewer.