1 | // $Id: Kernel_MEV.h 307 2005-05-03 13:28:29Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_svm_kernel_mev |
---|
4 | #define _theplu_svm_kernel_mev |
---|
5 | |
---|
6 | #include <c++_tools/gslapi/matrix.h> |
---|
7 | |
---|
8 | namespace theplu { |
---|
9 | namespace svm { |
---|
10 | |
---|
11 | class KernelFunction; |
---|
12 | |
---|
13 | /// |
---|
14 | /// Class taking care of the \f$NxN\f$ kernel matrix, where |
---|
15 | /// \f$N\f$ is number of samples. Type of Kernel is defined by a |
---|
16 | /// KernelFunction. This Memory Efficient Versions (SEV) does not |
---|
17 | /// store the kernel matrix in memory, but calculates each element |
---|
18 | /// when it is needed. |
---|
19 | /// |
---|
20 | /// @see also Kernel_SEV |
---|
21 | /// |
---|
22 | class Kernel_MEV |
---|
23 | { |
---|
24 | |
---|
25 | public: |
---|
26 | |
---|
27 | Kernel_MEV(); |
---|
28 | |
---|
29 | /// |
---|
30 | /// Constructor taking the data matrix and KernelFunction as |
---|
31 | /// input.Each column in the data matrix corresponds to one |
---|
32 | /// sample. @note Can not handle NaNs. |
---|
33 | /// |
---|
34 | Kernel_MEV(const gslapi::matrix&, const KernelFunction&); |
---|
35 | |
---|
36 | /// |
---|
37 | /// Constructor taking the \a data matrix, the KernelFunction and a |
---|
38 | /// \a weight matrix as input. Each column in the data matrix |
---|
39 | /// corresponds to one sample. |
---|
40 | /// @todo |
---|
41 | Kernel_MEV(const gslapi::matrix& data, const KernelFunction&, |
---|
42 | const gslapi::matrix& weight); |
---|
43 | |
---|
44 | /// |
---|
45 | /// Destructor |
---|
46 | /// |
---|
47 | virtual ~Kernel_MEV(void); |
---|
48 | |
---|
49 | /// |
---|
50 | /// @return element at position (\a row, \a column) of the Kernel |
---|
51 | /// matrix |
---|
52 | /// |
---|
53 | virtual double operator()(size_t row,size_t column) const; |
---|
54 | |
---|
55 | /// |
---|
56 | /// @brief number of samples |
---|
57 | /// |
---|
58 | inline size_t size(void) const { return data_.columns(); } |
---|
59 | |
---|
60 | protected: |
---|
61 | const gslapi::matrix& data_; |
---|
62 | const KernelFunction* kf_; |
---|
63 | |
---|
64 | }; // class Kernel_MEV |
---|
65 | |
---|
66 | }} // of namespace svm and namespace theplu |
---|
67 | |
---|
68 | #endif |
---|