SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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 
00072     virtual EKernelType get_kernel_type() { return K_SPHERICAL; }
00073 
00077     virtual EFeatureType get_feature_type() { return distance->get_feature_type(); }
00078 
00082     virtual EFeatureClass get_feature_class() { return distance->get_feature_class(); }
00083 
00087     virtual const char* get_name() const { return "SphericalKernel"; }
00088 
00093     virtual void set_sigma(float64_t s)
00094     {
00095         sigma=s;
00096     }
00097 
00102     virtual float64_t get_sigma() const
00103     {
00104         return sigma;
00105     }
00106 
00107     virtual ~CSphericalKernel();
00108 
00109 private:
00111     void register_params();
00112 
00113 protected:
00114 
00116     CDistance* distance;
00117 
00119     float64_t sigma;
00120 
00130     virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00131 };
00132 }
00133 
00134 #endif /* _SPHERICALKERNEL_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation