source: trunk/yat/classifier/PolynomialKernelFunction.h @ 1268

Last change on this file since 1268 was 1000, checked in by Jari Häkkinen, 14 years ago

trac moved to new location.

  • 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 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2007 Peter Johansson
10
11  This file is part of the yat library, http://trac.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 2 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 this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
29#include "KernelFunction.h"
30
31#include <cmath>
32
33namespace theplu {
34namespace yat {
35namespace classifier {
36
37  class DataLookup1D;
38
39  ///
40  /// @brief Class for polynomial kernel calculations
41  ///
42
43 
44  class PolynomialKernelFunction : public KernelFunction
45  {
46   
47  public:
48    ///
49    ///Constructor taking the order of the polynomial as input. Default is
50    ///order=1 yielding the linear kernel function.
51    ///
52    PolynomialKernelFunction(int = 1);
53   
54    ///
55    ///Destructor
56    ///
57    virtual ~PolynomialKernelFunction(void) {};
58   
59    ///
60    /// returning the scalar product of two vectors in feature space using the
61    /// polynomial kernel. @return If order is larger than one: \f$ (1+x \cdot
62    /// y)^{order} \f$ \n If order is one (linear): \f$ x \cdot y \f$
63    ///   
64    double operator()(const DataLookup1D& a1, const DataLookup1D& a2) const;
65
66    ///
67    /// @return If order is larger than one: \f$ (1+x \cdot y)^{order}
68    /// \f$ \n If order is one (linear): \f$ \sum w_yxy \f$
69    ///
70    ///
71    double operator()(const DataLookup1D& x, 
72                      const DataLookupWeighted1D& y) const;
73    ///
74    /// returning the scalar product of two vectors in feature space
75    /// using the polynomial kernel with weights. Having all weights
76    /// equal to unity yields the same as non-weighted version.
77    ///
78    /// @return If order is larger than one: \f$ (1+x \cdot y)^{order}
79    /// \f$ \n If order is one (linear): \f$ \sum w_xw_yxy \f$
80    ///
81    double operator()(const DataLookupWeighted1D& x, 
82                      const DataLookupWeighted1D& y) const;
83
84
85  private:
86    int order_;
87
88  }; // class PolynomialKernelFunction
89
90}}} // of namespace classifier, yat, and theplu
91
92#endif
Note: See TracBrowser for help on using the repository browser.