SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DiffusionMaps.cpp
Go to the documentation of this file.
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 */

SHOGUN Machine Learning Toolbox - Documentation