source: trunk/lib/classifier/EnsembleBuilder.h @ 531

Last change on this file since 531 was 531, checked in by Markus Ringnér, 17 years ago

Note there are some problem when creating MatrixLookups? from MatrixLookups? and index vectors. Halfway on the path to finding the bugs. This means CrossSplitter? and layers of CrossSplitters? do not work properly.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: EnsembleBuilder.h 531 2006-03-02 17:35:12Z markus $
2
3#ifndef _theplu_classifier_ensemblebuilder_
4#define _theplu_classifier_ensemblebuilder_
5
6#include <c++_tools/statistics/Averager.h>
7
8#include <vector>
9
10namespace theplu {
11namespace classifier { 
12
13  class CrossSplitter;
14  class DataLookup2D;
15  class SupervisedClassifier;
16
17  ///
18  /// Class for ensembles of supervised classifiers
19  ///
20
21  class EnsembleBuilder
22  {
23 
24  public:
25    ///
26    /// Constructor.
27    ///
28    EnsembleBuilder(const SupervisedClassifier&, CrossSplitter&);
29
30    ///
31    /// Destructor.
32    ///
33    virtual ~EnsembleBuilder(void);
34
35
36    ///
37    /// Generate ensemble. Function trains each member of the Ensemble.
38    ///
39    void build(void);
40
41    ///
42    /// @Return classifier
43    ///
44    inline const SupervisedClassifier& classifier(size_t i) const
45    {
46      return *(classifier_[i]);
47    }
48     
49    ///
50    /// @Return Number of classifiers in ensemble
51    ///
52    inline u_long size(void) const
53    {
54      return classifier_.size();
55    }
56
57    ///
58    /// Generate validation data for ensemble
59    ///
60    const std::vector<std::vector<statistics::Averager> >& validate(void);
61   
62    ///
63    /// Predict a dataset using the ensemble
64    ///
65    void  predict(const DataLookup2D&, 
66                  std::vector<std::vector<statistics::Averager> > &);
67
68
69  private:
70 
71    const SupervisedClassifier& mother_;
72    CrossSplitter& cross_splitter_;
73    std::vector<SupervisedClassifier*> classifier_;
74    std::vector<std::vector<statistics::Averager> > validation_result_;
75
76  };
77 
78}} // of namespace classifier and namespace theplu
79
80#endif
Note: See TracBrowser for help on using the repository browser.