source: trunk/yat/classifier/Kernel_MEV.h @ 747

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

replaced includes in header files with forward declarations when possible. Added some includes in cc files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 3.5 KB
Line 
1#ifndef _theplu_yat_classifier_kernel_mev_
2#define _theplu_yat_classifier_kernel_mev_
3
4// $Id$
5
6/*
7  Copyright (C) The authors contributing to this file.
8
9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include "Kernel.h"
28#include "KernelFunction.h"
29
30namespace theplu {
31namespace yat {
32namespace classifier {
33  class MatrixLookup;
34  class MatrixLookupWeighted;
35
36  ///
37  /// @brief Memory Efficient Kernel
38  ///
39  ///   Class taking care of the
40  ///   \f$ NxN \f$ kernel matrix, where \f$ N \f$ is number of
41  ///   samples. Type of Kernel is defined by a KernelFunction. This
42  ///   Memory Efficient Version (MEV) does not store the kernel
43  ///   matrix in memory, but calculates an element when it is
44  ///   needed. When memory allows do always use Kernel_SEV
45  ///   instead.
46  ///
47  class Kernel_MEV : public Kernel
48  {
49   
50  public:
51   
52    ///
53    /// Constructor taking the data matrix and KernelFunction as
54    /// input.Each column in the data matrix corresponds to one
55    /// sample. @note Can not handle NaNs.
56    ///
57    Kernel_MEV(const MatrixLookup& data, const KernelFunction& kf, 
58               const bool own=false);
59
60
61    ///
62    /// Constructor taking the data matrix and KernelFunction as
63    /// input.Each column in the data matrix corresponds to one
64    /// sample. @note Can not handle NaNs.
65    ///
66    Kernel_MEV(const MatrixLookupWeighted& data, const KernelFunction& kf,
67               const bool own=false);
68
69
70    ///
71    /// Constructing a new Kernel based on selected features @a
72    /// index. All other seeting are the same.
73    ///
74    Kernel_MEV(const Kernel_MEV& kernel, const std::vector<size_t>& index);
75
76
77    ///
78    /// @return Element at position (\a row, \a column) of the Kernel
79    /// matrix
80    ///
81    double operator()(const size_t row, const size_t column) const;
82   
83    ///
84    /// An interface for making new classifier objects. This function
85    /// allows for specification at run-time of which kernel to
86    /// instatiate (see 'Prototype' in Design Patterns).
87    ///
88    /// @Note Returns a dynamically allocated Kernel, which has
89    /// to be deleted by the caller to avoid memory leaks.
90    ///
91    const Kernel_MEV* make_kernel(const MatrixLookup&, 
92                                  const bool own=false) const;
93
94
95    ///
96    /// An interface for making new classifier objects. This function
97    /// allows for specification at run-time of which kernel to
98    /// instatiate (see 'Prototype' in Design Patterns).
99    ///
100    /// @Note Returns a dynamically allocated Kernel, which has
101    /// to be deleted by the caller to avoid memory leaks.
102    ///
103    const Kernel_MEV* make_kernel(const MatrixLookupWeighted&, 
104                                  const bool own=false) const;
105
106
107  private:
108    ///
109    /// Copy constructor (not implemented)
110    ///
111    Kernel_MEV(const Kernel_MEV&);
112    const Kernel_MEV& operator=(const Kernel_MEV&);
113
114  }; // class Kernel_MEV
115
116}}} // of namespace classifier, yat, and theplu
117
118#endif
Note: See TracBrowser for help on using the repository browser.