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

Last change on this file since 747 was 747, checked in by Peter, 15 years ago

replaced includes in header files with forward declarations when possible. Added some includes in cc files.

  • 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) The authors contributing to this file.
8
9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24  02111-1307, USA.
25*/
26
27#include "KernelFunction.h"
28
29#include <cmath>
30
31namespace theplu {
32namespace yat {
33namespace classifier {
34
35  class DataLookup1D;
36
37  ///
38  /// 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.