Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/11 12:35:14 (13 years ago)
Author:
gkronber
Message:

#1418 Implemented validation best solution analyzers for symbolic classification and regression, added analyzers to symbolic data analysis problem classes and changed details of parameter wiring in problem classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs

    r5623 r5685  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Parameters;
     27using HeuristicLab.Data;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     
    3133  public class SymbolicRegressionSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IRegressionProblemData, ISymbolicRegressionSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator> {
    3234    private const double PunishmentFactor = 10;
    33 
     35    private const int InitialMaximumTreeDepth = 8;
     36    private const int InitialMaximumTreeLength = 25;
     37    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     38    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
     39    private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic regression model.";
     40    private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic regression model.";
     41   
     42    #region parameter properties
     43    public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter {
     44      get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     45    }
     46    public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter {
     47      get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     48    }
     49    #endregion
     50    #region properties
     51    public DoubleValue LowerEstimationLimit {
     52      get { return LowerEstimationLimitParameter.Value; }
     53    }
     54    public DoubleValue UpperEstimationLimit {
     55      get { return UpperEstimationLimitParameter.Value; }
     56    }
     57    #endregion
    3458    [StorableConstructor]
    3559    protected SymbolicRegressionSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
     
    3963    public SymbolicRegressionSingleObjectiveProblem()
    4064      : base(new RegressionProblemData(), new SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
     65      Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue()));
     66      Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue()));
     67
    4168      Maximization.Value = true;
    42       MaximumSymbolicExpressionTreeDepth.Value = 8;
    43       MaximumSymbolicExpressionTreeLength.Value = 25;
     69      MaximumSymbolicExpressionTreeDepth.Value = InitialMaximumTreeDepth;
     70      MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength;
     71
     72      InitializeOperators();
    4473    }
    4574
    46     protected override void UpdateEstimationLimits() {
     75    private void InitializeOperators() {
     76      Operators.Add(new SymbolicRegressionSingleObjectiveTrainingBestSolutionAnalyzer());
     77      Operators.Add(new SymbolicRegressionSingleObjectiveValidationBestSolutionAnalyzer());
     78      ParameterizeOperators();
     79    }
     80   
     81    private void UpdateEstimationLimits() {
    4782      if (ProblemData.TrainingPartitionStart.Value < ProblemData.TrainingPartitionEnd.Value) {
    4883        var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartitionStart.Value, ProblemData.TrainingPartitionEnd.Value);
     
    5489    }
    5590
     91    protected override void OnProblemDataChanged() {
     92      base.OnProblemDataChanged();
     93      UpdateEstimationLimits();
     94    }
     95
     96    protected override void ParameterizeOperators() {
     97      base.ParameterizeOperators();
     98      var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
     99      foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedEvaluator<IRegressionProblemData>>()) {
     100        op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
     101        op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     102      }
     103    }
     104
    56105    public override void ImportProblemDataFromFile(string fileName) {
    57106      RegressionProblemData problemData = RegressionProblemData.ImportFromFile(fileName);
Note: See TracChangeset for help on using the changeset viewer.