Changeset 15481


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

#2852: reverted changeset r15480 partially to fix unit test

Location:
trunk/sources
Files:
2 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);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r15480 r15481  
    251251      if (node.Symbol is StartSymbol) {
    252252        if (addLinearScalingTerms) {
    253           var t = ConvertToAutoDiff(node.GetSubtree(0));
    254           // scaling variables α, β are given at the end of the parameter vector
     253          // scaling variables α, β are given at the beginning of the parameter vector
    255254          var alpha = new AutoDiff.Variable();
    256255          var beta = new AutoDiff.Variable();
    257256          variables.Add(beta);
    258257          variables.Add(alpha);
     258          var t = ConvertToAutoDiff(node.GetSubtree(0));
    259259          return t * alpha + beta;
    260260        } else return ConvertToAutoDiff(node.GetSubtree(0));
Note: See TracChangeset for help on using the changeset viewer.