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

Location:
branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3
Files:
2 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
  • branches/LearningClassifierSystems/HeuristicLab.Optimization.Operators.LCS/3.3/Selection/NichingTournamentSelector.cs

    r9411 r9475  
    8383      //check if list with indexes is as long as the original scope list
    8484      //otherwise invalid quality values were filtered
    85       if (qualities.Count != scopes.Count && individuals.Count != scopes.Count) {
     85      if (qualities.Count != scopes.Count || individuals.Count != scopes.Count) {
    8686        throw new ArgumentException("The scopes contain invalid quality values (either infinity or double.NaN) on which the selector cannot operate.");
    8787      }
Note: See TracChangeset for help on using the changeset viewer.