source: trunk/c++_tools/classifier/Kernel_SEV.h @ 658

Last change on this file since 658 was 658, checked in by Peter, 15 years ago

added function in KernelLookup? to create a KernelLookup? from inner data and outer (passed) data.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.8 KB
Line 
1#ifndef _theplu_classifier_kernel_sev_
2#define _theplu_classifier_kernel_sev_
3
4// $Id$
5
6#include <c++_tools/classifier/Kernel.h>
7#include <c++_tools/utility/matrix.h>
8
9
10namespace theplu {
11namespace classifier {
12
13  class DataLookup1D;
14  class KernelFunction;
15
16  ///
17  ///   @brief Speed Efficient Kernel
18  ///
19  ///   Class taking care of the \f$ NxN \f$ kernel matrix, where
20  ///   \f$ N \f$ is number of samples. Type of Kernel is defined by a
21  ///   KernelFunction. This Speed Efficient Version (SEV) calculated
22  ///   the kernel matrix once by construction and the kernel is stored in
23  ///   memory. When \f$ N \f$ is large and the kernel matrix cannot be
24  ///   stored in memory, use Kernel_MEV instead.
25  ///
26  class Kernel_SEV : public Kernel
27  {
28   
29  public:
30
31    ///
32    /// Constructor taking the data matrix and KernelFunction as
33    /// input. @note Can not handle NaNs. When dealing with missing values,
34    /// use KernelWeighted_SEV instead.
35    ///
36    Kernel_SEV(const MatrixLookup&, const KernelFunction&,const bool own=false);
37   
38    ///
39    /// Constructor taking the data matrix and KernelFunction as
40    /// input. @note Can not handle NaNs. When dealing with missing values,
41    /// use KernelWeighted_SEV instead.
42    ///
43    Kernel_SEV(const MatrixLookupWeighted&, const KernelFunction&,
44               const bool own=false);
45   
46    ///
47    /// Constructs a Kernel based on selected features defined by @a index
48    ///
49    Kernel_SEV(const Kernel_SEV& kernel, const std::vector<size_t>& index);
50
51
52    ///
53    /// An interface for making new classifier objects. This function
54    /// allows for specification at run-time of which kernel to
55    /// instatiate (see 'Prototype' in Design Patterns).
56    ///
57    /// @Note Returns a dynamically allocated Kernel, which has
58    /// to be deleted by the caller to avoid memory leaks.
59    ///
60    const Kernel_SEV* make_kernel(const MatrixLookup&, 
61                                  const bool own=false) const;
62
63
64    ///
65    /// An interface for making new classifier objects. This function
66    /// allows for specification at run-time of which kernel to
67    /// instatiate (see 'Prototype' in Design Patterns).
68    ///
69    /// @Note Returns a dynamically allocated Kernel, which has
70    /// to be deleted by the caller to avoid memory leaks.
71    ///
72    const Kernel_SEV* make_kernel(const MatrixLookupWeighted&, 
73                                  const bool own=false) const;
74
75
76    ///
77    /// @return element at position (\a row, \a column) in the Kernel
78    /// matrix
79    ///
80    double operator()(const size_t row,const size_t column) const;
81
82
83    ///
84    /// @todo doc
85    ///
86    const Kernel* selected(const std::vector<size_t>& index) const;
87
88  private:
89    ///
90    /// Copy constructor (not implemented)
91    ///
92    Kernel_SEV(const Kernel_SEV&);
93    const Kernel_SEV& operator=(const Kernel_SEV&);
94
95    void build_kernel(void);
96
97    utility::matrix kernel_matrix_;
98
99  }; // class Kernel_SEV
100
101}} // of namespace classifier and namespace theplu
102
103#endif
Note: See TracBrowser for help on using the repository browser.