SHOGUN
v3.0.0
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
converter
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
11
#include <
shogun/converter/Isomap.h
>
12
#ifdef HAVE_EIGEN3
13
#include <
shogun/io/SGIO.h
>
14
#include <
shogun/lib/Signal.h
>
15
#include <shogun/lib/tapkee/tapkee_shogun.hpp>
16
17
using namespace
shogun;
18
19
CIsomap::CIsomap
() :
CMultidimensionalScaling
()
20
{
21
m_k
= 3;
22
23
init
();
24
}
25
26
void
CIsomap::init
()
27
{
28
SG_ADD
(&
m_k
,
"k"
,
"number of neighbors"
,
MS_AVAILABLE
);
29
}
30
31
CIsomap::~CIsomap
()
32
{
33
}
34
35
void
CIsomap::set_k
(int32_t k)
36
{
37
ASSERT
(k>0)
38
m_k
= k;
39
}
40
41
int32_t
CIsomap::get_k
()
const
42
{
43
return
m_k
;
44
}
45
46
const
char
*
CIsomap::get_name
()
const
47
{
48
return
"Isomap"
;
49
}
50
51
CDenseFeatures<float64_t>
*
CIsomap::embed_distance
(
CDistance
*
distance
)
52
{
53
TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
54
if
(
m_landmark
)
55
{
56
parameters.method = SHOGUN_LANDMARK_ISOMAP;
57
parameters.landmark_ratio =
float64_t
(
m_landmark_number
)/distance->
get_num_vec_lhs
();
58
}
59
else
60
{
61
parameters.method = SHOGUN_ISOMAP;
62
}
63
parameters.n_neighbors =
m_k
;
64
parameters.target_dimension =
m_target_dim
;
65
parameters.distance =
distance
;
66
CDenseFeatures<float64_t>
* embedding = tapkee_embed(parameters);
67
return
embedding;
68
}
69
70
#endif
/* HAVE_EIGEN3 */
SHOGUN
Machine Learning Toolbox - Documentation