SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIConverter.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) 2012 Sergey Lisitsyn
8  * Copyright (C) 2012 Sergey Lisitsyn
9  */
10 
11 #include <shogun/ui/GUIConverter.h>
12 #include <shogun/ui/SGInterface.h>
13 
14 #include <shogun/lib/config.h>
15 #include <shogun/io/SGIO.h>
18 
31 
32 using namespace shogun;
33 
35 : CSGObject(), m_ui(ui)
36 {
37  m_converter = NULL;
38 }
39 
41 {
43 }
44 
46 {
47 #ifdef HAVE_EIGEN3
50 #else
51  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
52 #endif
53  return true;
54 }
55 
57 {
58 #ifdef HAVE_EIGEN3
61 #else
62  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
63 #endif
64  return true;
65 }
66 
68 {
69 #ifdef HAVE_EIGEN3
72 #else
73  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
74 #endif
75  return true;
76 }
77 
79 {
80 #ifdef HAVE_EIGEN3
83 #else
84  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
85 #endif
86  return true;
87 }
88 
90 {
91 #ifdef HAVE_EIGEN3
94 #else
95  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
96 #endif
97  return true;
98 }
99 
101 {
102 #ifdef HAVE_EIGEN3
104  ((CLaplacianEigenmaps*)m_converter)->set_k(k);
105  ((CLaplacianEigenmaps*)m_converter)->set_tau(width);
106 #else
107  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
108 #endif
109  return true;
110 }
111 
113 {
114 #ifdef HAVE_EIGEN3
117  ((CLocalityPreservingProjections*)m_converter)->set_tau(width);
118 #else
119  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
120 #endif
121  return true;
122 }
123 
125 {
126 #ifdef HAVE_EIGEN3
127  m_converter = new CDiffusionMaps();
128  ((CDiffusionMaps*)m_converter)->set_t(t);
129  ((CDiffusionMaps*)m_converter)->set_kernel(new CGaussianKernel(100,width));
130 #else
131  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
132 #endif
133  return true;
134 }
135 
137 {
138 #ifdef HAVE_EIGEN3
139  m_converter = new CIsomap();
140  ((CIsomap*)m_converter)->set_k(k);
141 #else
142  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
143 #endif
144  return true;
145 }
146 
148 {
149 #ifdef HAVE_EIGEN3
151 #else
152  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
153 #endif
154  return true;
155 }
156 
158 {
159 #ifdef HAVE_EIGEN3
160  m_converter = new CJade();
161 #else
162  SG_ERROR("Requires EIGEN3 to be enabled at compile time\n")
163 #endif
164  return true;
165 }
166 
168 {
169  if (!m_converter)
170  SG_ERROR("No converter created")
171  return (CDenseFeatures<float64_t>*)m_converter->apply(m_ui->ui_features->get_train_features());
172 }
173 
175 {
176  if (!m_converter)
177  SG_ERROR("No converter created")
178  ((CEmbeddingConverter*)m_converter)->set_target_dim(target_dim);
179  return ((CEmbeddingConverter*)m_converter)->embed(m_ui->ui_features->get_train_features());
180 }
181 

SHOGUN Machine Learning Toolbox - Documentation