Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/17 15:55:44 (8 years ago)
Author:
gkronber
Message:

#2697: applied r14390, r14391, r14393, r14394, r14396 again (resolving conflicts)

File:
1 edited

Legend:

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

    r14840 r14843  
    164164      // A dictionary is used to find parameters
    165165      double[] initialConstants;
    166       var parameters = new List<TreeToAutoDiffTermTransformator.DataForVariable>();
    167 
    168       TreeToAutoDiffTermTransformator.ParametricFunction func;
    169       TreeToAutoDiffTermTransformator.ParametricFunctionGradient func_grad;
    170       if (!TreeToAutoDiffTermTransformator.TryTransformToAutoDiff(tree, updateVariableWeights, out parameters, out initialConstants, out func, out func_grad))
     166      var parameters = new List<TreeToAutoDiffTermConverter.DataForVariable>();
     167
     168      TreeToAutoDiffTermConverter.ParametricFunction func;
     169      TreeToAutoDiffTermConverter.ParametricFunctionGradient func_grad;
     170      if (!TreeToAutoDiffTermConverter.TryConvertToAutoDiff(tree, updateVariableWeights, out parameters, out initialConstants, out func, out func_grad))
    171171        throw new NotSupportedException("Could not optimize constants of symbolic expression tree due to not supported symbols used in the tree.");
    172172      if (parameters.Count == 0) return 0.0; // gkronber: constant expressions always have a R² of 0.0
     
    175175
    176176      //extract inital constants
    177       double[] c = new double[initialConstants.Length];
     177      double[] c = new double[initialConstants.Length + 2];
    178178      {
    179179        c[0] = 0.0;
     
    256256    }
    257257
    258     private static alglib.ndimensional_pfunc CreatePFunc(TreeToAutoDiffTermTransformator.ParametricFunction func) {
     258    private static alglib.ndimensional_pfunc CreatePFunc(TreeToAutoDiffTermConverter.ParametricFunction func) {
    259259      return (double[] c, double[] x, ref double fx, object o) => {
    260260        fx = func(c, x);
     
    262262    }
    263263
    264     private static alglib.ndimensional_pgrad CreatePGrad(TreeToAutoDiffTermTransformator.ParametricFunctionGradient func_grad) {
     264    private static alglib.ndimensional_pgrad CreatePGrad(TreeToAutoDiffTermConverter.ParametricFunctionGradient func_grad) {
    265265      return (double[] c, double[] x, ref double fx, double[] grad, object o) => {
    266266        var tupel = func_grad(c, x);
     
    270270    }
    271271    public static bool CanOptimizeConstants(ISymbolicExpressionTree tree) {
    272       return TreeToAutoDiffTermTransformator.IsCompatible(tree);
     272      return TreeToAutoDiffTermConverter.IsCompatible(tree);
    273273    }
    274274  }
Note: See TracChangeset for help on using the changeset viewer.