680 |
11 Oct 06 |
jari |
1 |
#ifndef _theplu_yat_classifier_featureselector_ |
680 |
11 Oct 06 |
jari |
2 |
#define _theplu_yat_classifier_featureselector_ |
604 |
29 Aug 06 |
peter |
3 |
|
675 |
10 Oct 06 |
jari |
// $Id$ |
675 |
10 Oct 06 |
jari |
5 |
|
675 |
10 Oct 06 |
jari |
6 |
/* |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
675 |
10 Oct 06 |
jari |
10 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
675 |
10 Oct 06 |
jari |
12 |
|
675 |
10 Oct 06 |
jari |
The yat library is free software; you can redistribute it and/or |
675 |
10 Oct 06 |
jari |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
675 |
10 Oct 06 |
jari |
License, or (at your option) any later version. |
675 |
10 Oct 06 |
jari |
17 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be useful, |
675 |
10 Oct 06 |
jari |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
10 Oct 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
675 |
10 Oct 06 |
jari |
General Public License for more details. |
675 |
10 Oct 06 |
jari |
22 |
|
675 |
10 Oct 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
675 |
10 Oct 06 |
jari |
25 |
*/ |
675 |
10 Oct 06 |
jari |
26 |
|
1134 |
23 Feb 08 |
peter |
27 |
#include "yat/utility/Index.h" |
1134 |
23 Feb 08 |
peter |
28 |
|
604 |
29 Aug 06 |
peter |
29 |
#include <list> |
604 |
29 Aug 06 |
peter |
30 |
|
604 |
29 Aug 06 |
peter |
31 |
namespace theplu { |
680 |
11 Oct 06 |
jari |
32 |
namespace yat { |
604 |
29 Aug 06 |
peter |
33 |
namespace classifier { |
624 |
05 Sep 06 |
peter |
34 |
class MatrixLookup; |
624 |
05 Sep 06 |
peter |
35 |
class MatrixLookupWeighted; |
604 |
29 Aug 06 |
peter |
36 |
class Target; |
604 |
29 Aug 06 |
peter |
37 |
|
604 |
29 Aug 06 |
peter |
38 |
/// |
604 |
29 Aug 06 |
peter |
/// @brief Interface class for FeatureSelection |
604 |
29 Aug 06 |
peter |
40 |
/// |
604 |
29 Aug 06 |
peter |
41 |
class FeatureSelector |
604 |
29 Aug 06 |
peter |
42 |
{ |
604 |
29 Aug 06 |
peter |
43 |
public: |
4200 |
19 Aug 22 |
peter |
44 |
/// |
4200 |
19 Aug 22 |
peter |
/// @brief Default Constructor |
4200 |
19 Aug 22 |
peter |
46 |
/// |
642 |
07 Sep 06 |
peter |
47 |
FeatureSelector(size_t N, size_t skip=0); |
604 |
29 Aug 06 |
peter |
48 |
|
4200 |
19 Aug 22 |
peter |
49 |
/// |
604 |
29 Aug 06 |
peter |
/// @brief Destructor |
4200 |
19 Aug 22 |
peter |
51 |
/// |
604 |
29 Aug 06 |
peter |
52 |
virtual ~FeatureSelector(void); |
604 |
29 Aug 06 |
peter |
53 |
|
604 |
29 Aug 06 |
peter |
54 |
/// |
4200 |
19 Aug 22 |
peter |
/// @return MatrixLookup containing only selected features. |
604 |
29 Aug 06 |
peter |
56 |
/// |
1204 |
05 Mar 08 |
peter |
57 |
const MatrixLookup get(const MatrixLookup& data); |
604 |
29 Aug 06 |
peter |
58 |
|
604 |
29 Aug 06 |
peter |
59 |
/// |
4200 |
19 Aug 22 |
peter |
/// @return MatrixLookupWeighted containing only selected features. |
607 |
29 Aug 06 |
peter |
61 |
/// |
1204 |
05 Mar 08 |
peter |
62 |
const MatrixLookupWeighted get(const MatrixLookupWeighted& data); |
624 |
05 Sep 06 |
peter |
63 |
|
607 |
29 Aug 06 |
peter |
64 |
/// |
1134 |
23 Feb 08 |
peter |
/// @return indices corresponding to selected features. |
624 |
05 Sep 06 |
peter |
66 |
/// |
1134 |
23 Feb 08 |
peter |
67 |
const utility::Index features(void) const; |
607 |
29 Aug 06 |
peter |
68 |
|
607 |
29 Aug 06 |
peter |
69 |
/// |
624 |
05 Sep 06 |
peter |
/// Uses @a matrix to select features. |
604 |
29 Aug 06 |
peter |
71 |
/// |
624 |
05 Sep 06 |
peter |
72 |
virtual void update(const MatrixLookup& matrix, const Target& target)=0; |
604 |
29 Aug 06 |
peter |
73 |
|
624 |
05 Sep 06 |
peter |
74 |
/// |
624 |
05 Sep 06 |
peter |
/// Uses @a matrix to select features. |
624 |
05 Sep 06 |
peter |
76 |
/// |
4200 |
19 Aug 22 |
peter |
77 |
virtual void update(const MatrixLookupWeighted& matrix, |
624 |
05 Sep 06 |
peter |
78 |
const Target& target)=0; |
624 |
05 Sep 06 |
peter |
79 |
|
604 |
29 Aug 06 |
peter |
80 |
protected: |
648 |
14 Sep 06 |
peter |
81 |
/// |
648 |
14 Sep 06 |
peter |
/// @brief features |
648 |
14 Sep 06 |
peter |
83 |
/// |
1134 |
23 Feb 08 |
peter |
84 |
utility::Index features_; |
648 |
14 Sep 06 |
peter |
85 |
|
648 |
14 Sep 06 |
peter |
86 |
/// |
648 |
14 Sep 06 |
peter |
/// number of features to skip in list |
648 |
14 Sep 06 |
peter |
88 |
/// |
604 |
29 Aug 06 |
peter |
89 |
size_t first_; |
648 |
14 Sep 06 |
peter |
90 |
|
648 |
14 Sep 06 |
peter |
91 |
/// |
648 |
14 Sep 06 |
peter |
/// number of features selected and returned |
648 |
14 Sep 06 |
peter |
93 |
/// |
604 |
29 Aug 06 |
peter |
94 |
size_t N_; |
604 |
29 Aug 06 |
peter |
95 |
|
604 |
29 Aug 06 |
peter |
96 |
private: |
604 |
29 Aug 06 |
peter |
97 |
|
604 |
29 Aug 06 |
peter |
98 |
}; |
604 |
29 Aug 06 |
peter |
99 |
|
680 |
11 Oct 06 |
jari |
100 |
}}} // of namespace classifier, yat, and theplu |
604 |
29 Aug 06 |
peter |
101 |
|
604 |
29 Aug 06 |
peter |
102 |
#endif |