Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators
- Timestamp:
- 07/08/16 14:40:02 (9 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression merged eligible /stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 merged eligible /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 merged eligible /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6917-7005 /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 6917-7005 /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 4656-4721 /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5471-5473 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5471-5473 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5815-6180 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5815-6180 /branches/DataAnalysis.ComplexityAnalyzer/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 10750-13239 /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 4458-4459,4462,4464 /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10085-11101 /branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6284-6795 /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5060 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5060 /branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10331-10358 /branches/HLScript/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 11570-12508 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 11130-12721 /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 8388-8942 /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 8388-8942 /branches/LogResidualEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10202-10483 /branches/LogResidualEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 10202-10483 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5138-5162 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5175-5192 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 7748-7810 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 7748-7810 /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6350-6627 /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6828 /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 6828 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 10204-10479 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5370-5682 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5370-5682 /branches/SymbolicExpressionTreeDiversityAnalyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 12029-12100 /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 12336-12421 /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 6829-6865 /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 6829-6865 /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5594-5752 /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5594-5752 /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression 5959-6341 /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/crossvalidation-2434/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r12509 r14029 40 40 private const string ConstantOptimizationRowsPercentageParameterName = "ConstantOptimizationRowsPercentage"; 41 41 private const string UpdateConstantsInTreeParameterName = "UpdateConstantsInSymbolicExpressionTree"; 42 private const string UpdateVariableWeightsParameterName = "Update Variable Weights"; 42 43 43 44 public IFixedValueParameter<IntValue> ConstantOptimizationIterationsParameter { … … 56 57 get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateConstantsInTreeParameterName]; } 57 58 } 59 public IFixedValueParameter<BoolValue> UpdateVariableWeightsParameter { 60 get { return (IFixedValueParameter<BoolValue>)Parameters[UpdateVariableWeightsParameterName]; } 61 } 62 58 63 59 64 public IntValue ConstantOptimizationIterations { … … 72 77 get { return UpdateConstantsInTreeParameter.Value.Value; } 73 78 set { UpdateConstantsInTreeParameter.Value.Value = value; } 79 } 80 81 public bool UpdateVariableWeights { 82 get { return UpdateVariableWeightsParameter.Value.Value; } 83 set { UpdateVariableWeightsParameter.Value.Value = value; } 74 84 } 75 85 … … 86 96 : base() { 87 97 Parameters.Add(new FixedValueParameter<IntValue>(ConstantOptimizationIterationsParameterName, "Determines how many iterations should be calculated while optimizing the constant of a symbolic expression tree (0 indicates other or default stopping criterion).", new IntValue(10), true)); 88 Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0), true) );98 Parameters.Add(new FixedValueParameter<DoubleValue>(ConstantOptimizationImprovementParameterName, "Determines the relative improvement which must be achieved in the constant optimization to continue with it (0 indicates other or default stopping criterion).", new DoubleValue(0), true) { Hidden = true }); 89 99 Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationProbabilityParameterName, "Determines the probability that the constants are optimized", new PercentValue(1), true)); 90 100 Parameters.Add(new FixedValueParameter<PercentValue>(ConstantOptimizationRowsPercentageParameterName, "Determines the percentage of the rows which should be used for constant optimization", new PercentValue(1), true)); 91 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true))); 101 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true)) { Hidden = true }); 102 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized.", new BoolValue(true)) { Hidden = true }); 92 103 } 93 104 … … 100 111 if (!Parameters.ContainsKey(UpdateConstantsInTreeParameterName)) 101 112 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateConstantsInTreeParameterName, "Determines if the constants in the tree should be overwritten by the optimized constants.", new BoolValue(true))); 113 if (!Parameters.ContainsKey(UpdateVariableWeightsParameterName)) 114 Parameters.Add(new FixedValueParameter<BoolValue>(UpdateVariableWeightsParameterName, "Determines if the variable weights in the tree should be optimized.", new BoolValue(true))); 102 115 } 103 116 … … 108 121 IEnumerable<int> constantOptimizationRows = GenerateRowsToEvaluate(ConstantOptimizationRowsPercentage.Value); 109 122 quality = OptimizeConstants(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, ProblemDataParameter.ActualValue, 110 constantOptimizationRows, ApplyLinearScalingParameter.ActualValue.Value, ConstantOptimizationIterations.Value, 111 EstimationLimitsParameter.ActualValue.Upper, EstimationLimitsParameter.ActualValue.Lower, UpdateConstantsInTree); 123 constantOptimizationRows, ApplyLinearScalingParameter.ActualValue.Value, ConstantOptimizationIterations.Value, updateVariableWeights: UpdateVariableWeights, lowerEstimationLimit: EstimationLimitsParameter.ActualValue.Lower, upperEstimationLimit: EstimationLimitsParameter.ActualValue.Upper, updateConstantsInTree: UpdateConstantsInTree); 112 124 113 125 if (ConstantOptimizationRowsPercentage.Value != RelativeNumberOfEvaluatedSamplesParameter.ActualValue.Value) { … … 164 176 165 177 166 public static double OptimizeConstants(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, IRegressionProblemData problemData, 167 IEnumerable<int> rows, bool applyLinearScaling, int maxIterations, double upperEstimationLimit = double.MaxValue, double lowerEstimationLimit = double.MinValue, bool updateConstantsInTree = true) { 178 public static double OptimizeConstants(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int maxIterations, bool updateVariableWeights = true, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue, bool updateConstantsInTree = true) { 168 179 169 180 List<AutoDiff.Variable> variables = new List<AutoDiff.Variable>(); … … 172 183 173 184 AutoDiff.Term func; 174 if (!TryTransformToAutoDiff(tree.Root.GetSubtree(0), variables, parameters, variableNames, out func))185 if (!TryTransformToAutoDiff(tree.Root.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out func)) 175 186 throw new NotSupportedException("Could not optimize constants of symbolic expression tree due to not supported symbols used in the tree."); 176 187 if (variableNames.Count == 0) return 0.0; 177 188 178 AutoDiff.IParametricCompiledTerm compiledFunc = AutoDiff.TermUtils.Compile(func, variables.ToArray(), parameters.ToArray()); 179 180 List<SymbolicExpressionTreeTerminalNode> terminalNodes = tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>().ToList(); 189 AutoDiff.IParametricCompiledTerm compiledFunc = func.Compile(variables.ToArray(), parameters.ToArray()); 190 191 List<SymbolicExpressionTreeTerminalNode> terminalNodes = null; 192 if (updateVariableWeights) 193 terminalNodes = tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>().ToList(); 194 else 195 terminalNodes = new List<SymbolicExpressionTreeTerminalNode>(tree.Root.IterateNodesPrefix().OfType<ConstantTreeNode>()); 196 197 //extract inital constants 181 198 double[] c = new double[variables.Count]; 182 183 199 { 184 200 c[0] = 0.0; 185 201 c[1] = 1.0; 186 //extract inital constants187 202 int i = 2; 188 203 foreach (var node in terminalNodes) { … … 191 206 if (constantTreeNode != null) 192 207 c[i++] = constantTreeNode.Value; 193 else if ( variableTreeNode != null)208 else if (updateVariableWeights && variableTreeNode != null) 194 209 c[i++] = variableTreeNode.Weight; 195 210 } … … 234 249 235 250 //info == -7 => constant optimization failed due to wrong gradient 236 if (info != -7) UpdateConstants(tree, c.Skip(2).ToArray() );251 if (info != -7) UpdateConstants(tree, c.Skip(2).ToArray(), updateVariableWeights); 237 252 var quality = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, tree, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling); 238 253 239 if (!updateConstantsInTree) UpdateConstants(tree, originalConstants.Skip(2).ToArray() );254 if (!updateConstantsInTree) UpdateConstants(tree, originalConstants.Skip(2).ToArray(), updateVariableWeights); 240 255 if (originalQuality - quality > 0.001 || double.IsNaN(quality)) { 241 UpdateConstants(tree, originalConstants.Skip(2).ToArray() );256 UpdateConstants(tree, originalConstants.Skip(2).ToArray(), updateVariableWeights); 242 257 return originalQuality; 243 258 } … … 245 260 } 246 261 247 private static void UpdateConstants(ISymbolicExpressionTree tree, double[] constants ) {262 private static void UpdateConstants(ISymbolicExpressionTree tree, double[] constants, bool updateVariableWeights) { 248 263 int i = 0; 249 264 foreach (var node in tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>()) { … … 252 267 if (constantTreeNode != null) 253 268 constantTreeNode.Value = constants[i++]; 254 else if ( variableTreeNode != null)269 else if (updateVariableWeights && variableTreeNode != null) 255 270 variableTreeNode.Weight = constants[i++]; 256 271 } … … 271 286 } 272 287 273 private static bool TryTransformToAutoDiff(ISymbolicExpressionTreeNode node, List<AutoDiff.Variable> variables, List<AutoDiff.Variable> parameters, List<string> variableNames, out AutoDiff.Term term) {288 private static bool TryTransformToAutoDiff(ISymbolicExpressionTreeNode node, List<AutoDiff.Variable> variables, List<AutoDiff.Variable> parameters, List<string> variableNames, bool updateVariableWeights, out AutoDiff.Term term) { 274 289 if (node.Symbol is Constant) { 275 290 var var = new AutoDiff.Variable(); … … 283 298 parameters.Add(par); 284 299 variableNames.Add(varNode.VariableName); 285 var w = new AutoDiff.Variable(); 286 variables.Add(w); 287 term = AutoDiff.TermBuilder.Product(w, par); 300 301 if (updateVariableWeights) { 302 var w = new AutoDiff.Variable(); 303 variables.Add(w); 304 term = AutoDiff.TermBuilder.Product(w, par); 305 } else { 306 term = par; 307 } 288 308 return true; 289 309 } … … 292 312 foreach (var subTree in node.Subtrees) { 293 313 AutoDiff.Term t; 294 if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, out t)) {314 if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, updateVariableWeights, out t)) { 295 315 term = null; 296 316 return false; … … 305 325 for (int i = 0; i < node.SubtreeCount; i++) { 306 326 AutoDiff.Term t; 307 if (!TryTransformToAutoDiff(node.GetSubtree(i), variables, parameters, variableNames, out t)) {327 if (!TryTransformToAutoDiff(node.GetSubtree(i), variables, parameters, variableNames, updateVariableWeights, out t)) { 308 328 term = null; 309 329 return false; … … 316 336 } 317 337 if (node.Symbol is Multiplication) { 318 AutoDiff.Term a, b; 319 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out a) || 320 !TryTransformToAutoDiff(node.GetSubtree(1), variables, parameters, variableNames, out b)) { 321 term = null; 322 return false; 323 } else { 324 List<AutoDiff.Term> factors = new List<Term>(); 325 foreach (var subTree in node.Subtrees.Skip(2)) { 326 AutoDiff.Term f; 327 if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, out f)) { 328 term = null; 329 return false; 330 } 331 factors.Add(f); 338 List<AutoDiff.Term> terms = new List<Term>(); 339 foreach (var subTree in node.Subtrees) { 340 AutoDiff.Term t; 341 if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, updateVariableWeights, out t)) { 342 term = null; 343 return false; 332 344 } 333 term = AutoDiff.TermBuilder.Product(a, b, factors.ToArray()); 334 return true; 335 } 345 terms.Add(t); 346 } 347 if (terms.Count == 1) term = terms[0]; 348 else term = terms.Aggregate((a, b) => new AutoDiff.Product(a, b)); 349 return true; 350 336 351 } 337 352 if (node.Symbol is Division) { 338 // only works for at least two subtrees 339 AutoDiff.Term a, b; 340 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out a) || 341 !TryTransformToAutoDiff(node.GetSubtree(1), variables, parameters, variableNames, out b)) { 342 term = null; 343 return false; 344 } else { 345 List<AutoDiff.Term> factors = new List<Term>(); 346 foreach (var subTree in node.Subtrees.Skip(2)) { 347 AutoDiff.Term f; 348 if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, out f)) { 349 term = null; 350 return false; 351 } 352 factors.Add(1.0 / f); 353 List<AutoDiff.Term> terms = new List<Term>(); 354 foreach (var subTree in node.Subtrees) { 355 AutoDiff.Term t; 356 if (!TryTransformToAutoDiff(subTree, variables, parameters, variableNames, updateVariableWeights, out t)) { 357 term = null; 358 return false; 353 359 } 354 term = AutoDiff.TermBuilder.Product(a, 1.0 / b, factors.ToArray()); 355 return true; 356 } 360 terms.Add(t); 361 } 362 if (terms.Count == 1) term = 1.0 / terms[0]; 363 else term = terms.Aggregate((a, b) => new AutoDiff.Product(a, 1.0 / b)); 364 return true; 357 365 } 358 366 if (node.Symbol is Logarithm) { 359 367 AutoDiff.Term t; 360 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {368 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 361 369 term = null; 362 370 return false; … … 368 376 if (node.Symbol is Exponential) { 369 377 AutoDiff.Term t; 370 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {378 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 371 379 term = null; 372 380 return false; … … 378 386 if (node.Symbol is Square) { 379 387 AutoDiff.Term t; 380 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {388 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 381 389 term = null; 382 390 return false; … … 385 393 return true; 386 394 } 387 } if (node.Symbol is SquareRoot) { 388 AutoDiff.Term t; 389 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 395 } 396 if (node.Symbol is SquareRoot) { 397 AutoDiff.Term t; 398 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 390 399 term = null; 391 400 return false; … … 394 403 return true; 395 404 } 396 } if (node.Symbol is Sine) { 397 AutoDiff.Term t; 398 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 405 } 406 if (node.Symbol is Sine) { 407 AutoDiff.Term t; 408 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 399 409 term = null; 400 410 return false; … … 403 413 return true; 404 414 } 405 } if (node.Symbol is Cosine) { 406 AutoDiff.Term t; 407 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 415 } 416 if (node.Symbol is Cosine) { 417 AutoDiff.Term t; 418 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 408 419 term = null; 409 420 return false; … … 412 423 return true; 413 424 } 414 } if (node.Symbol is Tangent) { 415 AutoDiff.Term t; 416 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 425 } 426 if (node.Symbol is Tangent) { 427 AutoDiff.Term t; 428 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 417 429 term = null; 418 430 return false; … … 421 433 return true; 422 434 } 423 } if (node.Symbol is Erf) { 424 AutoDiff.Term t; 425 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 435 } 436 if (node.Symbol is Erf) { 437 AutoDiff.Term t; 438 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 426 439 term = null; 427 440 return false; … … 430 443 return true; 431 444 } 432 } if (node.Symbol is Norm) { 433 AutoDiff.Term t; 434 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 445 } 446 if (node.Symbol is Norm) { 447 AutoDiff.Term t; 448 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out t)) { 435 449 term = null; 436 450 return false; … … 446 460 variables.Add(alpha); 447 461 AutoDiff.Term branchTerm; 448 if (TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out branchTerm)) {462 if (TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, updateVariableWeights, out branchTerm)) { 449 463 term = branchTerm * alpha + beta; 450 464 return true;
Note: See TracChangeset
for help on using the changeset viewer.