34 #ifdef USE_SHORTREAL_KERNELCACHE
204 "%s::kernel(): index out of Range: idx_a=%d/%d idx_b=%d/%d\n",
216 return get_kernel_matrix<float64_t>();
228 REQUIRE(
lhs,
"CKernel::get_kernel_diagonal(): Left-handside "
229 "features missing!\n");
231 REQUIRE(
rhs,
"CKernel::get_kernel_diagonal(): Right-handside "
232 "features missing!\n");
235 "CKernel::get_kernel_diagonal(): Left- and right-"
236 "handside features must be equal sized\n");
239 if (!preallocated.vector)
244 "%s::get_kernel_diagonal(): Preallocated vector has"
248 for (
index_t i=0; i<preallocated.vlen; ++i)
249 preallocated[i]=
kernel(i, i);
264 for (int32_t i=0; i!=
num_rhs; i++)
280 for (int32_t j=0; j!=
num_lhs; j++)
310 index_t block_size,
bool no_diag=
true);
342 index_t block_size_col,
bool no_diag=
false);
368 block_begin,
index_t block_size,
bool no_diag=
true);
645 int32_t count, int32_t *IDX,
float64_t *weights);
676 int32_t num_vec, int32_t* vec_idx,
float64_t* target,
677 int32_t num_suppvec, int32_t* IDX,
float64_t* alphas,
704 int32_t vector_idx,
float64_t * subkernel_contrib);
735 SG_ERROR(
"Can't compute derivative wrt %s parameter\n", param->
m_name)
795 i_start=(int32_t) (offs/int64_t(n));
virtual void clear_normal()
virtual const char * get_name() const =0
virtual void load_serializable_post()
int32_t compute_row_start(int64_t offs, int32_t n, bool symmetric)
The MultitaskKernel allows Multitask Learning via a modified kernel function.
virtual void compute_by_subkernel(int32_t vector_idx, float64_t *subkernel_contrib)
virtual float64_t compute(int32_t x, int32_t y)=0
DiceKernelNormalizer performs kernel normalization inspired by the Dice coefficient (see http://en...
The MultitaskKernel allows Multitask Learning via a modified kernel function.
int32_t num_rhs
number of feature vectors on right hand side
static void * get_kernel_matrix_helper(void *p)
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
virtual bool set_normalizer(CKernelNormalizer *normalizer)
virtual float64_t sum_block(index_t block_begin_row, index_t block_begin_col, index_t block_size_row, index_t block_size_col, bool no_diag=false)
bool get_lhs_equals_rhs()
virtual int32_t get_num_vectors() const =0
void set_is_initialized(bool p_init)
virtual bool delete_optimization()
void set_cache_size(int32_t size)
float64_t kernel(int32_t idx_a, int32_t idx_b)
virtual void set_optimization_type(EOptimizationType t)
virtual void remove_rhs()
takes all necessary steps if the rhs is removed from kernel
TanimotoKernelNormalizer performs kernel normalization inspired by the Tanimoto coefficient (see http...
virtual int32_t get_num_vec_lhs()
SGMatrix< float64_t > get_kernel_matrix()
static float64_t floor(float64_t d)
int32_t cache_size
cache_size in MB
EFeatureClass
shogun feature class
bool get_is_initialized()
virtual SGMatrix< float64_t > row_wise_sum_squared_sum_symmetric_block(index_t block_begin, index_t block_size, bool no_diag=true)
float64_t combined_kernel_weight
virtual void register_params()
virtual SGVector< float64_t > get_kernel_col(int32_t j)
virtual void remove_lhs_and_rhs()
bool has_property(EKernelProperty p)
virtual CKernelNormalizer * get_normalizer()
Class SGObject is the base class of all shogun objects.
virtual SGVector< float64_t > row_col_wise_sum_block(index_t block_begin_row, index_t block_begin_col, index_t block_size_row, index_t block_size_col, bool no_diag=false)
virtual float64_t sum_symmetric_block(index_t block_begin, index_t block_size, bool no_diag=true)
virtual SGVector< float64_t > get_subkernel_weights()
virtual EFeatureType get_feature_type()=0
void set_combined_kernel_weight(float64_t nw)
KERNELCACHE_ELEM * kernel_matrix
A File access base class.
virtual void save_serializable_post()
virtual float64_t compute_optimized(int32_t vector_idx)
EOptimizationType get_optimization_type()
void unset_property(EKernelProperty p)
float64_t get_combined_kernel_weight()
virtual SGVector< float64_t > row_wise_sum_symmetric_block(index_t block_begin, index_t block_size, bool no_diag=true)
The MultitaskKernel allows Multitask Learning via a modified kernel function.
Normalize the kernel by a constant obtained from the first element of the kernel matrix, i.e. .
Normalize the kernel by adding a constant term to its diagonal. This aids kernels to become positive ...
int32_t num_lhs
number of feature vectors on left hand side
The class Kernel Normalizer defines a function to post-process kernel values.
ZeroMeanCenterKernelNormalizer centers the kernel in feature space.
virtual int32_t get_num_vec_rhs()
virtual void set_subkernel_weights(SGVector< float64_t > weights)
virtual bool init_normalizer()
bool optimization_initialized
EFeatureType
shogun feature type
EOptimizationType opt_type
CFeatures * rhs
feature vectors to occur on right hand side
static CKernel * obtain_from_generic(CSGObject *kernel)
Base-class for parameterized Kernel Normalizers.
SqrtDiagKernelNormalizer divides by the Square Root of the product of the diagonal elements...
virtual void compute_batch(int32_t num_vec, int32_t *vec_idx, float64_t *target, int32_t num_suppvec, int32_t *IDX, float64_t *alphas, float64_t factor=1.0)
Normalize the kernel by either a constant or the average value of the diagonal elements (depending on...
virtual EKernelType get_kernel_type()=0
virtual bool init_optimization(int32_t count, int32_t *IDX, float64_t *weights)
CFeatures * lhs
feature vectors to occur on left hand side
The class Features is the base class of all feature objects.
virtual void save_serializable_pre()
virtual SGMatrix< float64_t > get_parameter_gradient(const TParameter *param, index_t index=-1)
SGVector< float64_t > get_kernel_diagonal(SGVector< float64_t > preallocated=SGVector< float64_t >())
virtual void remove_lhs()
virtual int32_t get_num_subkernels()
bool init_optimization_svm(CSVM *svm)
A generic Support Vector Machine Interface.
CKernelNormalizer * normalizer
virtual SGVector< float64_t > get_kernel_row(int32_t i)
virtual float64_t normalize(float64_t value, int32_t idx_lhs, int32_t idx_rhs)=0
static float32_t sqrt(float32_t x)
x^0.5
virtual bool has_features()
virtual void add_to_normal(int32_t vector_idx, float64_t weight)
float64_t KERNELCACHE_ELEM
friend class CStreamingKernel
void set_property(EKernelProperty p)
VarianceKernelNormalizer divides by the ``variance''.
virtual EFeatureClass get_feature_class()=0