SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Isomap.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-2013 Sergey Lisitsyn
8  * Copyright (C) 2011-2013 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
12 #include <shogun/io/SGIO.h>
13 #include <shogun/lib/Signal.h>
14 #include <shogun/lib/tapkee/tapkee_shogun.hpp>
15 
16 using namespace shogun;
17 
19 {
20  m_k = 3;
21 
22  init();
23 }
24 
26 {
27  SG_ADD(&m_k, "k", "number of neighbors", MS_AVAILABLE);
28 }
29 
31 {
32 }
33 
34 void CIsomap::set_k(int32_t k)
35 {
36  ASSERT(k>0)
37  m_k = k;
38 }
39 
40 int32_t CIsomap::get_k() const
41 {
42  return m_k;
43 }
44 
45 const char* CIsomap::get_name() const
46 {
47  return "Isomap";
48 }
49 
51 {
52  TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
53  if (m_landmark)
54  {
55  parameters.method = SHOGUN_LANDMARK_ISOMAP;
56  parameters.landmark_ratio = float64_t(m_landmark_number)/distance->get_num_vec_lhs();
57  }
58  else
59  {
60  parameters.method = SHOGUN_ISOMAP;
61  }
62  parameters.n_neighbors = m_k;
63  parameters.target_dimension = m_target_dim;
64  parameters.distance = distance;
65  CDenseFeatures<float64_t>* embedding = tapkee_embed(parameters);
66  return embedding;
67 }
68 
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:87
virtual int32_t get_num_vec_lhs()
Definition: Distance.h:312
const char * get_name() const
Definition: Isomap.cpp:45
virtual ~CIsomap()
Definition: Isomap.cpp:30
class Multidimensionalscaling is used to perform multidimensional scaling (capable of landmark approx...
#define ASSERT(x)
Definition: SGIO.h:201
double float64_t
Definition: common.h:50
void set_k(int32_t k)
Definition: Isomap.cpp:34
int32_t get_k() const
Definition: Isomap.cpp:40
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
int32_t m_k
FIELDS.
Definition: Isomap.h:94
virtual void init()
HELPERS.
Definition: Isomap.cpp:25
virtual CDenseFeatures< float64_t > * embed_distance(CDistance *distance)
Definition: Isomap.cpp:50
#define SG_ADD(...)
Definition: SGObject.h:84

SHOGUN Machine Learning Toolbox - Documentation