source: trunk/yat/classifier/GaussianKernelFunction.h @ 865

Last change on this file since 865 was 865, checked in by Peter, 14 years ago

changing URL to http://trac.thep.lu.se/trac/yat

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.3 KB
Line 
1#ifndef _theplu_yat_classifier_gaussian_kernel_function_
2#define _theplu_yat_classifier_gaussian_kernel_function_
3
4// $Id$
5
6/*
7  Copyright (C) 2004, 2005, 2006 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2007 Peter Johansson
9
10  This file is part of the yat library, http://trac.thep.lu.se/trac/yat
11
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 2 of the
15  License, or (at your option) any later version.
16
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25  02111-1307, USA.
26*/
27
28#include "KernelFunction.h"
29
30#include <cmath>
31
32namespace theplu {
33namespace yat {
34namespace classifier {
35
36  class DataLookup1D;
37
38  ///
39  /// @brief Class for Gaussian kernel calculations.
40  ///
41 
42  class GaussianKernelFunction : public KernelFunction
43  {
44   
45  public:
46    ///
47    /// Constructor taking the sigma_ , i.e. the width of the Gaussian,as
48    /// input. Default is sigma_ = 1.
49    ///
50    GaussianKernelFunction(double = 1);
51   
52    ///
53    ///Destructor
54    ///
55       virtual ~GaussianKernelFunction(void) {};
56   
57    ///
58    /// returning the scalar product of two vectors in feature space using the
59    /// Gaussian kernel. @return \f$ exp(-(x - y)^{2}/\sigma^2) \f$ \n
60    ///
61    double operator()(const DataLookup1D& x,
62                      const DataLookup1D& y) const; 
63
64    /**
65       \f$ \exp(-d^2/\sigma^2) \f$ where \f$ d^2 = \sum w_y(x_i-y_i)^2
66       / \sum w_y * N \f$
67     **/
68    double operator()(const DataLookup1D& x,
69                      const DataLookupWeighted1D& y) const; 
70
71    /**
72       \f$ \exp(-d^2/\sigma^2) \f$ where \f$ d^2 = \sum w_xw_y(x_i-y_i)^2
73       / \sum w_xw_y * N \f$
74     **/
75    double operator()(const DataLookupWeighted1D& x,
76                      const DataLookupWeighted1D& y) const; 
77
78  private:
79    double sigma2_;
80
81  }; // class GaussianKernelFunction
82
83}}} // of namespace classifier, yat, and theplu
84
85#endif
Note: See TracBrowser for help on using the repository browser.