1 | // $Id: Kernel_SEV.h 451 2005-12-15 21:09:12Z peter $ |
---|

2 | |
---|

3 | #ifndef _theplu_classifier_kernel_sev_ |
---|

4 | #define _theplu_classifier_kernel_sev_ |
---|

5 | |
---|

6 | #include <c++_tools/classifier/Kernel.h> |
---|

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

8 | |
---|

9 | |
---|

10 | namespace theplu { |
---|

11 | namespace classifier { |
---|

12 | |
---|

13 | class KernelFunction; |
---|

14 | |
---|

15 | /// |
---|

16 | /// @brief Speed Efficient Kernel |
---|

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

18 | /// \f$N\f$ is number of samples. Type of Kernel is defined by a |
---|

19 | /// KernelFunction. This Speed Efficient Version (SEV) calculated |
---|

20 | /// the kernel matrix once and the kernel is stored in |
---|

21 | /// memory. When \f$N\f$ is large and the kernel matrix cannot be |
---|

22 | /// stored in memory, use Kernel_MEV instead. |
---|

23 | /// |
---|

24 | /// @see also Kernel_MEV |
---|

25 | /// |
---|

26 | class Kernel_SEV : public Kernel |
---|

27 | { |
---|

28 | |
---|

29 | public: |
---|

30 | |
---|

31 | /// |
---|

32 | /// Default constructor (not implemented) |
---|

33 | /// |
---|

34 | Kernel_SEV(void); |
---|

35 | |
---|

36 | /// |
---|

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

38 | /// input. @note Can not handle NaNs. When dealing with missing values, |
---|

39 | /// use constructor taking a weight matrix. |
---|

40 | Kernel_SEV(const gslapi::matrix&, const KernelFunction&); |
---|

41 | |
---|

42 | /// |
---|

43 | /// Copy constructor (not implemented) |
---|

44 | /// |
---|

45 | Kernel_SEV(const Kernel_SEV&); |
---|

46 | |
---|

47 | /// |
---|

48 | /// Destructor |
---|

49 | /// |
---|

50 | inline virtual ~Kernel_SEV(void) {}; |
---|

51 | |
---|

52 | /// |
---|

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

54 | /// matrix |
---|

55 | /// |
---|

56 | inline double operator()(const size_t row,const size_t column) const |
---|

57 | { return kernel_matrix_(row,column); } |
---|

58 | |
---|

59 | /// |
---|

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

61 | /// |
---|

62 | inline size_t size(void) const { return kernel_matrix_.columns(); } |
---|

63 | |
---|

64 | private: |
---|

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

66 | const KernelFunction* kf_; |
---|

67 | gslapi::matrix kernel_matrix_; |
---|

68 | |
---|

69 | }; // class Kernel_SEV |
---|

70 | |
---|

71 | }} // of namespace classifier and namespace theplu |
---|

72 | |
---|

73 | #endif |
---|