yat/classifier/GaussianKernelFunction.h

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