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