SphericalKernel.h

Go to the documentation of this file.
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  * Based on GaussianKernel, Written (W) 1999-2010 Soeren Sonnenburg
00008  * Written (W) 2011 Shashwat Lal Das
00009  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
00010  */
00011 
00012 #include <shogun/lib/config.h>
00013 
00014 #ifndef _SPHERICALKERNEL_H__
00015 #define _SPHERICALKERNEL_H__
00016 
00017 #include <shogun/lib/common.h>
00018 #include <shogun/kernel/Kernel.h>
00019 #include <shogun/distance/Distance.h>
00020 
00021 namespace shogun
00022 {
00023 
00024 class CDistance;
00025 
00038 class CSphericalKernel: public CKernel
00039 {
00040     public:
00042     CSphericalKernel();
00043 
00050     CSphericalKernel(int32_t size, float64_t sigma, CDistance* dist);
00051 
00059     CSphericalKernel(CFeatures *l, CFeatures *r, float64_t sigma, CDistance* dist);
00060 
00067     virtual bool init(CFeatures* l, CFeatures* r);
00068 
00069     void init();
00070 
00074     inline virtual EKernelType get_kernel_type() { return K_SPHERICAL; }
00075 
00079     inline virtual EFeatureType get_feature_type() { return distance->get_feature_type(); }
00080 
00084     inline virtual EFeatureClass get_feature_class() { return distance->get_feature_class(); }
00085 
00089     inline virtual const char* get_name() const { return "SphericalKernel"; }
00090 
00095     inline virtual void set_sigma(float64_t s)
00096     {
00097         sigma=s;
00098     }
00099 
00104     inline virtual float64_t get_sigma() const
00105     {
00106         return sigma;
00107     }
00108 
00109     virtual ~CSphericalKernel();
00110 protected:
00111 
00113     CDistance* distance;
00114 
00116     float64_t sigma;
00117 
00127     virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00128 };
00129 }
00130 
00131 #endif /* _SPHERICALKERNEL_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation