Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/24/22 20:33:45 (3 years ago)
Author:
gkronber
Message:

#3136: reintegrated structure-template GP branch into trunk

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredAverageSimilarityEvaluator.cs

    r18132 r18220  
    7070    public override IOperation InstrumentedApply() {
    7171      IEnumerable<int> rows = GenerateRowsToEvaluate();
    72       var solution = SymbolicExpressionTreeParameter.ActualValue;
     72      var tree = SymbolicExpressionTreeParameter.ActualValue;
    7373      var problemData = ProblemDataParameter.ActualValue;
    7474      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
     
    7777
    7878      if (UseParameterOptimization) {
    79         SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, solution, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
     79        SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, tree, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
    8080      }
    8181
    82       double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling);
     82      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
     83        tree, problemData, rows, interpreter, applyLinearScaling,
     84        estimationLimits.Lower, estimationLimits.Upper);
    8385
    8486      if (DecimalPlaces >= 0)
     
    107109      var applyLinearScaling = ApplyLinearScalingParameter.ActualValue.Value;
    108110
    109       double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, estimationLimits.Lower, estimationLimits.Upper, problemData, rows, applyLinearScaling);
     111      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
     112        tree, problemData, rows,
     113        SymbolicDataAnalysisTreeInterpreterParameter.ActualValue,
     114        applyLinearScaling,
     115        estimationLimits.Lower, estimationLimits.Upper);
    110116
    111117      lock (locker) {
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNestedTreeSizeEvaluator.cs

    r18132 r18220  
    6363    }
    6464
    65     public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
    66       double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
     65    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
     66      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
     67         tree, problemData, rows,
     68         interpreter, applyLinearScaling,
     69         lowerEstimationLimit, upperEstimationLimit);
    6770      if (decimalPlaces >= 0)
    6871        r2 = Math.Round(r2, decimalPlaces);
    69       return new double[2] { r2, solution.IterateNodesPostfix().Sum(n => n.GetLength()) }; // sum of the length of the whole sub-tree for each node
     72      return new double[2] { r2, tree.IterateNodesPostfix().Sum(n => n.GetLength()) }; // sum of the length of the whole sub-tree for each node
    7073    }
    7174
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredNumberOfVariablesEvaluator.cs

    r18132 r18220  
    6262    }
    6363
    64     public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
    65       double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
     64    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
     65      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
     66        tree, problemData, rows, interpreter, applyLinearScaling,
     67        lowerEstimationLimit, upperEstimationLimit);
    6668      if (decimalPlaces >= 0)
    6769        r2 = Math.Round(r2, decimalPlaces);
    68       return new double[2] { r2, solution.IterateNodesPostfix().OfType<IVariableTreeNode>().Count() }; // count the number of variables
     70      return new double[2] { r2, tree.IterateNodesPostfix().OfType<IVariableTreeNode>().Count() }; // count the number of variables
    6971    }
    7072
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/PearsonRSquaredTreeComplexityEvaluator.cs

    r18132 r18220  
    6161    }
    6262
    63     public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
    64       double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
     63    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
     64      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
     65         tree, problemData, rows,
     66         interpreter, applyLinearScaling,
     67         lowerEstimationLimit, upperEstimationLimit);
    6568      if (decimalPlaces >= 0)
    6669        r2 = Math.Round(r2, decimalPlaces);
    67       return new double[2] { r2, SymbolicDataAnalysisModelComplexityCalculator.CalculateComplexity(solution) };
     70      return new double[2] { r2, SymbolicDataAnalysisModelComplexityCalculator.CalculateComplexity(tree) };
    6871    }
    6972
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r18132 r18220  
    2222using System;
    2323using System.Collections.Generic;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
    2728using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     
    4747    public override IOperation InstrumentedApply() {
    4848      IEnumerable<int> rows = GenerateRowsToEvaluate();
    49       var solution = SymbolicExpressionTreeParameter.ActualValue;
     49      var tree = SymbolicExpressionTreeParameter.ActualValue;
    5050      var problemData = ProblemDataParameter.ActualValue;
    5151      var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
     
    5454
    5555      if (UseParameterOptimization) {
    56         SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, solution, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
     56        SymbolicRegressionParameterOptimizationEvaluator.OptimizeParameters(interpreter, tree, problemData, rows, applyLinearScaling, ParameterOptimizationIterations, updateVariableWeights: ParameterOptimizationUpdateVariableWeights, lowerEstimationLimit: estimationLimits.Lower, upperEstimationLimit: estimationLimits.Upper);
    5757      }
    5858
    59       double[] qualities = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
     59      double[] qualities = Calculate(
     60        tree, ProblemDataParameter.ActualValue,
     61        rows, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue,
     62        ApplyLinearScalingParameter.ActualValue.Value,
     63        EstimationLimitsParameter.ActualValue.Lower,
     64        EstimationLimitsParameter.ActualValue.Upper,
     65        DecimalPlaces);
    6066      QualitiesParameter.ActualValue = new DoubleArray(qualities);
    6167      return base.InstrumentedApply();
    6268    }
    6369
    64     public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
    65       var mse = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(interpreter, solution, lowerEstimationLimit,
    66         upperEstimationLimit, problemData, rows, applyLinearScaling);
     70    public static double[] Calculate(
     71      ISymbolicExpressionTree tree,
     72      IRegressionProblemData problemData,
     73      IEnumerable<int> rows,
     74      ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
     75      bool applyLinearScaling,
     76      double lowerEstimationLimit, double upperEstimationLimit,
     77      int decimalPlaces) {
     78      var mse = SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.Calculate(
     79        tree, problemData, rows,
     80        interpreter, applyLinearScaling,
     81        lowerEstimationLimit,
     82        upperEstimationLimit);
    6783
    6884      if (decimalPlaces >= 0)
    6985        mse = Math.Round(mse, decimalPlaces);
    7086
    71       return new double[2] { mse, solution.Length };
     87      return new double[2] { mse, tree.Length };
    7288    }
    7389
     
    7793      ApplyLinearScalingParameter.ExecutionContext = context;
    7894
    79       double[] quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DecimalPlaces);
     95      double[] quality = Calculate(
     96        tree, problemData, rows,
     97        SymbolicDataAnalysisTreeInterpreterParameter.ActualValue,
     98        ApplyLinearScalingParameter.ActualValue.Value,
     99        EstimationLimitsParameter.ActualValue.Lower,
     100        EstimationLimitsParameter.ActualValue.Upper, DecimalPlaces);
    80101
    81102      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r18132 r18220  
    6161    }
    6262
    63     public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
    64       double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, problemData, rows, applyLinearScaling);
     63    public static double[] Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree tree, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling, int decimalPlaces) {
     64      double r2 = SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.Calculate(
     65        tree, problemData, rows, interpreter, applyLinearScaling,
     66        lowerEstimationLimit, upperEstimationLimit);
    6567      if (decimalPlaces >= 0)
    6668        r2 = Math.Round(r2, decimalPlaces);
    67       return new double[2] { r2, solution.Length };
     69      return new double[2] { r2, tree.Length };
    6870    }
    6971
Note: See TracChangeset for help on using the changeset viewer.