Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/DefaultClassificationAlgorithmOperators.cs @ 2351

Last change on this file since 2351 was 2351, checked in by gkronber, 15 years ago

Worked on SVM classification engine. #625

File size: 3.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 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 HeuristicLab.Core;
23using HeuristicLab.DataAnalysis;
24using HeuristicLab.GP.Interfaces;
25using HeuristicLab.Operators;
26using HeuristicLab.Modeling;
27using HeuristicLab.Data;
28
29namespace HeuristicLab.GP.StructureIdentification.Classification {
30  internal static class DefaultClassificationAlgorithmOperators {
31    internal static IOperator CreatePostProcessingOperator() {
32      SequentialProcessor seq = new SequentialProcessor();
33      seq.AddSubOperator(DefaultStructureIdentificationAlgorithmOperators.CreatePostProcessingOperator());
34
35      UniformSequentialSubScopesProcessor subScopesProc = new UniformSequentialSubScopesProcessor();
36      SequentialProcessor individualProc = new SequentialProcessor();
37      subScopesProc.AddSubOperator(individualProc);
38      seq.AddSubOperator(subScopesProc);
39      SimpleAccuracyEvaluator trainingAccuracy = new SimpleAccuracyEvaluator();
40      trainingAccuracy.Name = "TrainingAccuracyEvaluator";
41      trainingAccuracy.GetVariableInfo("Accuracy").ActualName = "TrainingAccuracy";
42      trainingAccuracy.GetVariableInfo("Values").ActualName = "TrainingValues";
43
44      SimpleAccuracyEvaluator validationAccuracy = new SimpleAccuracyEvaluator();
45      validationAccuracy.Name = "ValidationAccuracyEvaluator";
46      validationAccuracy.GetVariableInfo("Accuracy").ActualName = "ValidationAccuracy";
47      validationAccuracy.GetVariableInfo("Values").ActualName = "ValidationValues";
48
49      SimpleAccuracyEvaluator testAccuracy = new SimpleAccuracyEvaluator();
50      testAccuracy.Name = "TestAccuracyEvaluator";
51      testAccuracy.GetVariableInfo("Accuracy").ActualName = "TestAccuracy";
52      testAccuracy.GetVariableInfo("Values").ActualName = "TestValues";
53
54      individualProc.AddSubOperator(trainingAccuracy);
55      individualProc.AddSubOperator(validationAccuracy);
56      individualProc.AddSubOperator(testAccuracy);
57      return seq;
58    }
59
60    internal static IOperator CreateProblemInjector() {
61      CombinedOperator op = new CombinedOperator();
62      op.Name = "ProblemInjector";
63      SequentialProcessor seq = new SequentialProcessor();
64      seq.AddSubOperator(new ProblemInjector());
65      seq.AddSubOperator(new TargetClassesCalculator());
66      op.OperatorGraph.AddOperator(seq);
67      op.OperatorGraph.InitialOperator = seq;
68      return op;
69    }
70
71    internal static void SetModelData(IAnalyzerModel model, IScope scope) {
72      model.SetResult("TrainingAccuracy", scope.GetVariableValue<DoubleData>("TrainingAccuracy", true).Data);
73      model.SetResult("ValidationAccuracy", scope.GetVariableValue<DoubleData>("ValidationAccuracy", true).Data);
74      model.SetResult("TestAccuracy", scope.GetVariableValue<DoubleData>("TestAccuracy", true).Data);
75    }
76  }
77}
Note: See TracBrowser for help on using the repository browser.