source: trunk/lib/classifier/DataLookup2D.h @ 545

Last change on this file since 545 was 545, checked in by Peter, 17 years ago

added feature selection for SVM

File size: 2.1 KB
Line 
1// $Id$
2
3#ifndef _theplu_classifier_DataLookup2D_
4#define _theplu_classifier_DataLookup2D_
5
6#include <vector>
7#include <iostream>
8
9namespace theplu {
10namespace classifier { 
11
12  ///
13  /// Interface class for classifier data
14  ///
15
16  class DataLookup2D
17  {
18 
19  public:
20   
21    ///
22    /// Default constructor.
23    ///
24    inline DataLookup2D(const bool owner=false) : owner_(owner){};
25
26
27    ///
28    /// Constructor taking the row index vector and column index vector
29    /// as input.
30    ///
31    DataLookup2D(const std::vector<size_t>&, const std::vector<size_t>&);
32
33    ///
34    /// Copy constructor.
35    ///
36    DataLookup2D(const DataLookup2D&);
37
38    ///
39    ///
40    ///
41    DataLookup2D(const DataLookup2D&, const std::vector<size_t>& row, 
42               const std::vector<size_t>& col);
43
44    ///
45    ///
46    ///
47    DataLookup2D(const DataLookup2D&, const std::vector<size_t>& index, 
48               const bool row);
49
50
51    ///
52    ///
53    ///
54    DataLookup2D(const size_t, const size_t, const bool owner);
55
56
57    ///
58    /// Destructor
59    ///
60    virtual ~DataLookup2D() {};
61
62    ///
63    /// @return number of columns
64    ///
65    inline size_t columns(void) const { return column_index_.size(); } 
66
67    ///
68    /// @return sub-Lookup of the DataLookup2D
69    ///
70    /// @Note Returns a dynamically allocated DataLookup2D, which has
71    /// to be deleted by the caller to avoid memory leaks.
72    ///
73    virtual const DataLookup2D* 
74    training_data(const std::vector<size_t>&) const=0; 
75
76    ///
77    /// @return number of rows
78    ///
79    inline size_t rows(void) const { return row_index_.size(); } 
80
81    ///
82    /// @return sub-Lookup of the DataLookup2D
83    ///
84    /// @Note Returns a dynamically allocated DataLookup2D, which has
85    /// to be deleted by the caller to avoid memory leaks.
86    ///
87    virtual const DataLookup2D* 
88    validation_data(const std::vector<size_t>& train,
89                    const std::vector<size_t>& val) const=0; 
90
91    ///
92    /// @return
93    ///
94    virtual double operator()(const size_t row, const size_t column) const=0;
95
96  protected:
97    std::vector<size_t> row_index_;
98    std::vector<size_t> column_index_;
99    bool owner_;
100  }; 
101 
102}} // of namespace classifier and namespace theplu
103
104#endif
Note: See TracBrowser for help on using the repository browser.