Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 10396 was 10396, checked in by bburlacu, 10 years ago

#1837: Introduced the SlidingWindowBestSolutionsCollectionView which shows how well each individual sliding window solution performs on the other portions of the training data.

File size: 2.2 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Optimization;
4using HeuristicLab.Parameters;
5using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
6
7namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
8  [StorableClass]
9  [Item("Generational Classification Sliding Window Analyzer", "")]
10  public class GenerationalClassificationSlidingWindowAnalyzer : GenerationalSlidingWindowAnalyzer {
11    private const string ModelCreatorParameterName = "ModelCreator";
12    #region parameter properties
13    public ILookupParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter {
14      get { return (ILookupParameter<ISymbolicClassificationModelCreator>)Parameters[ModelCreatorParameterName]; }
15    }
16    #endregion
17    #region properties
18    private ISymbolicClassificationModelCreator ModelCreator {
19      get { return ModelCreatorParameter.ActualValue; }
20      set { ModelCreatorParameter.ActualValue = value; }
21    }
22    #endregion
23
24    [StorableConstructor]
25    protected GenerationalClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
26    protected GenerationalClassificationSlidingWindowAnalyzer(GenerationalClassificationSlidingWindowAnalyzer original, Cloner cloner)
27      : base(original, cloner) {
28    }
29    public override IDeepCloneable Clone(Cloner cloner) {
30      return new GenerationalClassificationSlidingWindowAnalyzer(this, cloner);
31    }
32    [StorableHook(HookType.AfterDeserialization)]
33    private void AfterDeserialization() {
34    }
35
36    public GenerationalClassificationSlidingWindowAnalyzer() {
37      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
38    }
39
40    public override IOperation Apply() {
41      if (!ResultCollection.ContainsKey("Best Solutions")) {
42        ResultCollection.Add(new Result("Best Solutions", new SlidingWindowBestClassificationSolutionsCollection()));
43      }
44      var bestSolutions = (SlidingWindowBestClassificationSolutionsCollection)ResultCollection["Best Solutions"].Value;
45      bestSolutions.ModelCreator = ModelCreator;
46      return base.Apply();
47    }
48  }
49}
Note: See TracBrowser for help on using the repository browser.