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

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

I dont know what happened, but everything is changed...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1// $Id: Kernel_MEV.h 475 2005-12-22 15:03:51Z 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    ///  Default constructor (not implemented)
32    ///
33    Kernel_MEV(void);
34
35    ///
36    ///   Constructor taking the data matrix and KernelFunction as
37    ///   input.Each column in the data matrix corresponds to one
38    ///   sample. @note Can not handle NaNs.
39    ///
40    inline Kernel_MEV(const gslapi::matrix& data, const KernelFunction& kf)
41      : Kernel(data,kf), data_(data), kf_(&kf) {}
42
43    ///
44    ///   @todo Constructor taking the \a data matrix, the KernelFunction and a
45    ///   \a weight matrix as input. Each column in the data matrix
46    ///   corresponds to one sample.
47    Kernel_MEV(const gslapi::matrix& data, const KernelFunction&, 
48               const gslapi::matrix& weight);
49
50    ///
51    /// Copy constructor (not implemented)
52    ///
53    Kernel_MEV(const Kernel_MEV&);
54
55    ///
56    ///   Destructor
57    ///
58    inline virtual ~Kernel_MEV(void) {};
59
60    ///
61    /// @return Element at position (\a row, \a column) of the Kernel
62    /// matrix
63    ///
64    inline double operator()(const size_t row, const size_t column) const
65      { return (*kf_)(gslapi::vector(data_,row,false),
66                      gslapi::vector(data_,column,false)); }
67
68    ///
69    /// @brief number of samples
70    ///
71    inline size_t size(void) const { return data_.columns(); } 
72
73  private:
74    const gslapi::matrix& data_;
75    const KernelFunction* kf_;
76
77  }; // class Kernel_MEV
78
79}} // of namespace classifier and namespace theplu
80
81#endif
Note: See TracBrowser for help on using the repository browser.