LinearARDKernel.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  * (W) 2012 Jacob Walker
00008  *
00009  * Adapted from WeightedDegreeRBFKernel.h
00010  *
00011  */
00012 
00013 #ifndef LINEARARDKERNEL_H_
00014 #define LINEARARDKERNEL_H_
00015 
00016 #include <shogun/lib/common.h>
00017 #include <shogun/kernel/DotKernel.h>
00018 #include <shogun/features/DenseFeatures.h>
00019 
00020 namespace shogun
00021 {
00022 
00026 class CLinearARDKernel: public CDotKernel
00027 {
00028 
00029 public:
00033     CLinearARDKernel();
00034 
00039     CLinearARDKernel(int32_t size);
00040 
00047     CLinearARDKernel(CDenseFeatures<float64_t>* l, CDenseFeatures<float64_t>* r,
00048         int32_t size=10);
00049 
00050     virtual ~CLinearARDKernel();
00051 
00058     virtual bool init(CFeatures* l, CFeatures* r);
00059 
00064     virtual EKernelType get_kernel_type() { return K_LINEARARD; }
00065 
00070     virtual const char* get_name() const { return "LinearARDKernel"; }
00071 
00072 
00077     virtual EFeatureClass get_feature_class() { return C_DENSE; }
00078 
00083     virtual EFeatureType get_feature_type() { return F_DREAL; }
00084 
00090     virtual void set_weight(float64_t w, index_t i);
00091 
00098     virtual float64_t get_weight(index_t i);
00099 
00100     protected:
00101 
00110     virtual float64_t compute(int32_t idx_a, int32_t idx_b);
00111 
00116     void init_ft_weights();
00117 
00126     virtual SGMatrix<float64_t> get_parameter_gradient(TParameter* param,
00127             CSGObject* obj, index_t index);
00128 
00129 private:
00130 
00131     void init();
00132 
00133 protected:
00134 
00136     SGVector<float64_t> m_weights;
00137 };
00138 
00139 } /* namespace shogun */
00140 #endif /* LINEARARDKERNEL_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation