Changeset 14843 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective
- Timestamp:
- 04/11/17 15:55:44 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r14840 r14843 164 164 // A dictionary is used to find parameters 165 165 double[] initialConstants; 166 var parameters = new List<TreeToAutoDiffTerm Transformator.DataForVariable>();167 168 TreeToAutoDiffTerm Transformator.ParametricFunction func;169 TreeToAutoDiffTerm Transformator.ParametricFunctionGradient func_grad;170 if (!TreeToAutoDiffTerm Transformator.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)) 171 171 throw new NotSupportedException("Could not optimize constants of symbolic expression tree due to not supported symbols used in the tree."); 172 172 if (parameters.Count == 0) return 0.0; // gkronber: constant expressions always have a R² of 0.0 … … 175 175 176 176 //extract inital constants 177 double[] c = new double[initialConstants.Length ];177 double[] c = new double[initialConstants.Length + 2]; 178 178 { 179 179 c[0] = 0.0; … … 256 256 } 257 257 258 private static alglib.ndimensional_pfunc CreatePFunc(TreeToAutoDiffTerm Transformator.ParametricFunction func) {258 private static alglib.ndimensional_pfunc CreatePFunc(TreeToAutoDiffTermConverter.ParametricFunction func) { 259 259 return (double[] c, double[] x, ref double fx, object o) => { 260 260 fx = func(c, x); … … 262 262 } 263 263 264 private static alglib.ndimensional_pgrad CreatePGrad(TreeToAutoDiffTerm Transformator.ParametricFunctionGradient func_grad) {264 private static alglib.ndimensional_pgrad CreatePGrad(TreeToAutoDiffTermConverter.ParametricFunctionGradient func_grad) { 265 265 return (double[] c, double[] x, ref double fx, double[] grad, object o) => { 266 266 var tupel = func_grad(c, x); … … 270 270 } 271 271 public static bool CanOptimizeConstants(ISymbolicExpressionTree tree) { 272 return TreeToAutoDiffTerm Transformator.IsCompatible(tree);272 return TreeToAutoDiffTermConverter.IsCompatible(tree); 273 273 } 274 274 }
Note: See TracChangeset
for help on using the changeset viewer.