source: trunk/yat/classifier/FeatureSelector.h @ 1706

Last change on this file since 1706 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.3 KB
Line 
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 3 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 yat. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26#include "yat/utility/Index.h"
27
28#include <list>
29
30namespace theplu {
31namespace yat {
32namespace classifier {
33  class MatrixLookup;
34  class MatrixLookupWeighted;
35  class Target;
36
37  ///
38  /// @brief Interface class for FeatureSelection
39  ///
40  class FeatureSelector
41  {
42  public:
43    ///
44    /// @brief Default Constructor
45    ///
46    FeatureSelector(size_t N, size_t skip=0);
47
48    ///
49    /// Cleaning upp all objects that have beed returned from FeatureSelector.
50    ///
51    /// @brief Destructor
52    ///
53    virtual ~FeatureSelector(void);
54
55    ///
56    /// @return MatrixLookup containing only selected features.
57    ///
58    const MatrixLookup get(const MatrixLookup& data);
59
60    ///
61    /// @return MatrixLookupWeighted containing only selected features.
62    ///
63    const MatrixLookupWeighted get(const MatrixLookupWeighted& data);
64
65    ///
66    /// @return indices corresponding to selected features.
67    ///
68    const utility::Index features(void) const;
69
70    ///
71    /// Uses @a matrix to select features.
72    ///
73    virtual void update(const MatrixLookup& matrix, const Target& target)=0;
74
75    ///
76    /// Uses @a matrix to select features.
77    ///
78    virtual void update(const MatrixLookupWeighted& matrix, 
79                        const Target& target)=0;
80
81  protected:
82    ///
83    /// @brief features
84    ///
85    utility::Index features_;
86
87    ///
88    /// number of features to skip in list
89    ///
90    size_t first_;
91
92    ///
93    /// number of features selected and returned
94    ///
95    size_t N_;
96
97  private:
98
99  };
100
101}}} // of namespace classifier, yat, and theplu
102
103#endif
Note: See TracBrowser for help on using the repository browser.