1 | // $Id$ |
---|
2 | |
---|
3 | #ifndef _theplu_classifier_DataLookup2D_ |
---|
4 | #define _theplu_classifier_DataLookup2D_ |
---|
5 | |
---|
6 | #include <vector> |
---|
7 | #include <iostream> |
---|
8 | |
---|
9 | namespace theplu { |
---|
10 | namespace 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 | DataLookup2D(void); |
---|
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 | /// Constructor taking the row index vector or |
---|
35 | /// column index vector (default) |
---|
36 | /// |
---|
37 | DataLookup2D(const std::vector<size_t>&, bool row=false); |
---|
38 | |
---|
39 | |
---|
40 | /// |
---|
41 | /// Copy constructor. |
---|
42 | /// |
---|
43 | DataLookup2D(const DataLookup2D&); |
---|
44 | |
---|
45 | /// |
---|
46 | /// |
---|
47 | /// |
---|
48 | DataLookup2D(const DataLookup2D&, const std::vector<size_t>& row, |
---|
49 | const std::vector<size_t>& col); |
---|
50 | |
---|
51 | /// |
---|
52 | /// |
---|
53 | /// |
---|
54 | DataLookup2D(const DataLookup2D&, const std::vector<size_t>& index, |
---|
55 | const bool row); |
---|
56 | |
---|
57 | |
---|
58 | /// |
---|
59 | /// Destructor |
---|
60 | /// |
---|
61 | virtual ~DataLookup2D() {}; |
---|
62 | |
---|
63 | /// |
---|
64 | /// @return number of columns |
---|
65 | /// |
---|
66 | inline size_t columns(void) const { return column_index_.size(); } |
---|
67 | |
---|
68 | /// |
---|
69 | /// @return sub-Lookup of the DataLookup2D |
---|
70 | /// |
---|
71 | /// @Note Returns a dynamically allocated DataLookup2D, which has |
---|
72 | /// to be deleted by the caller to avoid memory leaks. |
---|
73 | /// |
---|
74 | virtual const DataLookup2D* |
---|
75 | training_data(const std::vector<size_t>&) const=0; |
---|
76 | |
---|
77 | /// |
---|
78 | /// @return number of rows |
---|
79 | /// |
---|
80 | inline size_t rows(void) const { return row_index_.size(); } |
---|
81 | |
---|
82 | /// |
---|
83 | /// @return sub-Lookup of the DataLookup2D |
---|
84 | /// |
---|
85 | /// @Note Returns a dynamically allocated DataLookup2D, which has |
---|
86 | /// to be deleted by the caller to avoid memory leaks. |
---|
87 | /// |
---|
88 | virtual const DataLookup2D* |
---|
89 | validation_data(const std::vector<size_t>& train, |
---|
90 | const std::vector<size_t>& val) const=0; |
---|
91 | |
---|
92 | /// |
---|
93 | /// @return |
---|
94 | /// |
---|
95 | virtual double operator()(const size_t row, const size_t column) const=0; |
---|
96 | |
---|
97 | protected: |
---|
98 | std::vector<size_t> row_index_; |
---|
99 | std::vector<size_t> column_index_; |
---|
100 | |
---|
101 | }; |
---|
102 | |
---|
103 | }} // of namespace classifier and namespace theplu |
---|
104 | |
---|
105 | #endif |
---|