Changeset 3923


Ignore:
Timestamp:
06/16/10 11:15:06 (10 years ago)
Author:
mkommend
Message:

fixed bug in RegressionSolutionAnalyzer - linear regression does not contain a parameter generations (ticket #938)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Analyzers/RegressionSolutionAnalyzer.cs

    r3905 r3923  
    7575    }
    7676    public ILookupParameter<IntValue> GenerationsParameter {
    77       get {
    78         return (ILookupParameter<IntValue>)Parameters[GenerationsParameterName];
    79       }
     77      get { return (ILookupParameter<IntValue>)Parameters[GenerationsParameterName]; }
    8078    }
    8179    #endregion
     
    151149        Results[BestSolutionTrainingRelativeError].Value = new DoubleValue(trainingRelError);
    152150        Results[BestSolutionTestRelativeError].Value = new DoubleValue(testRelError);
    153         Results[BestSolutionGeneration].Value = new IntValue(GenerationsParameter.ActualValue.Value);
     151        if (GenerationsParameter.ActualValue != null) // this check is needed because linear regression solutions do not have a generations parameter
     152          Results[BestSolutionGeneration].Value = new IntValue(GenerationsParameter.ActualValue.Value);
    154153      } else {
    155154        Results.Add(new Result(BestSolutionResultName, solution));
     
    160159        Results.Add(new Result(BestSolutionTrainingRelativeError, new DoubleValue(trainingRelError)));
    161160        Results.Add(new Result(BestSolutionTestRelativeError, new DoubleValue(testRelError)));
    162         Results.Add(new Result(BestSolutionGeneration, new IntValue(GenerationsParameter.ActualValue.Value)));
     161        if (GenerationsParameter.ActualValue != null)
     162          Results.Add(new Result(BestSolutionGeneration, new IntValue(GenerationsParameter.ActualValue.Value)));
    163163      }
    164164      #endregion
Note: See TracChangeset for help on using the changeset viewer.