25 REQUIRE(w>0,
"width (%f) must be positive\n",w);
62 SG_SERROR(
"CGaussianKernel::obtain_from_generic(): provided kernel is "
63 "not of type CGaussianKernel!\n");
101 int32_t num_vec=df->get_num_vectors();
104 for (int32_t i=0; i<num_vec; i++)
105 buf[i]=df->
dot(i,df, i);
113 CDotKernel::init(l, r);
114 precompute_squared();
126 int32_t len_features, power;
128 power=(len_features%2==0) ? (len_features+1):len_features;
131 float64_t result_multiplier=1-(sqrt(result))/3;
133 if (result_multiplier<=0)
136 result_multiplier=pow(result_multiplier, power);
138 return result_multiplier*exp(-result);
144 precompute_squared();
147 void CGaussianKernel::precompute_squared()
165 if (!strcmp(param->
m_name,
"log_width"))
173 derivative(j,k)=exp(-element)*element*2.0;
180 SG_ERROR(
"Can't compute derivative wrt %s parameter\n", param->
m_name);
185 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
Vector::Scalar dot(Vector a, Vector b)
virtual void load_serializable_post()
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
virtual float64_t distance(int32_t idx_a, int32_t idx_b)
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)
static float64_t log(float64_t v)
virtual bool init(CFeatures *l, CFeatures *r)
virtual ~CGaussianKernel()
virtual void set_width(float64_t w)
virtual float64_t get_width() const