Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs @ 10368

Last change on this file since 10368 was 10368, checked in by bburlacu, 11 years ago

#2143: Implemented symbolic data analysis pruning operator and analyzers.

File size: 2.2 KB
Line 
1using System;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
5using HeuristicLab.Parameters;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7
8namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
9  [Item("SymbolicClassificationPruningAnalyzer", "An analyzer that prunes introns from the population.")]
10  [StorableClass]
11  public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer {
12    private const string ModelCreatorParameterName = "ModelCreator";
13    #region parameter properties
14    public ILookupParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter {
15      get { return (ILookupParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
16    }
17    #endregion
18    #region properties
19    private ISymbolicClassificationModelCreator ModelCreator {
20      get { return ModelCreatorParameter.ActualValue; }
21      set { ModelCreatorParameter.ActualValue = value; }
22    }
23    #endregion
24
25    protected SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)
26      : base(original, cloner) {
27    }
28    public override IDeepCloneable Clone(Cloner cloner) {
29      return new SymbolicClassificationPruningAnalyzer(this, cloner);
30    }
31
32    public SymbolicClassificationPruningAnalyzer() {
33      // pruning parameters
34      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
35      impactValuesCalculator = new SymbolicClassificationSolutionImpactValuesCalculator();
36    }
37
38    protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree,
39      ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = Double.MinValue,
40      double upperEstimationLimit = Double.MaxValue) {
41      var model = ModelCreator.CreateSymbolicClassificationModel(tree, Interpreter, lowerEstimationLimit, upperEstimationLimit);
42      model.RecalculateModelParameters((IClassificationProblemData)ProblemData, ProblemData.TrainingIndices);
43      return model;
44    }
45  }
46}
Note: See TracBrowser for help on using the repository browser.