source: trunk/lib/svm/Kernel_MEV.h @ 336

Last change on this file since 336 was 336, checked in by Peter, 18 years ago

moved members data_ and kf_ from base class Kernel to Kernel_SEV and Kernel_MEV. These two classes should perhaps in future be inherited from a intervening class since they are overlapping, but different from KernelView?.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1// $Id: Kernel_MEV.h 336 2005-06-03 14:16:19Z peter $
2
3#ifndef _theplu_svm_kernel_mev_
4#define _theplu_svm_kernel_mev_
5
6#include <c++_tools/svm/Kernel.h>
7#include <c++_tools/svm/KernelFunction.h>
8#include <c++_tools/gslapi/matrix.h>
9
10namespace theplu {
11namespace svm {
12
13  ///
14  ///   @brief Memory Efficient Kernel
15  ///   Class taking care of the \f$NxN\f$ kernel matrix, where
16  ///   \f$N\f$ is number of samples. Type of Kernel is defined by a
17  ///   KernelFunction. This Memory Efficient Version (MEV) does not
18  ///   store the kernel matrix in memory, but calculates each element
19  ///   when it is needed. When memory allows do always use Kernel_SEV
20  ///   instead.
21  ///   
22  ///   @see also Kernel_SEV
23  ///
24  class Kernel_MEV : public Kernel
25  {
26   
27  public:
28   
29    ///
30    ///  Default constructor (not implemented)
31    ///
32    Kernel_MEV();
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_MEV(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_MEV(const gslapi::matrix& data, const KernelFunction&, 
47               const gslapi::matrix& weight);
48
49    ///
50    /// Copy constructor (not implemented)
51    ///
52    Kernel_MEV(const Kernel_MEV&);
53
54    ///
55    ///   Destructor
56    ///
57    virtual ~Kernel_MEV(void);
58
59    ///
60    /// @return element at position (\a row, \a column) of the Kernel
61    /// matrix
62    ///
63    double operator()(const size_t row,const size_t column) const 
64    { return (*kf_)(data_.TEMP_col_return(row),data_.TEMP_col_return(column)); }
65
66    ///
67    /// @brief number of samples
68    ///
69    inline size_t size(void) const { return data_.columns(); } 
70
71  private:
72    const gslapi::matrix& data_;
73    const KernelFunction* kf_;
74
75  }; // class Kernel_MEV
76
77}} // of namespace svm and namespace theplu
78
79#endif
Note: See TracBrowser for help on using the repository browser.