Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18104


Ignore:
Timestamp:
12/03/21 13:46:20 (3 years ago)
Author:
dpiringe
Message:

#3136

  • overrode the method GetActualValue in ValueLookupParameter to get the default value when the execution context is null
  • reverted the linear scaling logic for NMSESingleObjectiveConstraintsEvaluator
  • in SymbolicRegressionConstantOptimizationEvaluator: removed the usage of GenerateRowsToEvaluate because it uses lookup parameters
  • set the value of RelativeNumberOfEvaluatedSamplesParameter for SymbolicRegressionConstantOptimizationEvaluator in StructuredSymbolicRegressionSingleObjectiveProblem if Maximization = true and the SymbolicRegressionConstantOptimizationEvaluator is configured as evaluator
  • added the SubFunctionSymbol in TreeToAutoDiffTermConverter
Location:
branches/3136_Structural_GP
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r17180 r18104  
    151151    }
    152152
     153    protected override IItem GetActualValue() {
     154      if (ExecutionContext == null)
     155        return Value;
     156      return base.GetActualValue();
     157    }
     158
    153159    public override string ToString() {
    154160      if (Value != null)
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/NMSESingleObjectiveConstraintsEvaluator.cs

    r18103 r18104  
    141141                            .GetSubtree(0); //Offset
    142142      var scaling = offset.GetSubtree(0);
    143 
     143     
    144144      //Check if tree contains offset and scaling nodes
    145145      if (!(offset.Symbol is Addition) || !(scaling.Symbol is Multiplication))
     
    155155
    156156      var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
    157       OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out var alpha, out var beta,
    158         out var errorState);
     157      OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out var alpha, out var beta, out var errorState);
    159158      if (errorState == OnlineCalculatorError.None) {
    160159        //Set alpha and beta to the scaling nodes from ia grammar
     
    249248          interpreter, tree,
    250249          problemData, rows,
    251           applyLinearScaling: false, // OptimizeConstants deletes the scaling terms -> wrong estimations
     250          applyLinearScaling: false, // Tree already contains scaling terms
    252251          ConstantOptimizationIterations,
    253252          updateVariableWeights: true,
     
    255254          upperEstimationLimit);
    256255     
    257       if (applyLinearScaling) // extra scaling terms, which are included in tree
    258         CalcLinearScalingTerms(tree, problemData, rows, interpreter);
    259 
     256      else if (applyLinearScaling) // extra scaling terms, which are included in tree
     257        CalcLinearScalingTerms(tree, problemData, rows, interpreter); 
     258     
    260259      return Calculate(
    261260        tree, problemData,
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r18103 r18104  
    202202      var propability = random.NextDouble();
    203203      if (propability < ConstantOptimizationProbability.Value) {
    204         IEnumerable<int> constantOptimizationRows = GenerateRowsToEvaluate(ConstantOptimizationRowsPercentage.Value);
    205204        quality = OptimizeConstants(
    206205          interpreter, tree,
    207           problemData, constantOptimizationRows,
     206          problemData, rows,
    208207          applyLinearScaling,
    209208          ConstantOptimizationIterations.Value,
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs

    r18103 r18104  
    5959    }
    6060
    61     //TODO: refactor like evaluate method
    6261    public static double Calculate(
    6362      ISymbolicExpressionTree tree,
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs

    r18103 r18104  
    194194      individual[SymbolicExpressionTreeName] = tree;
    195195
    196       if(TreeEvaluatorParameter.Value is SymbolicRegressionConstantOptimizationEvaluator)
    197         TreeEvaluatorParameter.Value.RandomParameter.Value = random;
     196      // dpiringe: needed when Maximization = true
     197      if (TreeEvaluatorParameter.Value is SymbolicRegressionConstantOptimizationEvaluator constantOptEvaluator) {
     198        constantOptEvaluator.RandomParameter.Value = random;
     199        constantOptEvaluator.RelativeNumberOfEvaluatedSamplesParameter.Value =
     200          (PercentValue)constantOptEvaluator.ConstantOptimizationRowsPercentage.Clone();
     201      }
    198202
    199203      return TreeEvaluatorParameter.Value.Evaluate(
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs

    r17817 r18104  
    302302          return t * alpha + beta;
    303303        } else return ConvertToAutoDiff(node.GetSubtree(0));
     304      }
     305      if (node.Symbol is SubFunctionSymbol) {
     306        return ConvertToAutoDiff(node.GetSubtree(0));
    304307      }
    305308      throw new ConversionException();
     
    350353          !(n.Symbol is Cube) &&
    351354          !(n.Symbol is CubeRoot) &&
    352           !(n.Symbol is Power)
     355          !(n.Symbol is Power) &&
     356          !(n.Symbol is SubFunctionSymbol)
    353357        select n).Any();
    354358      return !containsUnknownSymbol;
Note: See TracChangeset for help on using the changeset viewer.