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.

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

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs

    r5623 r5685  
    2424using HeuristicLab.Data;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HeuristicLab.Parameters;
    2627
    2728namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3132  public class SymbolicClassificationMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IClassificationProblemData, ISymbolicClassificationMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator> {
    3233    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.";
    3340
     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
    3457    [StorableConstructor]
    3558    protected SymbolicClassificationMultiObjectiveProblem(bool deserializing) : base(deserializing) { }
     
    3962    public SymbolicClassificationMultiObjectiveProblem()
    4063      : base(new ClassificationProblemData(), new SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(), new SymbolicDataAnalysisExpressionTreeCreator()) {
     64      Parameters.Add(new FixedValueParameter<DoubleValue>(LowerEstimationLimitParameterName, LowerEstimationLimitParameterDescription, new DoubleValue()));
     65      Parameters.Add(new FixedValueParameter<DoubleValue>(UpperEstimationLimitParameterName, UpperEstimationLimitParameterDescription, new DoubleValue()));
     66
    4167      Maximization = new BoolArray(new bool[] { false, false });
    42       MaximumSymbolicExpressionTreeDepth.Value = 8;
    43       MaximumSymbolicExpressionTreeLength.Value = 25;
     68      MaximumSymbolicExpressionTreeDepth.Value = InitialMaximumTreeDepth;
     69      MaximumSymbolicExpressionTreeLength.Value = InitialMaximumTreeLength;
     70
     71      InitializeOperators();
    4472    }
    4573
    46     protected override void UpdateEstimationLimits() {
     74    private void InitializeOperators() {
     75      Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer());
     76      Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer());
     77      ParameterizeOperators();
     78    }
     79
     80    private void UpdateEstimationLimits() {
    4781      if (ProblemData.TrainingPartitionStart.Value < ProblemData.TrainingPartitionEnd.Value) {
    4882        var targetValues = ProblemData.Dataset.GetVariableValues(ProblemData.TargetVariable, ProblemData.TrainingPartitionStart.Value, ProblemData.TrainingPartitionEnd.Value);
     
    5488    }
    5589
     90    protected override void OnProblemDataChanged() {
     91      base.OnProblemDataChanged();
     92      UpdateEstimationLimits();
     93    }
     94
     95    protected new void ParameterizeOperators() {
     96      base.ParameterizeOperators();
     97      var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators);
     98      foreach (var op in operators.OfType<ISymbolicDataAnalysisBoundedEvaluator<IClassificationProblemData>>()) {
     99        op.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameterName;
     100        op.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameterName;
     101      }
     102    }
     103
    56104    public override void ImportProblemDataFromFile(string fileName) {
    57105      ClassificationProblemData problemData = ClassificationProblemData.ImportFromFile(fileName);
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5681 r5685  
    6363      : base() {
    6464      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."));
    6566    }
    6667    public override IDeepCloneable Clone(Cloner cloner) {
     
    7778      var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, classValues, thresholds);
    7879      return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData);
    79     } 
     80    }
    8081  }
    8182}
Note: See TracChangeset for help on using the changeset viewer.