Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/21 13:40:39 (3 years ago)
Author:
chaider
Message:

#3041

  • Renaming Constant Symbol to Num, behaves like before
  • Adding new Symbol RealConstant (Constant), this symbol behaves now like a real constant, won't be changed by parameter optimization or manipulators
  • Refactored classes part1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r17944 r18093  
    3232
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
    34   [Item("Constant Optimization 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.")]
    3535  [StorableType("24B68851-036D-4446-BD6F-3823E9028FF4")]
    3636  public class SymbolicRegressionConstantOptimizationEvaluator : SymbolicRegressionSingleObjectiveEvaluator {
     
    307307      int i = 0;
    308308      foreach (var node in tree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTerminalNode>()) {
    309         ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
     309        NumTreeNode numTreeNode = node as NumTreeNode;
    310310        VariableTreeNodeBase variableTreeNodeBase = node as VariableTreeNodeBase;
    311311        FactorVariableTreeNode factorVarTreeNode = node as FactorVariableTreeNode;
    312         if (constantTreeNode != null) {
    313           if (constantTreeNode.Parent.Symbol is Power
    314               && 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++];
    316316        } else if (updateVariableWeights && variableTreeNodeBase != null)
    317317          variableTreeNodeBase.Weight = constants[i++];
Note: See TracChangeset for help on using the changeset viewer.