yat/classifier/PolynomialKernelFunction.h

Code
Comments
Other
Rev Date Author Line
680 11 Oct 06 jari 1 #ifndef _theplu_yat_classifier_polynomial_kernel_function_
680 11 Oct 06 jari 2 #define _theplu_yat_classifier_polynomial_kernel_function_
25 06 Aug 03 peter 3
627 05 Sep 06 peter 4 // $Id$
627 05 Sep 06 peter 5
675 10 Oct 06 jari 6 /*
831 27 Mar 07 peter 7   Copyright (C) 2003 Peter Johansson
4359 23 Aug 23 peter 8   Copyright (C) 2004, 2005, 2006 Jari Häkkinen, Peter Johansson
4359 23 Aug 23 peter 9   Copyright (C) 2007 Peter Johansson
4359 23 Aug 23 peter 10   Copyright (C) 2008 Jari Häkkinen, Peter Johansson
25 06 Aug 03 peter 11
1437 25 Aug 08 peter 12   This file is part of the yat library, http://dev.thep.lu.se/yat
527 01 Mar 06 peter 13
675 10 Oct 06 jari 14   The yat library is free software; you can redistribute it and/or
675 10 Oct 06 jari 15   modify it under the terms of the GNU General Public License as
1486 09 Sep 08 jari 16   published by the Free Software Foundation; either version 3 of the
675 10 Oct 06 jari 17   License, or (at your option) any later version.
675 10 Oct 06 jari 18
675 10 Oct 06 jari 19   The yat library is distributed in the hope that it will be useful,
675 10 Oct 06 jari 20   but WITHOUT ANY WARRANTY; without even the implied warranty of
675 10 Oct 06 jari 21   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
675 10 Oct 06 jari 22   General Public License for more details.
675 10 Oct 06 jari 23
675 10 Oct 06 jari 24   You should have received a copy of the GNU General Public License
1487 10 Sep 08 jari 25   along with yat. If not, see <http://www.gnu.org/licenses/>.
675 10 Oct 06 jari 26 */
675 10 Oct 06 jari 27
680 11 Oct 06 jari 28 #include "KernelFunction.h"
675 10 Oct 06 jari 29
345 08 Jun 05 jari 30 #include <cmath>
345 08 Jun 05 jari 31
42 26 Feb 04 jari 32 namespace theplu {
680 11 Oct 06 jari 33 namespace yat {
450 15 Dec 05 peter 34 namespace classifier {
42 26 Feb 04 jari 35
747 11 Feb 07 peter 36   class DataLookup1D;
747 11 Feb 07 peter 37
67 27 Apr 04 peter 38   ///
767 22 Feb 07 peter 39   /// @brief Class for polynomial kernel calculations
163 22 Sep 04 peter 40   ///
25 06 Aug 03 peter 41
4200 19 Aug 22 peter 42
4200 19 Aug 22 peter 43   class PolynomialKernelFunction : public KernelFunction
25 06 Aug 03 peter 44   {
4200 19 Aug 22 peter 45
25 06 Aug 03 peter 46   public:
163 22 Sep 04 peter 47     ///
163 22 Sep 04 peter 48     ///Constructor taking the order of the polynomial as input. Default is
67 27 Apr 04 peter 49     ///order=1 yielding the linear kernel function.
67 27 Apr 04 peter 50     ///
25 06 Aug 03 peter 51     PolynomialKernelFunction(int = 1);
4200 19 Aug 22 peter 52
100 10 Jun 04 peter 53     ///
67 27 Apr 04 peter 54     ///Destructor
67 27 Apr 04 peter 55     ///
100 10 Jun 04 peter 56     virtual ~PolynomialKernelFunction(void) {};
4200 19 Aug 22 peter 57
163 22 Sep 04 peter 58     ///
627 05 Sep 06 peter 59     /// returning the scalar product of two vectors in feature space using the
627 05 Sep 06 peter 60     /// polynomial kernel. @return If order is larger than one: \f$ (1+x \cdot
627 05 Sep 06 peter 61     /// y)^{order} \f$ \n If order is one (linear): \f$ x \cdot y \f$
4200 19 Aug 22 peter 62     ///
627 05 Sep 06 peter 63     double operator()(const DataLookup1D& a1, const DataLookup1D& a2) const;
67 27 Apr 04 peter 64
627 05 Sep 06 peter 65     ///
627 05 Sep 06 peter 66     /// @return If order is larger than one: \f$ (1+x \cdot y)^{order}
648 14 Sep 06 peter 67     /// \f$ \n If order is one (linear): \f$ \sum w_yxy \f$
627 05 Sep 06 peter 68     ///
627 05 Sep 06 peter 69     ///
4200 19 Aug 22 peter 70     double operator()(const DataLookup1D& x,
627 05 Sep 06 peter 71                       const DataLookupWeighted1D& y) const;
627 05 Sep 06 peter 72     ///
627 05 Sep 06 peter 73     /// returning the scalar product of two vectors in feature space
627 05 Sep 06 peter 74     /// using the polynomial kernel with weights. Having all weights
627 05 Sep 06 peter 75     /// equal to unity yields the same as non-weighted version.
627 05 Sep 06 peter 76     ///
627 05 Sep 06 peter 77     /// @return If order is larger than one: \f$ (1+x \cdot y)^{order}
648 14 Sep 06 peter 78     /// \f$ \n If order is one (linear): \f$ \sum w_xw_yxy \f$
627 05 Sep 06 peter 79     ///
4200 19 Aug 22 peter 80     double operator()(const DataLookupWeighted1D& x,
627 05 Sep 06 peter 81                       const DataLookupWeighted1D& y) const;
345 08 Jun 05 jari 82
627 05 Sep 06 peter 83
25 06 Aug 03 peter 84   private:
25 06 Aug 03 peter 85     int order_;
25 06 Aug 03 peter 86
25 06 Aug 03 peter 87   }; // class PolynomialKernelFunction
25 06 Aug 03 peter 88
680 11 Oct 06 jari 89 }}} // of namespace classifier, yat, and theplu
25 06 Aug 03 peter 90
25 06 Aug 03 peter 91 #endif