Ignore:
Timestamp:
11/21/17 15:40:19 (4 years ago)
Author:
gkronber
Message:

#2852: reverted changeset r15480 partially to fix unit test

File:
1 edited

Legend:

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

    r15480 r15481  
    213213      if (applyLinearScaling) {
    214214        c = new double[initialConstants.Length + 2];
    215         {
    216           Array.Copy(initialConstants, 0, c, 0, initialConstants.Length);
    217           c[c.Length - 2] = 0.0;
    218           c[c.Length - 1] = 1.0;
    219         }
     215        c[0] = 0.0;
     216        c[1] = 1.0;
     217        Array.Copy(initialConstants, 0, c, 2, initialConstants.Length);
    220218      } else {
    221219        c = (double[])initialConstants.Clone();
     
    273271      //retVal == -7  => constant optimization failed due to wrong gradient
    274272      if (retVal != -7) {
    275         if (applyLinearScaling) UpdateConstants(tree, c, updateVariableWeights);
    276         else UpdateConstants(tree, c, updateVariableWeights);
     273        if (applyLinearScaling) {
     274          var tmp = new double[c.Length - 2];
     275          Array.Copy(c, 2, tmp, 0, tmp.Length);
     276          UpdateConstants(tree, tmp, updateVariableWeights);
     277        } else UpdateConstants(tree, c, updateVariableWeights);
    277278      }
    278279      var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
Note: See TracChangeset for help on using the changeset viewer.