1 | using System;
|
---|
2 | using HeuristicLab.Common;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
5 | using HeuristicLab.Parameters;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 |
|
---|
8 | namespace 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 | }
|
---|