source: trunk/yat/classifier/Kernel_MEV.h

Last change on this file was 2119, checked in by Peter, 12 years ago

converted files to utf-8. fixes #577

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