Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2143: Added storable constructors.

File size: 2.3 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    private 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    [StorableConstructor]
33    private SymbolicClassificationPruningAnalyzer(bool deserializing) : base(deserializing) { }
34
35    public SymbolicClassificationPruningAnalyzer() {
36      // pruning parameters
37      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
38      impactValuesCalculator = new SymbolicClassificationSolutionImpactValuesCalculator();
39    }
40
41    protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree,
42      ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = Double.MinValue,
43      double upperEstimationLimit = Double.MaxValue) {
44      var model = ModelCreator.CreateSymbolicClassificationModel(tree, Interpreter, lowerEstimationLimit, upperEstimationLimit);
45      model.RecalculateModelParameters((IClassificationProblemData)ProblemData, ProblemData.TrainingIndices);
46      return model;
47    }
48  }
49}
Note: See TracBrowser for help on using the repository browser.