00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Gaussian Kernel used as template, attribution: 00008 * Written (W) 1999-2010 Soeren Sonnenburg 00009 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00010 * Copyright (C) 2010 Berlin Institute of Technology 00011 * 00012 * Slightly edited by Justin Patera 2011 00013 */ 00014 00015 #ifndef _EXPONENTIALKERNEL_H___ 00016 #define _EXPONENTIALKERNEL_H___ 00017 00018 #include <shogun/lib/common.h> 00019 #include <shogun/kernel/DotKernel.h> 00020 #include <shogun/features/DotFeatures.h> 00021 #include <shogun/distance/Distance.h> 00022 00023 namespace shogun 00024 { 00025 class CDotFeatures; 00037 class CExponentialKernel: public CDotKernel 00038 { 00039 public: 00043 CExponentialKernel(); 00044 00053 CExponentialKernel(CDotFeatures* l, CDotFeatures* r, 00054 float64_t width, CDistance* distance, int32_t size); 00055 00057 virtual ~CExponentialKernel(); 00058 00065 virtual bool init(CFeatures* l, CFeatures* r); 00066 00068 virtual void cleanup(); 00069 00074 virtual EKernelType get_kernel_type() { return K_EXPONENTIAL; } 00075 00080 virtual const char* get_name() const { return "ExponentialKernel"; } 00081 00086 virtual float64_t get_width() const 00087 { 00088 return m_width; 00089 } 00090 00091 protected: 00100 virtual float64_t compute(int32_t idx_a, int32_t idx_b); 00101 00110 virtual void load_serializable_post() throw (ShogunException); 00111 00112 private: 00113 void init(); 00114 00115 protected: 00117 CDistance* m_distance; 00119 float64_t m_width; 00120 }; 00121 } 00122 #endif /* _EXPONENTIALKERNEL_H__ */