Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/09/13 18:57:22 (11 years ago)
Author:
sforsten
Message:

#1980: several small bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/GAssist/MDL/MDLCalculator.cs

    r9392 r9475  
    8282        double error = bestSolution.TrainingExceptionsLength;
    8383        double tl = (bestSolution.TrainingTheoryLength * bestSolution.Classes) / bestSolution.TrainingNumberOfAliveRules;
     84        if (tl.IsAlmost(0.0)) {
     85          //as done in the original implementation
     86          tl = 0.00000001;
     87        }
    8488        theoryWeight = (initialTheoryLengthRatio / (1.0 - initialTheoryLengthRatio)) * (error / tl);
    8589        iterationsSinceBest = 0;
     
    8791
    8892      if (activated && !fixedWeight &&
    89         GetLastIterationsAccuracyAverage(weightAdaptionIterations) == 1.0) {
     93        GetLastIterationsAccuracyAverage(weightAdaptionIterations).IsAlmost(1.0)) {
    9094        fixedWeight = true;
    9195      }
    9296
    9397      if (activated && !fixedWeight) {
    94         if (bestSolution.TrainingAccuracy != 1.0) {
     98        if (bestSolution.TrainingAccuracy.IsAlmost(1.0)) {
    9599          if (iterationsSinceBest == weightAdaptionIterations) {
    96100            theoryWeight *= weightRelaxFactor;
     
    100104      }
    101105
    102       //if (currentIteration != 0) {
    103106      UpdateStatistic(bestSolution.TrainingAccuracy);
    104       //}
    105107    }
    106108
Note: See TracChangeset for help on using the changeset viewer.