SHOGUN  v2.0.0
 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 
30 
31 using namespace shogun;
32 
34 : CSGObject(), m_ui(ui)
35 {
36  m_converter = NULL;
37 }
38 
40 {
42 }
43 
45 {
46 #ifdef HAVE_LAPACK
49 #else
50  SG_ERROR("Requires Lapack to be enabled at compile time\n");
51 #endif
52  return true;
53 }
54 
56 {
57 #ifdef HAVE_LAPACK
60 #else
61  SG_ERROR("Requires Lapack to be enabled at compile time\n");
62 #endif
63  return true;
64 }
65 
67 {
68 #ifdef HAVE_LAPACK
71 #else
72  SG_ERROR("Requires Lapack to be enabled at compile time\n");
73 #endif
74  return true;
75 }
76 
78 {
79 #ifdef HAVE_LAPACK
82 #else
83  SG_ERROR("Requires Lapack to be enabled at compile time\n");
84 #endif
85  return true;
86 }
87 
89 {
90 #ifdef HAVE_LAPACK
93 #else
94  SG_ERROR("Requires Lapack to be enabled at compile time\n");
95 #endif
96  return true;
97 }
98 
100 {
101 #ifdef HAVE_LAPACK
103  ((CLaplacianEigenmaps*)m_converter)->set_k(k);
104  ((CLaplacianEigenmaps*)m_converter)->set_tau(width);
105 #else
106  SG_ERROR("Requires Lapack to be enabled at compile time\n");
107 #endif
108  return true;
109 }
110 
112 {
113 #ifdef HAVE_LAPACK
116  ((CLocalityPreservingProjections*)m_converter)->set_tau(width);
117 #else
118  SG_ERROR("Requires Lapack to be enabled at compile time\n");
119 #endif
120  return true;
121 }
122 
124 {
125 #ifdef HAVE_LAPACK
126  m_converter = new CDiffusionMaps();
127  ((CDiffusionMaps*)m_converter)->set_t(t);
128  ((CDiffusionMaps*)m_converter)->set_kernel(new CGaussianKernel(100,width));
129 #else
130  SG_ERROR("Requires Lapack to be enabled at compile time\n");
131 #endif
132  return true;
133 }
134 
136 {
137 #ifdef HAVE_LAPACK
138  m_converter = new CIsomap();
139  ((CIsomap*)m_converter)->set_k(k);
140 #else
141  SG_ERROR("Requires Lapack to be enabled at compile time\n");
142 #endif
143  return true;
144 }
145 
147 {
148 #ifdef HAVE_LAPACK
150 #else
151  SG_ERROR("Requires Lapack to be enabled at compile time\n");
152 #endif
153  return true;
154 }
155 
157 {
158  if (!m_converter)
159  SG_ERROR("No converter created");
160  ((CEmbeddingConverter*)m_converter)->set_target_dim(target_dim);
161  return ((CEmbeddingConverter*)m_converter)->embed(m_ui->ui_features->get_train_features());
162 }
163 

SHOGUN Machine Learning Toolbox - Documentation