source: trunk/lib/classifier/Kernel_MEV.h @ 513

Last change on this file since 513 was 513, checked in by Peter, 16 years ago

added kernels using weights

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1// $Id: Kernel_MEV.h 513 2006-02-18 16:02:43Z peter $
2
3#ifndef _theplu_classifier_kernel_mev_
4#define _theplu_classifier_kernel_mev_
5
6#include <c++_tools/classifier/Kernel.h>
7#include <c++_tools/classifier/KernelFunction.h>
8#include <c++_tools/gslapi/vector.h>
9#include <c++_tools/gslapi/matrix.h>
10
11namespace theplu {
12namespace classifier {
13
14  ///
15  ///   @brief Memory Efficient Kernel
16  ///   Class taking care of the \f$NxN\f$ kernel matrix, where
17  ///   \f$N\f$ is number of samples. Type of Kernel is defined by a
18  ///   KernelFunction. This Memory Efficient Version (MEV) does not
19  ///   store the kernel matrix in memory, but calculates each element
20  ///   when it is needed. When memory allows do always use Kernel_SEV
21  ///   instead.
22  ///   
23  ///   @see also Kernel_SEV
24  ///
25  class Kernel_MEV : public Kernel
26  {
27   
28  public:
29   
30    ///
31    ///   Constructor taking the data matrix and KernelFunction as
32    ///   input.Each column in the data matrix corresponds to one
33    ///   sample. @note Can not handle NaNs.
34    ///
35    inline Kernel_MEV(const gslapi::matrix& data, const KernelFunction& kf)
36      : Kernel(data,kf) {}
37
38    ///
39    ///   Constructor taking the \a data matrix, the KernelFunction and a
40    ///   \a weight matrix as input. Each column in the data matrix
41    ///   corresponds to one sample.
42    inline Kernel_MEV(const gslapi::matrix& data, const KernelFunction& kf, 
43                      const gslapi::matrix& weight)
44    : Kernel(data,kf,weight) {}
45
46    ///
47    ///   Destructor
48    ///
49    inline virtual ~Kernel_MEV(void) {};
50
51    ///
52    /// @return Element at position (\a row, \a column) of the Kernel
53    /// matrix
54    ///
55    inline double operator()(const size_t row, const size_t column) const
56      { return (*kf_)(gslapi::vector(data_,row,false),
57                      gslapi::vector(data_,column,false)); }
58
59  private:
60    ///
61    /// Copy constructor (not implemented)
62    ///
63    Kernel_MEV(const Kernel_MEV&);
64
65  }; // class Kernel_MEV
66
67}} // of namespace classifier and namespace theplu
68
69#endif
Note: See TracBrowser for help on using the repository browser.