37 #ifdef USE_SHORTREAL_KERNELCACHE
209 "%s::kernel(): index out of Range: idx_a=%d/%d idx_b=%d/%d\n",
221 return get_kernel_matrix<float64_t>();
233 REQUIRE(
lhs,
"CKernel::get_kernel_diagonal(): Left-handside "
234 "features missing!\n");
236 REQUIRE(
rhs,
"CKernel::get_kernel_diagonal(): Right-handside "
237 "features missing!\n");
242 if (!preallocated.vector)
246 REQUIRE(preallocated.vlen==length,
247 "%s::get_kernel_diagonal(): Preallocated vector has"
251 for (
index_t i=0; i<preallocated.vlen; ++i)
252 preallocated[i]=
kernel(i, i);
267 for (int32_t i=0; i!=
num_rhs; i++)
283 for (int32_t j=0; j!=
num_lhs; j++)
313 index_t block_size,
bool no_diag=
true);
345 index_t block_size_col,
bool no_diag=
false);
371 block_begin,
index_t block_size,
bool no_diag=
true);
591 #endif //USE_SVMLIGHT
624 int32_t docnum, int32_t *active2dnum,
float64_t *buffer,
625 bool full_line=
false);
650 int32_t totdoc, int32_t num_shrink, int32_t *after);
658 bool regression_hack=
false);
713 #endif //USE_SVMLIGHT
763 int32_t count, int32_t *IDX,
float64_t *weights);
794 int32_t num_vec, int32_t* vec_idx,
float64_t* target,
795 int32_t num_suppvec, int32_t* IDX,
float64_t* alphas,
822 int32_t vector_idx,
float64_t * subkernel_contrib);
853 SG_ERROR(
"Can't compute derivative wrt %s parameter\n", param->
m_name)
926 i_start=(int32_t) (offs/int64_t(n));
980 #ifndef DOXYGEN_SHOULD_SKIP_THIS
982 struct KERNEL_CACHE {
988 int32_t *active2totdoc;
990 int32_t *totdoc2active;
1005 KERNELCACHE_ELEM *buffer;
1007 KERNELCACHE_IDX buffsize;
1011 struct S_KTHREAD_PARAM
1018 KERNELCACHE_ELEM** cache;
1020 int32_t* uncached_rows;
1022 int32_t num_uncached;
1024 uint8_t* needs_computation;
1030 int32_t num_vectors;
1032 #endif // DOXYGEN_SHOULD_SKIP_THIS
1035 static void* cache_multiple_kernel_row_helper(
void* p);
1038 void kernel_cache_free(int32_t cacheidx);
1039 int32_t kernel_cache_malloc();
1040 int32_t kernel_cache_free_lru();
1041 KERNELCACHE_ELEM *kernel_cache_clean_and_malloc(int32_t cacheidx);
1042 #endif //USE_SVMLIGHT
1052 #endif //USE_SVMLIGHT
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.
int32_t get_activenum_cache()
virtual void compute_by_subkernel(int32_t vector_idx, float64_t *subkernel_contrib)
void cache_multiple_kernel_rows(int32_t *key, int32_t varnum)
int32_t get_max_elems_cache()
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)
int32_t kernel_cache_space_available()
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
int32_t kernel_cache_touch(int32_t cacheidx)
EFeatureClass
shogun feature class
void kernel_cache_shrink(int32_t totdoc, int32_t num_shrink, int32_t *after)
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)
SGVector< T > get_diagonal_vector() const
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)
void cache_kernel_row(int32_t x)
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()
KERNEL_CACHE kernel_cache
kernel cache
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...
all of classes and functions are contained in the shogun namespace
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 >())
void kernel_cache_cleanup()
virtual void remove_lhs()
int32_t kernel_cache_check(int32_t cacheidx)
virtual int32_t get_num_subkernels()
bool init_optimization_svm(CSVM *svm)
A generic Support Vector Machine Interface.
void kernel_cache_reset_lru()
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)
virtual bool has_features()
void kernel_cache_init(int32_t size, bool regression_hack=false)
virtual void add_to_normal(int32_t vector_idx, float64_t weight)
virtual SGVector< float64_t > get_parameter_gradient_diagonal(const TParameter *param, index_t index=-1)
float64_t KERNELCACHE_ELEM
friend class CStreamingKernel
void set_property(EKernelProperty p)
VarianceKernelNormalizer divides by the ``variance''.
void resize_kernel_cache(KERNELCACHE_IDX size, bool regression_hack=false)
virtual EFeatureClass get_feature_class()=0