1 | #ifndef _theplu_classifier_kernel_mev_ |
---|
2 | #define _theplu_classifier_kernel_mev_ |
---|
3 | |
---|
4 | // $Id$ |
---|
5 | |
---|
6 | #include <c++_tools/classifier/DataLookup1D.h> |
---|
7 | #include <c++_tools/classifier/Kernel.h> |
---|
8 | #include <c++_tools/classifier/KernelFunction.h> |
---|
9 | |
---|
10 | namespace theplu { |
---|
11 | namespace classifier { |
---|
12 | class MatrixLookup; |
---|
13 | class MatrixLookupWeighted; |
---|
14 | |
---|
15 | /// |
---|
16 | /// @brief Memory Efficient Kernel |
---|
17 | /// |
---|
18 | /// Class taking care of the |
---|
19 | /// \f$ NxN \f$ kernel matrix, where \f$ N \f$ is number of |
---|
20 | /// samples. Type of Kernel is defined by a KernelFunction. This |
---|
21 | /// Memory Efficient Version (MEV) does not store the kernel |
---|
22 | /// matrix in memory, but calculates an element when it is |
---|
23 | /// needed. When memory allows do always use Kernel_SEV |
---|
24 | /// instead. |
---|
25 | /// |
---|
26 | class Kernel_MEV : public Kernel |
---|
27 | { |
---|
28 | |
---|
29 | public: |
---|
30 | |
---|
31 | /// |
---|
32 | /// Constructor taking the data matrix and KernelFunction as |
---|
33 | /// input.Each column in the data matrix corresponds to one |
---|
34 | /// sample. @note Can not handle NaNs. |
---|
35 | /// |
---|
36 | Kernel_MEV(const MatrixLookup& data, const KernelFunction& kf); |
---|
37 | |
---|
38 | |
---|
39 | /// |
---|
40 | /// Constructor taking the data matrix and KernelFunction as |
---|
41 | /// input.Each column in the data matrix corresponds to one |
---|
42 | /// sample. @note Can not handle NaNs. |
---|
43 | /// |
---|
44 | Kernel_MEV(const MatrixLookupWeighted& data, const KernelFunction& kf); |
---|
45 | |
---|
46 | |
---|
47 | /// |
---|
48 | /// Constructing a new Kernel based on selected features @a |
---|
49 | /// index. All other seeting are the same. |
---|
50 | /// |
---|
51 | Kernel_MEV(const Kernel_MEV& kernel, const std::vector<size_t>& index); |
---|
52 | |
---|
53 | |
---|
54 | /// |
---|
55 | /// Destructor |
---|
56 | /// |
---|
57 | inline virtual ~Kernel_MEV(void) {}; |
---|
58 | |
---|
59 | /// |
---|
60 | /// @return Element at position (\a row, \a column) of the Kernel |
---|
61 | /// matrix |
---|
62 | /// |
---|
63 | double operator()(const size_t row, const size_t column) const; |
---|
64 | |
---|
65 | /// |
---|
66 | /// @see Kernel_MEV(const Kernel_MEV&, const std::vector<size_t>&); |
---|
67 | |
---|
68 | /// |
---|
69 | /// @note returns dynamically allocated pointer that must be |
---|
70 | /// deleted by the caller to avoid memory leaks. |
---|
71 | /// |
---|
72 | const Kernel_MEV* selected(const std::vector<size_t>& index) const; |
---|
73 | |
---|
74 | private: |
---|
75 | /// |
---|
76 | /// Copy constructor (not implemented) |
---|
77 | /// |
---|
78 | Kernel_MEV(const Kernel_MEV&); |
---|
79 | const Kernel_MEV& operator=(const Kernel_MEV&); |
---|
80 | |
---|
81 | }; // class Kernel_MEV |
---|
82 | |
---|
83 | }} // of namespace classifier and namespace theplu |
---|
84 | |
---|
85 | #endif |
---|