#ifndef _theplu_yat_classifier_polynomial_kernel_function_ #define _theplu_yat_classifier_polynomial_kernel_function_ // $Id$ /* Copyright (C) 2003 Peter Johansson Copyright (C) 2004, 2005, 2006, 2007 Jari Häkkinen, Peter Johansson This file is part of the yat library, http://dev.thep.lu.se/yat The yat library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The yat library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with yat. If not, see . */ #include "KernelFunction.h" #include namespace theplu { namespace yat { namespace classifier { class DataLookup1D; /// /// @brief Class for polynomial kernel calculations /// class PolynomialKernelFunction : public KernelFunction { public: /// ///Constructor taking the order of the polynomial as input. Default is ///order=1 yielding the linear kernel function. /// PolynomialKernelFunction(int = 1); /// ///Destructor /// virtual ~PolynomialKernelFunction(void) {}; /// /// returning the scalar product of two vectors in feature space using the /// polynomial kernel. @return If order is larger than one: \f$(1+x \cdot /// y)^{order} \f$ \n If order is one (linear): \f$x \cdot y \f$ /// double operator()(const DataLookup1D& a1, const DataLookup1D& a2) const; /// /// @return If order is larger than one: \f$(1+x \cdot y)^{order} /// \f$ \n If order is one (linear): \f$\sum w_yxy \f$ /// /// double operator()(const DataLookup1D& x, const DataLookupWeighted1D& y) const; /// /// returning the scalar product of two vectors in feature space /// using the polynomial kernel with weights. Having all weights /// equal to unity yields the same as non-weighted version. /// /// @return If order is larger than one: \f$(1+x \cdot y)^{order} /// \f$ \n If order is one (linear): \f$\sum w_xw_yxy \f$ /// double operator()(const DataLookupWeighted1D& x, const DataLookupWeighted1D& y) const; private: int order_; }; // class PolynomialKernelFunction }}} // of namespace classifier, yat, and theplu #endif