Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/27/20 22:22:54 (4 years ago)
Author:
chaider
Message:

#3076

  • Removed UseSplitting parameter from analyzer
  • Added BoundEstimatorParameter to evaluator
Location:
branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintConstOptNmseEvaluator.cs

    r17751 r17764  
    1616    private const string ConstOptIterationsParameterName = "ConstOpt Iterations";
    1717    private const string PenalityMultiplierParameterName = "ConstraintsPenalityMultiplier";
     18    private const string BoundsEstimatorParameterName = "Bounds estimator";
    1819
    1920    public IFixedValueParameter<BoolValue> UseConstOptParamerter =>
     
    2627      (ILookupParameter<DoubleValue>)Parameters[PenalityMultiplierParameterName];
    2728
     29    public IValueParameter<IBoundsEstimator> BoundsEstimatorParameter =>
     30      (IValueParameter<IBoundsEstimator>) Parameters[BoundsEstimatorParameterName];
     31
    2832    public bool UseConstOpt {
    2933      get => UseConstOptParamerter.Value.Value;
     
    3438      get => ConstOpterIterationsParameter.Value.Value;
    3539      set => ConstOpterIterationsParameter.Value.Value = value;
     40    }
     41
     42    public IBoundsEstimator BoundsEstimator {
     43      get => BoundsEstimatorParameter.Value;
     44      set => BoundsEstimatorParameter.Value = value;
    3645    }
    3746
     
    5463      Parameters.Add(new LookupParameter<DoubleValue>(PenalityMultiplierParameterName,
    5564        "Lookup parameter for the penality multiplier.", "PenalityMultiplier"));
     65      Parameters.Add(new ValueParameter<IBoundsEstimator>(BoundsEstimatorParameterName, "Select the Boundsestimator.", new IABoundsEstimator()));
    5666    }
    5767
     
    7383        Parameters.Add(new LookupParameter<DoubleValue>(PenalityMultiplierParameterName,
    7484          "Lookup parameter for the penality multiplier.", "PenalityMultiplier"));
     85
     86      if (!Parameters.ContainsKey(BoundsEstimatorParameterName))
     87        Parameters.Add(new ValueParameter<IBoundsEstimator>(BoundsEstimatorParameterName, "Select the Boundsestimator.", new IABoundsEstimator()));
    7588    }
    7689
    7790    public override IOperation InstrumentedApply() {
    78       var rows                                      = GenerateRowsToEvaluate();
    79       var solution                                  = SymbolicExpressionTreeParameter.ActualValue;
     91      var rows                         = GenerateRowsToEvaluate();
     92      var solution                = SymbolicExpressionTreeParameter.ActualValue;
    8093      var problemData                               = ProblemDataParameter.ActualValue;
    8194      var interpreter                               = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue;
    82       var estimationLimits                          = EstimationLimitsParameter.ActualValue;
     95      var estimationLimits                 = EstimationLimitsParameter.ActualValue;
    8396      var applyLinearScaling                        = false;
    84       var constantOptimizationIterations            = ConstOptIterations;
     97      var constantOptimizationIterations         = ConstOptIterations;
    8598      var constantOptimizationUpdateVariableWeights = true;
    8699
     
    115128      var boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    116129      var nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, out var errorState);
    117       if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution, false, out double error))
     130      if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution, out double error))
    118131      {
    119132        if (double.IsNaN(error) || double.IsInfinity(error))
  • branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintEvaluator.cs

    r17751 r17764  
    2727    private const string PenaltyMultiplierParameterName = "Constraints Penalty Multiplier";
    2828
    29     private const string UseIntervalSplittingParameterName = "Use Interval Splitting";
     29    private const string BoundsEstimatorParameterName = "Bounds estimator";
     30
    3031
    3132    public IFixedValueParameter<BoolValue> UseConstantOptimizationParameter =>
     
    4142      (IFixedValueParameter<DoubleValue>) Parameters[PenaltyMultiplierParameterName];
    4243
    43     public IFixedValueParameter<BoolValue> UseIntervalSplittingParameter =>
    44       (IFixedValueParameter<BoolValue>) Parameters[UseIntervalSplittingParameterName];
     44    public IValueParameter<IBoundsEstimator> BoundsEstimatorParameter =>
     45      (IValueParameter<IBoundsEstimator>)Parameters[BoundsEstimatorParameterName];
    4546
    4647    public bool UseConstantOptimization {
     
    6465    }
    6566
    66     public bool UseIntervalSplitting {
    67       get => UseIntervalSplittingParameter.Value.Value;
    68       set => UseIntervalSplittingParameter.Value.Value = value;
    69     }
     67    public IBoundsEstimator BoundsEstimator {
     68      get => BoundsEstimatorParameter.Value;
     69      set => BoundsEstimatorParameter.Value = value;
     70    }
     71
    7072
    7173    //Use false for maximization, because we try to minimize the NMSE
     
    9193      Parameters.Add(new FixedValueParameter<DoubleValue>(PenaltyMultiplierParameterName,
    9294        "Specify how hard constraints violations should be punished", new DoubleValue(1.0)));
    93       Parameters.Add(new FixedValueParameter<BoolValue>(UseIntervalSplittingParameterName,
    94         "Define whether interval splitting is used or not.", new BoolValue(false)));
     95      Parameters.Add(new ValueParameter<IBoundsEstimator>(BoundsEstimatorParameterName,
     96        "Select the Boundsestimator.", new IABoundsEstimator()));
    9597    }
    9698
     
    117119      }
    118120
    119       if (!Parameters.ContainsKey(UseIntervalSplittingParameterName)) {
    120         Parameters.Add(new FixedValueParameter<BoolValue>(UseIntervalSplittingParameterName,
    121           "Define whether interval splitting is used or not.", new BoolValue(false)));
    122       }
     121      if (!Parameters.ContainsKey(BoundsEstimatorParameterName))
     122        Parameters.Add(new ValueParameter<IBoundsEstimator>(BoundsEstimatorParameterName,
     123          "Select the Boundsestimator.", new IABoundsEstimator()));
     124
    123125    }
    124126
     
    176178
    177179      var quality = Calculate(interpreter, solution, estimationLimits.Lower, estimationLimits.Upper, problemData, rows,
    178         UseSoftConstraints,
    179         PenaltyMultiplier, UseIntervalSplitting);
     180        UseSoftConstraints, PenaltyMultiplier);
    180181      QualityParameter.ActualValue = new DoubleValue(quality);
    181182
     
    188189      double upperEstimationLimit,
    189190      IRegressionProblemData problemData, IEnumerable<int> rows, bool useSoftConstraints,
    190       double penaltyMultiplier, bool useSplitting) {
     191      double penaltyMultiplier) {
    191192      var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
    192193      var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
     
    198199        out var errorState);
    199200
    200       if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution, useSplitting,
     201      if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution,
    201202        out var error)) {
    202203        if (useSoftConstraints) {
     
    229230      var nmse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree,
    230231        EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper,
    231         problemData, rows, UseSoftConstraints, PenaltyMultiplier, UseIntervalSplitting);
     232        problemData, rows, UseSoftConstraints, PenaltyMultiplier);
    232233
    233234      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveConstraintScalingNmseEvaluator.cs

    r17751 r17764  
    8585      var variableRanges = problemData.VariableRanges.GetReadonlyDictionary();
    8686
    87       if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution, false, out double error))
     87      if (!SymbolicRegressionConstraintAnalyzer.ConstraintsSatisfied(constraints, variableRanges, solution, out double error))
    8888        return 1.0;
    8989
  • branches/3076_IA_evaluators_analyzers/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionConstraintAnalyzer.cs

    r17761 r17764  
    226226    public static bool ConstraintsSatisfied(IEnumerable<IntervalConstraint> constraints,
    227227                                            IReadOnlyDictionary<string, Interval> variableRanges,
    228                                             ISymbolicExpressionTree solution, bool useSplitting,
     228                                            ISymbolicExpressionTree solution,
    229229                                            out double error) {
    230       var intervalInterpreter = new IntervalInterpreter() {UseIntervalSplitting = useSplitting};
     230      var intervalInterpreter = new IntervalInterpreter();
    231231      error = 0.0;
    232232      var satisfied = true;
Note: See TracChangeset for help on using the changeset viewer.