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

Last change on this file since 1221 was 1204, checked in by Peter, 13 years ago

Return by value from FeatureSelector?. Copying a Lookup is cheap, so no reason to return by reference and keep a collection of garbage

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