1 | // $Id:$ |
---|

2 | |
---|

3 | #ifndef _theplu_svm_kernel |
---|

4 | #define _theplu_svm_kernel |
---|

5 | |
---|

6 | #include <c++_tools/gslapi/matrix.h> |
---|

7 | |
---|

8 | namespace theplu { |
---|

9 | namespace svm { |
---|

10 | |
---|

11 | class KernelFunction; |
---|

12 | |
---|

13 | /// |
---|

14 | /// @brief Base Class for Kernels. |
---|

15 | /// |
---|

16 | /// Class taking care of the \f$NxN\f$ kernel matrix, where |
---|

17 | /// \f$N\f$ is number of samples. Each element in the Kernel |
---|

18 | /// matrix is the scalar product of the corresponding pair of |
---|

19 | /// samples. Type of Kernel is defined by a KernelFunction. |
---|

20 | /// |
---|

21 | /// @note If the KernelFunction is destroyed, the Kernel is no |
---|

22 | /// longer defined. |
---|

23 | /// |
---|

24 | class Kernel |
---|

25 | { |
---|

26 | |
---|

27 | public: |
---|

28 | |
---|

29 | /// |
---|

30 | /// Default constructor |
---|

31 | /// |
---|

32 | Kernel(); |
---|

33 | |
---|

34 | /// |
---|

35 | /// Constructor taking the data matrix and KernelFunction as |
---|

36 | /// input.Each column in the data matrix corresponds to one |
---|

37 | /// sample. @note Can not handle NaNs. |
---|

38 | /// |
---|

39 | Kernel(const gslapi::matrix&, const KernelFunction&); |
---|

40 | |
---|

41 | /// |
---|

42 | /// @todo |
---|

43 | /// Constructor taking the \a data matrix, the KernelFunction and a |
---|

44 | /// \a weight matrix as input. Each column in the data matrix |
---|

45 | /// corresponds to one sample. |
---|

46 | Kernel(const gslapi::matrix& data, const KernelFunction&, |
---|

47 | const gslapi::matrix& weight); |
---|

48 | |
---|

49 | /// |
---|

50 | /// Destructor |
---|

51 | /// |
---|

52 | virtual ~Kernel(void); |
---|

53 | |
---|

54 | /// |
---|

55 | /// @return element at position (\a row, \a column) of the Kernel |
---|

56 | /// matrix |
---|

57 | /// |
---|

58 | virtual double operator()(const size_t row,const size_t column) const=0; |
---|

59 | |
---|

60 | /// |
---|

61 | /// @brief number of samples |
---|

62 | /// |
---|

63 | virtual size_t size(void) const; |
---|

64 | |
---|

65 | protected: |
---|

66 | const gslapi::matrix& data_; |
---|

67 | const KernelFunction* kf_; |
---|

68 | |
---|

69 | virtual bool is_view(void) const; |
---|

70 | |
---|

71 | }; // class Kernel |
---|

72 | |
---|

73 | }} // of namespace svm and namespace theplu |
---|

74 | |
---|

75 | #endif |
---|