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

Last change on this file since 1615 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

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