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, 2007 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 2 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 this program; if not, write to the Free Software |
---|
26 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
27 | 02111-1307, USA. |
---|
28 | */ |
---|
29 | |
---|
30 | namespace theplu { |
---|
31 | namespace yat { |
---|
32 | namespace classifier { |
---|
33 | class DataLookup1D; |
---|
34 | class DataLookupWeighted1D; |
---|
35 | |
---|
36 | /// |
---|
37 | /// @brief Interface class calculating elements in Kernel. |
---|
38 | /// |
---|
39 | class KernelFunction |
---|
40 | { |
---|
41 | |
---|
42 | public: |
---|
43 | /// |
---|
44 | /// Constructor |
---|
45 | /// |
---|
46 | KernelFunction(void) {}; |
---|
47 | |
---|
48 | /// |
---|
49 | /// Destructor |
---|
50 | /// |
---|
51 | virtual ~KernelFunction(void) {}; |
---|
52 | |
---|
53 | /// |
---|
54 | /// @return scalar product of two vector in feature space. |
---|
55 | /// |
---|
56 | virtual double operator()(const DataLookup1D&, |
---|
57 | const DataLookup1D&) const = 0; |
---|
58 | |
---|
59 | /// |
---|
60 | /// @return scalar product of two vector in feature space. |
---|
61 | /// |
---|
62 | virtual double operator()(const DataLookup1D&, |
---|
63 | const DataLookupWeighted1D&) const = 0; |
---|
64 | |
---|
65 | /// |
---|
66 | /// @return scalar product of two vector in feature space. |
---|
67 | /// |
---|
68 | inline double operator()(const DataLookupWeighted1D& vec_w, |
---|
69 | const DataLookup1D& vec) const |
---|
70 | { return this->operator()(vec,vec_w); } |
---|
71 | |
---|
72 | /// |
---|
73 | /// @return scalar product of two vector in feature space. |
---|
74 | /// |
---|
75 | virtual double operator()(const DataLookupWeighted1D&, |
---|
76 | const DataLookupWeighted1D&) const = 0; |
---|
77 | |
---|
78 | }; // class KernelFunction |
---|
79 | |
---|
80 | }}} // of namespace classifier, yat, and theplu |
---|
81 | |
---|
82 | #endif |
---|