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

Last change on this file since 658 was 658, checked in by Peter, 16 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: 3.0 KB
Line 
1#ifndef _theplu_classifier_kernel_mev_
2#define _theplu_classifier_kernel_mev_
3
4// $Id$
5
6#include <c++_tools/classifier/DataLookup1D.h>
7#include <c++_tools/classifier/Kernel.h>
8#include <c++_tools/classifier/KernelFunction.h>
9
10namespace theplu {
11namespace classifier {
12  class MatrixLookup;
13  class MatrixLookupWeighted;
14
15  ///
16  /// @brief Memory Efficient Kernel
17  ///
18  ///   Class taking care of the
19  ///   \f$ NxN \f$ kernel matrix, where \f$ N \f$ is number of
20  ///   samples. Type of Kernel is defined by a KernelFunction. This
21  ///   Memory Efficient Version (MEV) does not store the kernel
22  ///   matrix in memory, but calculates an element when it is
23  ///   needed. When memory allows do always use Kernel_SEV
24  ///   instead.
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    Kernel_MEV(const MatrixLookup& data, const KernelFunction& kf, 
37               const bool own=false);
38
39
40    ///
41    /// Constructor taking the data matrix and KernelFunction as
42    /// input.Each column in the data matrix corresponds to one
43    /// sample. @note Can not handle NaNs.
44    ///
45    Kernel_MEV(const MatrixLookupWeighted& data, const KernelFunction& kf,
46               const bool own=false);
47
48
49    ///
50    /// Constructing a new Kernel based on selected features @a
51    /// index. All other seeting are the same.
52    ///
53    Kernel_MEV(const Kernel_MEV& kernel, const std::vector<size_t>& index);
54
55
56    ///
57    /// @return Element at position (\a row, \a column) of the Kernel
58    /// matrix
59    ///
60    double operator()(const size_t row, const size_t column) const;
61   
62    ///
63    /// An interface for making new classifier objects. This function
64    /// allows for specification at run-time of which kernel to
65    /// instatiate (see 'Prototype' in Design Patterns).
66    ///
67    /// @Note Returns a dynamically allocated Kernel, which has
68    /// to be deleted by the caller to avoid memory leaks.
69    ///
70    const Kernel_MEV* make_kernel(const MatrixLookup&, 
71                                  const bool own=false) const;
72
73
74    ///
75    /// An interface for making new classifier objects. This function
76    /// allows for specification at run-time of which kernel to
77    /// instatiate (see 'Prototype' in Design Patterns).
78    ///
79    /// @Note Returns a dynamically allocated Kernel, which has
80    /// to be deleted by the caller to avoid memory leaks.
81    ///
82    const Kernel_MEV* make_kernel(const MatrixLookupWeighted&, 
83                                  const bool own=false) const;
84
85
86    ///
87    /// @see Kernel_MEV(const Kernel_MEV&, const std::vector<size_t>&);
88
89    ///
90    /// @note returns dynamically allocated pointer that must be
91    /// deleted by the caller to avoid memory leaks.
92    ///
93    const Kernel_MEV* selected(const std::vector<size_t>& index) const;
94
95  private:
96    ///
97    /// Copy constructor (not implemented)
98    ///
99    Kernel_MEV(const Kernel_MEV&);
100    const Kernel_MEV& operator=(const Kernel_MEV&);
101
102  }; // class Kernel_MEV
103
104}} // of namespace classifier and namespace theplu
105
106#endif
Note: See TracBrowser for help on using the repository browser.