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

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

re-introduced prediction in SVM

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