Changeset 18093 for branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
- Timestamp:
- 11/24/21 13:40:39 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r17944 r18093 32 32 33 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 34 [Item(" ConstantOptimization Evaluator", "Calculates Pearson R² of a symbolic regression solution and optimizes the constant used.")]34 [Item("Num Optimization Evaluator", "Calculates Pearson R² of a symbolic regression solution and optimizes the constant used.")] 35 35 [StorableType("24B68851-036D-4446-BD6F-3823E9028FF4")] 36 36 public class SymbolicRegressionConstantOptimizationEvaluator : SymbolicRegressionSingleObjectiveEvaluator { … … 307 307 int i = 0; 308 308 foreach (var node in tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>()) { 309 ConstantTreeNode constantTreeNode = node as ConstantTreeNode;309 NumTreeNode numTreeNode = node as NumTreeNode; 310 310 VariableTreeNodeBase variableTreeNodeBase = node as VariableTreeNodeBase; 311 311 FactorVariableTreeNode factorVarTreeNode = node as FactorVariableTreeNode; 312 if ( constantTreeNode != null) {313 if ( constantTreeNode.Parent.Symbol is Power314 && constantTreeNode.Parent.GetSubtree(1) == constantTreeNode) continue; // exponents in powers are not optimizated (see TreeToAutoDiffTermConverter)315 constantTreeNode.Value = constants[i++];312 if (numTreeNode != null) { 313 if (numTreeNode.Parent.Symbol is Power 314 && numTreeNode.Parent.GetSubtree(1) == numTreeNode) continue; // exponents in powers are not optimizated (see TreeToAutoDiffTermConverter) 315 numTreeNode.Value = constants[i++]; 316 316 } else if (updateVariableWeights && variableTreeNodeBase != null) 317 317 variableTreeNodeBase.Weight = constants[i++];
Note: See TracChangeset
for help on using the changeset viewer.