Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs @ 10677

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

#1837: Added SlidingWindowQualitiesAnalyzer.

File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
26using HeuristicLab.Parameters;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28
29namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
30  [Item("SymbolicClassificationPruningAnalyzer", "An analyzer that prunes introns from the population.")]
31  [StorableClass]
32  public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer {
33    private const string ModelCreatorParameterName = "ModelCreator";
34    #region parameter properties
35    public ILookupParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter {
36      get { return (ILookupParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
37    }
38    #endregion
39    #region properties
40    private ISymbolicClassificationModelCreator ModelCreator {
41      get { return ModelCreatorParameter.ActualValue; }
42      set { ModelCreatorParameter.ActualValue = value; }
43    }
44    #endregion
45
46    private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)
47      : base(original, cloner) {
48    }
49    public override IDeepCloneable Clone(Cloner cloner) {
50      return new SymbolicClassificationPruningAnalyzer(this, cloner);
51    }
52
53    [StorableConstructor]
54    private SymbolicClassificationPruningAnalyzer(bool deserializing) : base(deserializing) { }
55
56    public SymbolicClassificationPruningAnalyzer() {
57      // pruning parameters
58      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
59      impactValuesCalculator = new SymbolicClassificationSolutionImpactValuesCalculator();
60    }
61
62    protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree,
63      ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = Double.MinValue,
64      double upperEstimationLimit = Double.MaxValue) {
65      var model = ModelCreator.CreateSymbolicClassificationModel(tree, Interpreter, lowerEstimationLimit, upperEstimationLimit);
66      model.RecalculateModelParameters((IClassificationProblemData)ProblemData, ProblemData.TrainingIndices);
67      return model;
68    }
69  }
70}
Note: See TracBrowser for help on using the repository browser.