source: trunk/yat/classifier/PolynomialKernelFunction.h

Last change on this file was 4207, checked in by Peter, 4 weeks ago

update copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.6 KB
Line 
1#ifndef _theplu_yat_classifier_polynomial_kernel_function_
2#define _theplu_yat_classifier_polynomial_kernel_function_
3
4// $Id$
5
6/*
7  Copyright (C) 2003 Peter Johansson
8  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2022 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 "KernelFunction.h"
28
29#include <cmath>
30
31namespace theplu {
32namespace yat {
33namespace classifier {
34
35  class DataLookup1D;
36
37  ///
38  /// @brief Class for polynomial kernel calculations
39  ///
40
41
42  class PolynomialKernelFunction : public KernelFunction
43  {
44
45  public:
46    ///
47    ///Constructor taking the order of the polynomial as input. Default is
48    ///order=1 yielding the linear kernel function.
49    ///
50    PolynomialKernelFunction(int = 1);
51
52    ///
53    ///Destructor
54    ///
55    virtual ~PolynomialKernelFunction(void) {};
56
57    ///
58    /// returning the scalar product of two vectors in feature space using the
59    /// polynomial kernel. @return If order is larger than one: \f$ (1+x \cdot
60    /// y)^{order} \f$ \n If order is one (linear): \f$ x \cdot y \f$
61    ///
62    double operator()(const DataLookup1D& a1, const DataLookup1D& a2) const;
63
64    ///
65    /// @return If order is larger than one: \f$ (1+x \cdot y)^{order}
66    /// \f$ \n If order is one (linear): \f$ \sum w_yxy \f$
67    ///
68    ///
69    double operator()(const DataLookup1D& x,
70                      const DataLookupWeighted1D& y) const;
71    ///
72    /// returning the scalar product of two vectors in feature space
73    /// using the polynomial kernel with weights. Having all weights
74    /// equal to unity yields the same as non-weighted version.
75    ///
76    /// @return If order is larger than one: \f$ (1+x \cdot y)^{order}
77    /// \f$ \n If order is one (linear): \f$ \sum w_xw_yxy \f$
78    ///
79    double operator()(const DataLookupWeighted1D& x,
80                      const DataLookupWeighted1D& y) const;
81
82
83  private:
84    int order_;
85
86  }; // class PolynomialKernelFunction
87
88}}} // of namespace classifier, yat, and theplu
89
90#endif
Note: See TracBrowser for help on using the repository browser.