Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/05/08 21:34:12 (15 years ago)
Author:
gkronber
Message:

fixed a stupid mistake introduced with r702 #328 (GP evaluation doesn't work in a thread parallel engine).

File:
1 edited

Legend:

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

    r702 r712  
    4343    public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {
    4444      IntMatrixData matrix = GetVariableValue<IntMatrixData>("ConfusionMatrix", scope, false, false);
    45       if(matrix == null) {
     45      if (matrix == null) {
    4646        matrix = new IntMatrixData(new int[classes.Length, classes.Length]);
    4747        scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("ConfusionMatrix"), matrix));
     
    4949
    5050      int nSamples = end - start;
    51       for(int sample = start; sample < end; sample++) {
     51      for (int sample = start; sample < end; sample++) {
    5252        double est = evaluator.Evaluate(sample);
    53         double origClass = dataset.GetValue(targetVariable,sample);
     53        double origClass = dataset.GetValue(sample, targetVariable);
    5454        int estClassIndex = -1;
    5555        // if estimation is lower than the smallest threshold value -> estimated class is the lower class
    56         if(est < thresholds[0]) estClassIndex = 0;
     56        if (est < thresholds[0]) estClassIndex = 0;
    5757        // if estimation is larger (or equal) than the largest threshold value -> estimated class is the upper class
    58         else if(est >= thresholds[thresholds.Length - 1]) estClassIndex = classes.Length - 1;
     58        else if (est >= thresholds[thresholds.Length - 1]) estClassIndex = classes.Length - 1;
    5959        else {
    6060          // otherwise the estimated class is the class which upper threshold is larger than the estimated value
    61           for(int k = 0; k < thresholds.Length; k++) {
    62             if(thresholds[k] > est) {
     61          for (int k = 0; k < thresholds.Length; k++) {
     62            if (thresholds[k] > est) {
    6363              estClassIndex = k;
    6464              break;
     
    6868
    6969        // find the first threshold index that is larger to the original value
    70         int origClassIndex = classes.Length-1;
    71         for(int i = 0; i < thresholds.Length; i++) {
    72           if(origClass < thresholds[i]) {
     70        int origClassIndex = classes.Length - 1;
     71        for (int i = 0; i < thresholds.Length; i++) {
     72          if (origClass < thresholds[i]) {
    7373            origClassIndex = i;
    7474            break;
Note: See TracChangeset for help on using the changeset viewer.