SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
LaplacianEigenmaps.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-2013 Sergey Lisitsyn
8  * Copyright (C) 2011-2013 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
13 #ifdef HAVE_EIGEN3
15 #include <shogun/lib/tapkee/tapkee_shogun.hpp>
16 
17 using namespace shogun;
18 
21 {
22  m_k = 3;
23  m_tau = 1.0;
24 
25  init();
26 }
27 
29 {
30  SG_ADD(&m_k, "k", "number of neighbors", MS_AVAILABLE);
31  SG_ADD(&m_tau, "tau", "heat distribution coefficient", MS_AVAILABLE);
32 }
33 
35 {
36 }
37 
39 {
40  ASSERT(k>0)
41  m_k = k;
42 }
43 
45 {
46  return m_k;
47 }
48 
50 {
51  m_tau = tau;
52 }
53 
55 {
56  return m_tau;
57 }
58 
59 const char* CLaplacianEigenmaps::get_name() const
60 {
61  return "LaplacianEigenmaps";
62 };
63 
65 {
66  // shorthand for simplefeatures
67  SG_REF(features);
68 
69  // get dimensionality and number of vectors of data
70  int32_t N = features->get_num_vectors();
71  ASSERT(m_k<N)
73 
74  // compute distance matrix
76  m_distance->init(features,features);
79  SG_UNREF(features);
80  return (CFeatures*)embedding;
81 }
82 
84 {
85  TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
86  parameters.n_neighbors = m_k;
87  parameters.gaussian_kernel_width = m_tau;
88  parameters.method = SHOGUN_LAPLACIAN_EIGENMAPS;
89  parameters.target_dimension = m_target_dim;
90  parameters.distance = distance;
91  return tapkee_embed(parameters);
92 }
93 #endif /* HAVE_EIGEN3 */
float distance(CJLCoverTreePoint p1, CJLCoverTreePoint p2, float64_t upper_bound)
Class Distance, a base class for all the distances used in the Shogun toolbox.
Definition: Distance.h:81
class EmbeddingConverter (part of the Efficient Dimensionality Reduction Toolkit) used to construct e...
virtual int32_t get_num_vectors() const =0
virtual CDenseFeatures< float64_t > * embed_distance(CDistance *distance)
#define SG_REF(x)
Definition: SGObject.h:51
#define ASSERT(x)
Definition: SGIO.h:201
virtual void remove_lhs_and_rhs()
Definition: Distance.cpp:119
double float64_t
Definition: common.h:50
#define SG_UNREF(x)
Definition: SGObject.h:52
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual CFeatures * apply(CFeatures *features)
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
virtual const char * get_name() const

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