1 | // $Id: Kernel.h 336 2005-06-03 14:16:19Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_svm_kernel_ |
---|
4 | #define _theplu_svm_kernel_ |
---|
5 | |
---|
6 | #include <cctype> |
---|
7 | |
---|
8 | namespace theplu { |
---|
9 | |
---|
10 | namespace gslapi { |
---|
11 | class matrix; |
---|
12 | } |
---|
13 | |
---|
14 | namespace svm { |
---|
15 | |
---|
16 | class KernelFunction; |
---|
17 | |
---|
18 | /// |
---|
19 | /// @brief Base Class for Kernels. |
---|
20 | /// |
---|
21 | /// Class taking care of the \f$NxN\f$ kernel matrix, where |
---|
22 | /// \f$N\f$ is number of samples. Each element in the Kernel |
---|
23 | /// matrix is the scalar product of the corresponding pair of |
---|
24 | /// samples. Type of Kernel is defined by a KernelFunction. |
---|
25 | /// |
---|
26 | /// @note If the KernelFunction is destroyed, the Kernel is no |
---|
27 | /// longer defined. |
---|
28 | /// |
---|
29 | class Kernel |
---|
30 | { |
---|
31 | |
---|
32 | public: |
---|
33 | |
---|
34 | /// |
---|
35 | /// Default constructor |
---|
36 | /// |
---|
37 | Kernel(void) {}; |
---|
38 | |
---|
39 | /// |
---|
40 | /// Copy constructor (not implemented) |
---|
41 | /// |
---|
42 | Kernel(const Kernel&); |
---|
43 | |
---|
44 | /// |
---|
45 | /// Constructor taking the data matrix and KernelFunction as |
---|
46 | /// input.Each column in the data matrix corresponds to one |
---|
47 | /// sample. @note Can not handle NaNs. |
---|
48 | /// |
---|
49 | Kernel(const gslapi::matrix&, const KernelFunction&) {}; |
---|
50 | |
---|
51 | /// |
---|
52 | /// @todo |
---|
53 | /// Constructor taking the \a data matrix, the KernelFunction and a |
---|
54 | /// \a weight matrix as input. Each column in the data matrix |
---|
55 | /// corresponds to one sample. |
---|
56 | Kernel(const gslapi::matrix& data, const KernelFunction&, |
---|
57 | const gslapi::matrix& weight); |
---|
58 | |
---|
59 | /// |
---|
60 | /// Destructor |
---|
61 | /// |
---|
62 | virtual ~Kernel(void) {}; |
---|
63 | |
---|
64 | /// |
---|
65 | /// @return element at position (\a row, \a column) of the Kernel |
---|
66 | /// matrix |
---|
67 | /// |
---|
68 | virtual double operator()(const size_t row,const size_t column) const=0; |
---|
69 | |
---|
70 | /// |
---|
71 | /// @brief number of samples |
---|
72 | /// |
---|
73 | virtual size_t size(void) const=0; |
---|
74 | |
---|
75 | protected: |
---|
76 | |
---|
77 | }; // class Kernel |
---|
78 | |
---|
79 | }} // of namespace svm and namespace theplu |
---|
80 | |
---|
81 | #endif |
---|