51 SG_SERROR(
"CGaussianKernel::obtain_from_generic(): provided kernel is " 52 "not of type CGaussianKernel!\n");
93 for (int32_t i=0; i<num_vec; i++)
94 buf[i]=df->
dot(i,df, i);
102 CDotKernel::init(l, r);
103 precompute_squared();
116 int32_t len_features, power;
118 power=(len_features%2==0) ? (len_features+1):len_features;
123 if (result_multiplier<=0)
126 result_multiplier=pow(result_multiplier, power);
128 return result_multiplier*exp(-result/
width);
134 precompute_squared();
137 void CGaussianKernel::precompute_squared()
155 if (!strcmp(param->
m_name,
"width"))
170 SG_ERROR(
"Can't compute derivative wrt %s parameter\n", param->
m_name);
175 void CGaussianKernel::init()
virtual void load_serializable_post()
void set_compact_enabled(bool compact)
int32_t num_rhs
number of feature vectors on right hand side
virtual void load_serializable_post()
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
virtual float64_t dot(int32_t vec_idx1, CDotFeatures *df, int32_t vec_idx2)=0
virtual int32_t get_num_vectors() const =0
float64_t kernel(int32_t idx_a, int32_t idx_b)
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
Features that support dot products among other operations.
int32_t cache_size
cache_size in MB
Template class DotKernel is the base class for kernels working on DotFeatures.
Class SGObject is the base class of all shogun objects.
virtual SGMatrix< float64_t > get_parameter_gradient(const TParameter *param, index_t index=-1)
int32_t num_lhs
number of feature vectors on left hand side
virtual CSGObject * shallow_copy() const
The well known Gaussian kernel (swiss army knife for SVMs) computed on CDotFeatures.
virtual bool init_normalizer()
CFeatures * rhs
feature vectors to occur on right hand side
static CGaussianKernel * obtain_from_generic(CKernel *kernel)
all of classes and functions are contained in the shogun namespace
virtual EKernelType get_kernel_type()=0
CFeatures * lhs
feature vectors to occur on left hand side
The class Features is the base class of all feature objects.
static float64_t exp(float64_t x)
virtual bool init(CFeatures *l, CFeatures *r)
virtual ~CGaussianKernel()
virtual void set_width(float64_t w)