WeightedDegreeRBFKernel.h

Go to the documentation of this file.
00001 #ifndef _WEIGHTEDDEGREERBFKERNEL_H___
00002 #define _WEIGHTEDDEGREERBFKERNEL_H___
00003 
00004 #include "lib/common.h"
00005 #include "kernel/SimpleKernel.h"
00006 #include "features/SimpleFeatures.h"
00007 
00008 namespace shogun
00009 {
00010 
00011 class CWeightedDegreeRBFKernel: public CSimpleKernel<float64_t>
00012 {
00013     public:
00017         CWeightedDegreeRBFKernel();
00018 
00026         CWeightedDegreeRBFKernel(int32_t size, float64_t width, int32_t degree, int32_t nof_properties);
00027 
00037         CWeightedDegreeRBFKernel(CSimpleFeatures<float64_t>* l, CSimpleFeatures<float64_t>* r,
00038             float64_t width, int32_t degree, int32_t nof_properties, int32_t size=10);
00039 
00040         virtual ~CWeightedDegreeRBFKernel();
00041 
00048         virtual bool init(CFeatures* l, CFeatures* r);
00049 
00054         //virtual EKernelType get_kernel_type() { return K_UNKNOWN; }
00055         virtual EKernelType get_kernel_type() { return K_WEIGHTEDDEGREERBF; }
00056         
00061         inline virtual const char* get_name() const { return "WeightedDegreeRBFKernel"; }
00062         
00063     
00064     
00070         inline bool set_degree(int32_t deg) { degree=deg; return true; }
00071 
00076         inline int32_t get_degree() { return degree; }
00077 
00078         protected:
00087         virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00088 
00093         bool init_wd_weights();
00094 
00095 
00096 #ifdef HAVE_BOOST_SERIALIZATION
00097     private:
00098 
00099         friend class ::boost::serialization::access;
00100         template<class Archive>
00101             void serialize(Archive & ar, const unsigned int archive_version)
00102             {
00103 
00104                 SG_DEBUG("archiving WeightedDegreeRBFKernel\n");
00105 
00106                 ar & ::boost::serialization::base_object<CSimpleKernel<float64_t> >(*this);
00107 
00108                 ar & width;
00109 
00110                 SG_DEBUG("done with WeightedDegreeRBFKernel\n");
00111 
00112             }
00113 #endif //HAVE_BOOST_SERIALIZATION
00114 
00115 
00116     protected:
00118         float64_t width;
00119 
00121         int32_t degree;
00122 
00124         int32_t nof_properties;
00125 
00128         float64_t* weights;
00129 
00130 };
00131 }
00132 #endif /* _WEIGHTEDDEGREERBFKERNEL_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation