[10368] | 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 |
|
---|
[10375] | 25 | private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)
|
---|
[10368] | 26 | : base(original, cloner) {
|
---|
| 27 | }
|
---|
| 28 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 29 | return new SymbolicClassificationPruningAnalyzer(this, cloner);
|
---|
| 30 | }
|
---|
| 31 |
|
---|
[10378] | 32 | [StorableConstructor]
|
---|
| 33 | private SymbolicClassificationPruningAnalyzer(bool deserializing) : base(deserializing) { }
|
---|
| 34 |
|
---|
[10368] | 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 | }
|
---|