SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
InverseMultiQuadricKernel.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 Abhinav Maurya
8  * Copyright (C) 2007-2011 Fraunhofer Institute FIRST and Max-Planck-Society
9  * Copyright (C) 2011 Indian Institute of Technology Bombay
10  */
11 
14 
15 using namespace shogun;
16 
18 {
19  init();
20 }
21 
23 : CKernel(cache), distance(dist), coef(coefficient)
24 {
26  init();
27 }
28 
30 : CKernel(10), distance(dist), coef(coefficient)
31 {
33  init();
34  init(l, r);
35 }
36 
38 {
39  cleanup();
41 }
42 
43 bool CInverseMultiQuadricKernel::init(CFeatures* l, CFeatures* r)
44 {
45  CKernel::init(l,r);
46  distance->init(l,r);
47  return init_normalizer();
48 }
49 
51 {
53 }
54 
55 void CInverseMultiQuadricKernel::init()
56 {
57  SG_ADD(&coef, "coef", "Kernel Coefficient.", MS_AVAILABLE);
58  SG_ADD((CSGObject**) &distance, "distance", "Distance to be used.",
59  MS_AVAILABLE);
60 }
61 
62 float64_t CInverseMultiQuadricKernel::compute(int32_t idx_a, int32_t idx_b)
63 {
64  float64_t dist = distance->distance(idx_a, idx_b);
65  return 1/sqrt(dist*dist + coef*coef);
66 }
float distance(CJLCoverTreePoint p1, CJLCoverTreePoint p2, float64_t upper_bound)
virtual void load_serializable_post()
Definition: Kernel.cpp:928
virtual void cleanup()
Definition: Kernel.cpp:173
virtual float64_t compute(int32_t idx_a, int32_t idx_b)
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:81
Class ShogunException defines an exception which is thrown whenever an error inside of shogun occurs...
#define SG_REF(x)
Definition: SGObject.h:51
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
double float64_t
Definition: common.h:50
virtual bool init(CFeatures *l, CFeatures *r)
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
The class Features is the base class of all feature objects.
Definition: Features.h:68
The Kernel base class.
Definition: Kernel.h:158
#define SG_ADD(...)
Definition: SGObject.h:81
virtual bool init(CFeatures *lhs, CFeatures *rhs)
Definition: Distance.cpp:78

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