SHOGUN  5.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
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>
15 #include <shogun/lib/tapkee/tapkee_shogun.hpp>
16 
17 using namespace shogun;
18 
21 {
22  m_t = 10;
23  m_width = 1.0;
25 
26  init();
27 }
28 
30 {
31  SG_ADD(&m_t, "t", "number of steps", MS_AVAILABLE);
32  SG_ADD(&m_width, "width", "gaussian kernel width", MS_AVAILABLE);
33 }
34 
36 {
37 }
38 
39 void CDiffusionMaps::set_t(int32_t t)
40 {
41  m_t = t;
42 }
43 
44 int32_t CDiffusionMaps::get_t() const
45 {
46  return m_t;
47 }
48 
50 {
51  m_width = width;
52 }
53 
55 {
56  return m_width;
57 }
58 
59 const char* CDiffusionMaps::get_name() const
60 {
61  return "DiffusionMaps";
62 };
63 
65 {
66  ASSERT(features)
67  // shorthand for simplefeatures
68  SG_REF(features);
69  // compute distance matrix
71  m_distance->init(features,features);
74  SG_UNREF(features);
75  return (CFeatures*)embedding;
76 }
77 
79 {
80  TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
81  parameters.n_timesteps = m_t;
82  parameters.gaussian_kernel_width = m_width;
83  parameters.method = SHOGUN_DIFFUSION_MAPS;
84  parameters.target_dimension = m_target_dim;
85  parameters.distance = distance;
86  return tapkee_embed(parameters);
87 }
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:87
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:54
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:55
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:84
virtual bool init(CFeatures *lhs, CFeatures *rhs)
Definition: Distance.cpp:78
class EuclideanDistance

SHOGUN Machine Learning Toolbox - Documentation