Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18152


Ignore:
Timestamp:
12/17/21 15:02:57 (2 years ago)
Author:
dpiringe
Message:

#3136

  • removed the calculation of EstimationLimits and set the interval [-inf, inf] as default
    • this parameter was never adjusted after problem construction -> caused bugs with the change of problem data
  • created two new method to setup/create the MultiEncoding and SymbolicExpressionTreeEncoding
  • configured the default template f(_) for a structure template
Location:
branches/3136_Structural_GP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/StructuredSymbolicRegressionSingleObjectiveProblem.cs

    r18151 r18152  
    8080      var shapeConstraintProblemData = new ShapeConstrainedRegressionProblemData(problemData);
    8181
    82       var targetInterval = shapeConstraintProblemData.VariableRanges.GetInterval(shapeConstraintProblemData.TargetVariable);
    83       var estimationWidth = targetInterval.Width * 10;
    84 
    8582      var structureTemplate = new StructureTemplate();
    8683
     
    109106      Parameters.Add(new FixedValueParameter<DoubleLimit>(
    110107        EstimationLimitsParameterName,
    111         new DoubleLimit(targetInterval.LowerBound - estimationWidth, targetInterval.UpperBound + estimationWidth)) { Hidden = true });
     108        new DoubleLimit(double.NegativeInfinity, double.PositiveInfinity)) { Hidden = true });
    112109
    113110      Parameters.Add(new ResultParameter<ISymbolicRegressionSolution>(BestTrainingSolutionParameterName, "") { Hidden = true });
     
    173170      foreach (var f in StructureTemplate.SubFunctions) {
    174171        SetupVariables(f);
    175         if (!Encoding.Encodings.Any(x => x.Name == f.Name)) // to prevent the same encoding twice
    176           Encoding.Add(new SymbolicExpressionTreeEncoding(
    177             f.Name,
    178             f.Grammar,
    179             f.MaximumSymbolicExpressionTreeLength,
    180             f.MaximumSymbolicExpressionTreeDepth));
    181       }
     172        // to prevent the same encoding twice
     173        if (!Encoding.Encodings.Any(x => x.Name == f.Name))
     174          Encoding.Add(CreateEncoding(f));
     175      }
     176
     177      ParameterizeEncoding();
    182178    }
    183179
     
    261257    }
    262258
     259    private SymbolicExpressionTreeEncoding CreateEncoding(SubFunction subFunction) {
     260      var encoding = new SymbolicExpressionTreeEncoding(
     261            subFunction.Name,
     262            subFunction.Grammar,
     263            subFunction.MaximumSymbolicExpressionTreeLength,
     264            subFunction.MaximumSymbolicExpressionTreeDepth);
     265      return encoding;
     266    }
     267
     268    private void ParameterizeEncoding() {
     269      var manipulator = (IParameterizedItem)Encoding.Operators.OfType<MultiEncodingManipulator>().FirstOrDefault();
     270      if (manipulator != null) {
     271        foreach (var param in manipulator.Parameters.OfType<ConstrainedValueParameter<IManipulator>>()) {
     272          var m = param.ValidValues.OfType<MultiSymbolicExpressionTreeManipulator>().FirstOrDefault();
     273          param.Value = m == null ? param.ValidValues.First() : m;
     274        }
     275      }
     276    }
    263277    private void SetupVariables(SubFunction subFunction) {
    264278      var varSym = (Variable)subFunction.Grammar.GetSymbol(VariableName);
     
    296310    public void Load(IRegressionProblemData data) {
    297311      ProblemData = data;
    298       StructureTemplate.Template = "f(_)";
    299312    }
    300313  }
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/StructureTemplate/StructureTemplate.cs

    r18151 r18152  
    9393      treeWithoutLinearScaling = null;
    9494      treeWithLinearScaling = null;
    95       template = "";
    9695      applyLinearScaling = false;
     96      Template = "f(_)";
    9797      OnChanged();
    9898    }
Note: See TracChangeset for help on using the changeset viewer.