Free cookie consent management tool by TermsFeed Policy Generator

source: branches/LearningClassifierSystems/HeuristicLab.Encodings.ConditionActionEncoding/3.3/XCSClassifier.cs @ 10355

Last change on this file since 10355 was 9154, checked in by sforsten, 12 years ago

#1980:

  • added XCSSolution, XCSModel, XCSClassifier to represent the xcs classifier
  • XCSSolution also shows the current accuracy (training and test partition has to be added)
  • added XCSSolutionAnalyzer to create a XCSSolution during the run of the algorithm
  • added XCSModelView to show the xcs model
  • fixed a bug in XCSDeletionOperator (sometimes it deleted less classifiers than it should)
  • moved some parameter from ConditionActionClassificationProblem to ConditionActionClassificationProblemData
File size: 3.9 KB
RevLine 
[9154]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Data;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Encodings.ConditionActionEncoding {
28  [Item("XCSClassifier", "Represents a single XCS classifier")]
29  [StorableClass]
30  public class XCSClassifier : Item {
31
32    #region private variables
33    [Storable]
34    private IClassifier classifier;
35    [Storable]
36    private DoubleValue prediction;
37    [Storable]
38    private DoubleValue predictionError;
39    [Storable]
40    private DoubleValue fitness;
41    [Storable]
42    private IntValue experience;
43    [Storable]
44    private IntValue timestamp;
45    [Storable]
46    private DoubleValue averageActionSetSize;
47    [Storable]
48    private IntValue numerosity;
49    #endregion
50
51    #region properties
52    public IClassifier Classifier {
53      get { return classifier; }
54      set { classifier = value; }
55    }
56    public DoubleValue Prediction {
57      get { return prediction; }
58      set { prediction = value; }
59    }
60    public DoubleValue PredictionError {
61      get { return predictionError; }
62      set { predictionError = value; }
63    }
64    public DoubleValue Fitness {
65      get { return fitness; }
66      set { fitness = value; }
67    }
68    public IntValue Experience {
69      get { return experience; }
70      set { experience = value; }
71    }
72    public IntValue Timestamp {
73      get { return timestamp; }
74      set { timestamp = value; }
75    }
76    public DoubleValue AverageActionSetSize {
77      get { return averageActionSetSize; }
78      set { averageActionSetSize = value; }
79    }
80    public IntValue Numerosity {
81      get { return numerosity; }
82      set { numerosity = value; }
83    }
84    #endregion
85
86    [StorableConstructor]
87    protected XCSClassifier(bool deserializing) : base(deserializing) { }
88    protected XCSClassifier(XCSClassifier original, Cloner cloner)
89      : base(original, cloner) {
90      classifier = cloner.Clone(original.classifier);
91      prediction = cloner.Clone(original.prediction);
92      predictionError = cloner.Clone(original.predictionError);
93      fitness = cloner.Clone(original.fitness);
94      experience = cloner.Clone(original.experience);
95      timestamp = cloner.Clone(original.timestamp);
96      averageActionSetSize = cloner.Clone(original.averageActionSetSize);
97      numerosity = cloner.Clone(original.numerosity);
98    }
99    public override IDeepCloneable Clone(Cloner cloner) {
100      return new XCSClassifier(this, cloner);
101    }
102    public XCSClassifier() : base() { }
103    public XCSClassifier(IClassifier classifier, DoubleValue prediction, DoubleValue predictionError,
104      DoubleValue fitness, IntValue experience, IntValue timestamp, DoubleValue averageActionSetSize, IntValue numerosity) {
105
106      this.classifier = classifier;
107      this.prediction = prediction;
108      this.predictionError = predictionError;
109      this.fitness = fitness;
110      this.experience = experience;
111      this.timestamp = timestamp;
112      this.averageActionSetSize = averageActionSetSize;
113      this.numerosity = numerosity;
114    }
115  }
116}
Note: See TracBrowser for help on using the repository browser.