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
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj

    r5649 r5685  
    109109  <ItemGroup>
    110110    <Compile Include="Interfaces\ISymbolicDiscriminantFunctionClassificationModel.cs" />
     111    <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" />
     112    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs" />
    111113    <Compile Include="SymbolicDiscriminantFunctionClassificationModel.cs" />
    112114    <Compile Include="SymbolicDiscriminantFunctionClassificationSolution.cs" />
  • 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}
  • 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.