source: trunk/c++_tools/classifier/FeatureSelector.h @ 642

Last change on this file since 642 was 642, checked in by Peter, 16 years ago

adding class for selecting features by random

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 1.5 KB
Line 
1// $Id$
2
3#ifndef _theplu_classifier_featureselector_
4#define _theplu_classifier_featureselector_
5
6#include <list>
7#include <vector>
8
9namespace theplu {
10namespace classifier {
11  class MatrixLookup;
12  class MatrixLookupWeighted;
13  class Target;
14
15  ///
16  /// @brief Interface class for FeatureSelection
17  ///
18  class FeatureSelector
19  {
20  public:
21    ///
22    /// @brief Default Constructor
23    ///
24    FeatureSelector(size_t N, size_t skip=0);
25
26    ///
27    /// Cleaning upp all objects that have beed returned from FeatureSelector.
28    ///
29    /// @brief Destructor
30    ///
31    virtual ~FeatureSelector(void);
32
33    ///
34    /// @return MatrixLookup containing only selected features.
35    ///
36    const MatrixLookup& get(const MatrixLookup& data);
37
38    ///
39    /// @return MatrixLookupWeighted containing only selected features.
40    ///
41    const MatrixLookupWeighted& get(const MatrixLookupWeighted& data);
42
43    ///
44    ///
45    ///
46    inline const std::vector<size_t> features(void) const { return features_; }
47
48    ///
49    /// Uses @a matrix to select features.
50    ///
51    virtual void update(const MatrixLookup& matrix, const Target& target)=0;
52
53    ///
54    /// Uses @a matrix to select features.
55    ///
56    virtual void update(const MatrixLookupWeighted& matrix, 
57                        const Target& target)=0;
58
59  protected:
60    std::vector<size_t> features_;
61    size_t first_;
62    size_t N_;
63
64  private:
65    std::list<const MatrixLookup*> garbage_;
66    std::list<const MatrixLookupWeighted*> garbage_weighted_;
67
68  };
69
70} // end of namespace classifier
71} // end of namespace theplu
72
73#endif
Note: See TracBrowser for help on using the repository browser.