1 | #ifndef _theplu_yat_classifier_featureselector_ |
---|
2 | #define _theplu_yat_classifier_featureselector_ |
---|
3 | |
---|
4 | // $Id$ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson |
---|
8 | Copyright (C) 2008 Peter Johansson |
---|
9 | |
---|
10 | This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
11 | |
---|
12 | The yat library is free software; you can redistribute it and/or |
---|
13 | modify it under the terms of the GNU General Public License as |
---|
14 | published by the Free Software Foundation; either version 2 of the |
---|
15 | License, or (at your option) any later version. |
---|
16 | |
---|
17 | The yat library is distributed in the hope that it will be useful, |
---|
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
20 | General Public License for more details. |
---|
21 | |
---|
22 | You should have received a copy of the GNU General Public License |
---|
23 | along with this program; if not, write to the Free Software |
---|
24 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
25 | 02111-1307, USA. |
---|
26 | */ |
---|
27 | |
---|
28 | #include "yat/utility/Index.h" |
---|
29 | |
---|
30 | #include <list> |
---|
31 | |
---|
32 | namespace theplu { |
---|
33 | namespace yat { |
---|
34 | namespace classifier { |
---|
35 | class MatrixLookup; |
---|
36 | class MatrixLookupWeighted; |
---|
37 | class Target; |
---|
38 | |
---|
39 | /// |
---|
40 | /// @brief Interface class for FeatureSelection |
---|
41 | /// |
---|
42 | class FeatureSelector |
---|
43 | { |
---|
44 | public: |
---|
45 | /// |
---|
46 | /// @brief Default Constructor |
---|
47 | /// |
---|
48 | FeatureSelector(size_t N, size_t skip=0); |
---|
49 | |
---|
50 | /// |
---|
51 | /// Cleaning upp all objects that have beed returned from FeatureSelector. |
---|
52 | /// |
---|
53 | /// @brief Destructor |
---|
54 | /// |
---|
55 | virtual ~FeatureSelector(void); |
---|
56 | |
---|
57 | /// |
---|
58 | /// @return MatrixLookup containing only selected features. |
---|
59 | /// |
---|
60 | const MatrixLookup get(const MatrixLookup& data); |
---|
61 | |
---|
62 | /// |
---|
63 | /// @return MatrixLookupWeighted containing only selected features. |
---|
64 | /// |
---|
65 | const MatrixLookupWeighted get(const MatrixLookupWeighted& data); |
---|
66 | |
---|
67 | /// |
---|
68 | /// @return indices corresponding to selected features. |
---|
69 | /// |
---|
70 | const utility::Index features(void) const; |
---|
71 | |
---|
72 | /// |
---|
73 | /// Uses @a matrix to select features. |
---|
74 | /// |
---|
75 | virtual void update(const MatrixLookup& matrix, const Target& target)=0; |
---|
76 | |
---|
77 | /// |
---|
78 | /// Uses @a matrix to select features. |
---|
79 | /// |
---|
80 | virtual void update(const MatrixLookupWeighted& matrix, |
---|
81 | const Target& target)=0; |
---|
82 | |
---|
83 | protected: |
---|
84 | /// |
---|
85 | /// @brief features |
---|
86 | /// |
---|
87 | utility::Index features_; |
---|
88 | |
---|
89 | /// |
---|
90 | /// number of features to skip in list |
---|
91 | /// |
---|
92 | size_t first_; |
---|
93 | |
---|
94 | /// |
---|
95 | /// number of features selected and returned |
---|
96 | /// |
---|
97 | size_t N_; |
---|
98 | |
---|
99 | private: |
---|
100 | |
---|
101 | }; |
---|
102 | |
---|
103 | }}} // of namespace classifier, yat, and theplu |
---|
104 | |
---|
105 | #endif |
---|