Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/11 12:35:14 (14 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.

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs

    r5623 r5685  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Parameters;
     26using HeuristicLab.Data;
    2527
    2628namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3032  public class SymbolicClassificationSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IClassificationProblemData, ISymbolicClassificationSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator> {
    3133    private const double PunishmentFactor = 10;
     34    private const int InitialMaximumTreeDepth = 8;
     35    private const int InitialMaximumTreeLength = 25;
     36    private const string LowerEstimationLimitParameterName = "LowerEstimationLimit";
     37    private const string UpperEstimationLimitParameterName = "UpperEstimationLimit";
     38    private const string LowerEstimationLimitParameterDescription = "The lower limit for the estimated value that can be returned by the symbolic classification model.";
     39    private const string UpperEstimationLimitParameterDescription = "The upper limit for the estimated value that can be returned by the symbolic classification model.";
    3240
     41    #region parameter properties
     42    public IFixedValueParameter<DoubleValue> LowerEstimationLimitParameter {
     43      get { return (IFixedValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     44    }
     45    public IFixedValueParameter<DoubleValue> UpperEstimationLimitParameter {
     46      get { return (IFixedValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     47    }
     48    #endregion
     49    #region properties
     50    public DoubleValue LowerEstimationLimit {
     51      get { return LowerEstimationLimitParameter.Value; }
     52    }
     53    public DoubleValue UpperEstimationLimit {
     54      get { return UpperEstimationLimitParameter.Value; }
     55    }
     56    #endregion
    3357    [StorableConstructor]
    3458    protected SymbolicClassificationSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
     
    3862    public SymbolicClassificationSingleObjectiveProblem()
    3963      : base(new ClassificationProblemData(), new SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
    40       MaximumSymbolicExpressionTreeDepth.Value = 8;
    41       MaximumSymbolicExpressionTreeLength.Value = 25;
     64      Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue()));
     65      Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue()));
     66
     67      MaximumSymbolicExpressionTreeDepth.Value = InitialMaximumTreeDepth;
     68      MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength;
     69
     70      InitializeOperators();
    4271    }
    4372
    44     protected override void UpdateEstimationLimits() {
     73    private void InitializeOperators() {
     74      Operators.Add(new SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer());
     75      Operators.Add(new SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer());
     76      ParameterizeOperators();
     77    }
     78
     79    private void UpdateEstimationLimits() {
    4580      if (ProblemData.TrainingPartitionStart.Value < ProblemData.TrainingPartitionEnd.Value) {
    4681        var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartitionStart.Value, ProblemData.TrainingPartitionEnd.Value);
     
    5287    }
    5388
     89    protected override void OnProblemDataChanged() {
     90      base.OnProblemDataChanged();
     91      UpdateEstimationLimits();
     92    }
     93
     94    protected override void ParameterizeOperators() {
     95      base.ParameterizeOperators();
     96      var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
     97      foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedEvaluator<IClassificationProblemData>>()) {
     98        op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
     99        op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     100      }
     101    }
     102
    54103    public override void ImportProblemDataFromFile(string fileName) {
    55104      ClassificationProblemData problemData = ClassificationProblemData.ImportFromFile(fileName);
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5681 r5685  
    6262    public SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer()
    6363      : base() {
     64      Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution."));
     65      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
    6466    }
    6567    public override IDeepCloneable Clone(Cloner cloner) {
Note: See TracChangeset for help on using the changeset viewer.