SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
BesselKernel.cpp
浏览该文件的文档.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2011 Zi Yuan
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
13 #include <math.h>
14 
15 using namespace shogun;
16 
18 {
19  init();
20 }
21 
23  int32_t n, CDistance* dist) :
24  CDistanceKernel(size,w,dist), order(v), degree(n)
25 {
28  init();
29 }
30 
32  float64_t w, int32_t n, CDistance* dist, int32_t size) :
33  CDistanceKernel(size,w,dist), order(v), degree(n)
34 {
35  init();
38  init(l,r);
39 }
40 
42 {
43  cleanup();
45 }
46 
48 {
49 }
50 
51 bool CBesselKernel::init(CFeatures* l, CFeatures* r)
52 {
54  CDistanceKernel::init(l,r);
55  distance->init(l,r);
56  return init_normalizer();
57 }
58 
59 void CBesselKernel::init()
60 {
61  SG_ADD(&order, "order", "Kernel order.", MS_AVAILABLE);
62  SG_ADD(&degree, "degree", "Kernel degree.", MS_AVAILABLE);
63 }
64 
65 float64_t CBesselKernel::compute(int32_t idx_a, int32_t idx_b)
66 {
67  float64_t dist = distance->distance(idx_a, idx_b);
68  return jn(order,dist/width)/CMath::pow(dist,-degree*order);
69 }
virtual void cleanup()
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:81
virtual bool init(CFeatures *l, CFeatures *r)
#define SG_REF(x)
Definition: SGObject.h:51
#define ASSERT(x)
Definition: SGIO.h:201
double float64_t
Definition: common.h:50
The Distance kernel takes a distance as input.
virtual bool init_normalizer()
Definition: Kernel.cpp:168
virtual float64_t distance(int32_t idx_a, int32_t idx_b)
Definition: Distance.cpp:189
#define SG_UNREF(x)
Definition: SGObject.h:52
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
float64_t compute(int32_t idx_a, int32_t idx_b)
The class Features is the base class of all feature objects.
Definition: Features.h:68
#define SG_ADD(...)
Definition: SGObject.h:81
virtual bool init(CFeatures *lhs, CFeatures *rhs)
Definition: Distance.cpp:78
static int32_t pow(bool x, int32_t n)
Definition: Math.h:535

SHOGUN 机器学习工具包 - 项目文档