Changeset 13660


Ignore:
Timestamp:
03/07/16 15:27:37 (22 months ago)
Author:
gkronber
Message:

#2572: removed null checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSolutionsAnalyzer.cs

    r13582 r13660  
    9595      ILookupParameter<DoubleValue> testQualityParam = null;
    9696      // store actual names of parameter because it is changed below
    97       string prevTrainingQualityParamName = TrainingQualityParameterName;
    98       string prevTestQualityParamName = TestQualityParameterName;
    99       if (Parameters.ContainsKey(TrainingQualityParameterName)) {
    100         trainingQualityParam = TrainingQualityParameter;
    101         prevTrainingQualityParamName = trainingQualityParam.ActualName;
    102       }
    103       if (Parameters.ContainsKey(TestQualityParameterName)) {
    104         testQualityParam = TestQualityParameter;
    105         prevTestQualityParamName = testQualityParam.ActualName;
    106       }
    107 
     97      trainingQualityParam = TrainingQualityParameter;
     98      string prevTrainingQualityParamName = trainingQualityParam.ActualName;
     99      testQualityParam = TestQualityParameter;
     100      string prevTestQualityParamName = testQualityParam.ActualName;
    108101      foreach (var result in results.Where(r => r.Value is IRegressionSolution)) {
    109102        var solution = (IRegressionSolution)result.Value;
     
    122115        // also add training and test R² to the scope using the parameters
    123116        // HACK: we change the ActualName of the parameter to write two variables for each solution in the results collection
    124         if (trainingQualityParam != null) {
    125           trainingQualityParam.ActualName = trainingR2Name;
    126           trainingQualityParam.ActualValue = new DoubleValue(solution.TrainingRSquared);
    127         }
    128         if (testQualityParam != null) {
    129           testQualityParam.ActualName = testR2Name;
    130           testQualityParam.ActualValue = new DoubleValue(solution.TestRSquared);
    131         }
     117        trainingQualityParam.ActualName = trainingR2Name;
     118        trainingQualityParam.ActualValue = new DoubleValue(solution.TrainingRSquared);
     119        testQualityParam.ActualName = testR2Name;
     120        testQualityParam.ActualValue = new DoubleValue(solution.TestRSquared);
    132121      }
    133122
    134       if (trainingQualityParam != null) trainingQualityParam.ActualName = prevTrainingQualityParamName;
    135       if (testQualityParam != null) testQualityParam.ActualName = prevTestQualityParamName;
     123      trainingQualityParam.ActualName = prevTrainingQualityParamName;
     124      testQualityParam.ActualName = prevTestQualityParamName;
    136125
    137126      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.