source: trunk/lib/svm/Kernel.h @ 333

Last change on this file since 333 was 333, checked in by Jari Häkkinen, 18 years ago

Fixed needed base class contructor.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1// $Id: Kernel.h 333 2005-06-02 13:34:08Z jari $
2
3#ifndef _theplu_svm_kernel
4#define _theplu_svm_kernel
5
6#include <c++_tools/gslapi/matrix.h>
7
8namespace theplu {
9namespace svm {
10
11  class KernelFunction;
12
13  ///
14  ///   @brief Base Class for Kernels.
15  ///
16  ///   Class taking care of the \f$NxN\f$ kernel matrix, where
17  ///   \f$N\f$ is number of samples. Each element in the Kernel
18  ///   matrix is the scalar product of the corresponding pair of
19  ///   samples. Type of Kernel is defined by a KernelFunction.
20  ///   
21  ///   @note If the KernelFunction is destroyed, the Kernel is no
22  ///   longer defined.
23  ///
24  class Kernel
25  {
26   
27  public:
28
29    ///
30    /// Default constructor
31    ///
32    Kernel(void);
33
34    ///
35    /// Copy constructor
36    ///
37    /// @note SHALLOW copy performed.
38    ///
39    Kernel(const Kernel&);
40
41    ///
42    ///   Constructor taking the data matrix and KernelFunction as
43    ///   input.Each column in the data matrix corresponds to one
44    ///   sample. @note Can not handle NaNs.
45    ///
46    Kernel(const gslapi::matrix&, const KernelFunction&);
47   
48    ///
49    ///   @todo
50    ///   Constructor taking the \a data matrix, the KernelFunction and a
51    ///   \a weight matrix as input. Each column in the data matrix
52    ///   corresponds to one sample.
53    Kernel(const gslapi::matrix& data, const KernelFunction&, 
54               const gslapi::matrix& weight);
55
56    ///
57    ///   Destructor
58    ///
59    virtual ~Kernel(void);
60
61    ///
62    /// @return element at position (\a row, \a column) of the Kernel
63    /// matrix
64    ///
65    virtual double operator()(const size_t row,const size_t column) const=0;
66
67    ///
68    /// @brief number of samples
69    ///
70    virtual size_t size(void) const; 
71   
72  protected:
73    const gslapi::matrix& data_;
74    const KernelFunction* kf_;
75
76    virtual bool is_view(void) const;
77
78  }; // class Kernel
79
80}} // of namespace svm and namespace theplu
81
82#endif
Note: See TracBrowser for help on using the repository browser.