1 | #ifndef _theplu_yat_classifier_kernel_function_ |
---|
2 | #define _theplu_yat_classifier_kernel_function_ |
---|
3 | |
---|
4 | // $Id$ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2003 Peter Johansson |
---|
8 | Copyright (C) 2004 Jari Häkkinen, Peter Johansson |
---|
9 | Copyright (C) 2005 Peter Johansson |
---|
10 | Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
---|
11 | Copyright (C) 2007 Peter Johansson |
---|
12 | |
---|
13 | This file is part of the yat library, http://trac.thep.lu.se/trac/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 2 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 this program; if not, write to the Free Software |
---|
27 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
28 | 02111-1307, USA. |
---|
29 | */ |
---|
30 | |
---|
31 | namespace theplu { |
---|
32 | namespace yat { |
---|
33 | namespace classifier { |
---|
34 | class DataLookup1D; |
---|
35 | class DataLookupWeighted1D; |
---|
36 | |
---|
37 | /// |
---|
38 | /// @brief Interface class calculating elements in Kernel. |
---|
39 | /// |
---|
40 | class KernelFunction |
---|
41 | { |
---|
42 | |
---|
43 | public: |
---|
44 | /// |
---|
45 | /// Constructor |
---|
46 | /// |
---|
47 | KernelFunction(void) {}; |
---|
48 | |
---|
49 | /// |
---|
50 | /// Destructor |
---|
51 | /// |
---|
52 | virtual ~KernelFunction(void) {}; |
---|
53 | |
---|
54 | /// |
---|
55 | /// @return scalar product of two vector in feature space. |
---|
56 | /// |
---|
57 | virtual double operator()(const DataLookup1D&, |
---|
58 | const DataLookup1D&) const = 0; |
---|
59 | |
---|
60 | /// |
---|
61 | /// @return scalar product of two vector in feature space. |
---|
62 | /// |
---|
63 | virtual double operator()(const DataLookup1D&, |
---|
64 | const DataLookupWeighted1D&) const = 0; |
---|
65 | |
---|
66 | /// |
---|
67 | /// @return scalar product of two vector in feature space. |
---|
68 | /// |
---|
69 | inline double operator()(const DataLookupWeighted1D& vec_w, |
---|
70 | const DataLookup1D& vec) const |
---|
71 | { return this->operator()(vec,vec_w); } |
---|
72 | |
---|
73 | /// |
---|
74 | /// @return scalar product of two vector in feature space. |
---|
75 | /// |
---|
76 | virtual double operator()(const DataLookupWeighted1D&, |
---|
77 | const DataLookupWeighted1D&) const = 0; |
---|
78 | |
---|
79 | }; // class KernelFunction |
---|
80 | |
---|
81 | }}} // of namespace classifier, yat, and theplu |
---|
82 | |
---|
83 | #endif |
---|