SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
DiffusionMaps.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 Sergey Lisitsyn
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
13 #include <shogun/lib/config.h>
14 #ifdef HAVE_EIGEN3
16 #include <shogun/lib/tapkee/tapkee_shogun.hpp>
17 
18 using namespace shogun;
19 
22 {
23  m_t = 10;
24  m_width = 1.0;
26 
27  init();
28 }
29 
31 {
32  SG_ADD(&m_t, "t", "number of steps", MS_AVAILABLE);
33  SG_ADD(&m_width, "width", "gaussian kernel width", MS_AVAILABLE);
34 }
35 
37 {
38 }
39 
40 void CDiffusionMaps::set_t(int32_t t)
41 {
42  m_t = t;
43 }
44 
45 int32_t CDiffusionMaps::get_t() const
46 {
47  return m_t;
48 }
49 
51 {
52  m_width = width;
53 }
54 
56 {
57  return m_width;
58 }
59 
60 const char* CDiffusionMaps::get_name() const
61 {
62  return "DiffusionMaps";
63 };
64 
66 {
67  ASSERT(features)
68  // shorthand for simplefeatures
69  SG_REF(features);
70  // compute distance matrix
72  m_distance->init(features,features);
75  SG_UNREF(features);
76  return (CFeatures*)embedding;
77 }
78 
80 {
81  TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
82  parameters.n_timesteps = m_t;
83  parameters.gaussian_kernel_width = m_width;
84  parameters.method = SHOGUN_DIFFUSION_MAPS;
85  parameters.target_dimension = m_target_dim;
86  parameters.distance = distance;
87  return tapkee_embed(parameters);
88 }
89 #endif /* HAVE_EIGEN3 */
float distance(CJLCoverTreePoint p1, CJLCoverTreePoint p2, float64_t upper_bound)
virtual CFeatures * apply(CFeatures *features)
int32_t get_t() const
virtual void cleanup()=0
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:81
virtual CDenseFeatures< float64_t > * embed_distance(CDistance *distance)
class EmbeddingConverter (part of the Efficient Dimensionality Reduction Toolkit) used to construct e...
#define SG_REF(x)
Definition: SGObject.h:51
void set_distance(CDistance *distance)
#define ASSERT(x)
Definition: SGIO.h:201
virtual const char * get_name() const
double float64_t
Definition: common.h:50
void set_width(float64_t width)
#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
void set_t(int32_t t)
float64_t get_width() const
#define SG_ADD(...)
Definition: SGObject.h:81
virtual bool init(CFeatures *lhs, CFeatures *rhs)
Definition: Distance.cpp:78
class EuclideanDistance

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