SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LocallyLinearEmbedding.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 
12 #include <shogun/lib/config.h>
15 #include <shogun/io/SGIO.h>
16 #include <shogun/lib/Time.h>
17 #include <shogun/lib/tapkee/tapkee_shogun.hpp>
18 
19 using namespace shogun;
20 
23 {
24  m_k = 10;
25  m_nullspace_shift = -1e-9;
27  init();
28 }
29 
31 {
32  SG_ADD(&m_k, "k", "number of neighbors", MS_AVAILABLE);
33  SG_ADD(&m_nullspace_shift, "nullspace_shift",
34  "nullspace finding regularization shift",MS_NOT_AVAILABLE);
35  SG_ADD(&m_reconstruction_shift, "reconstruction_shift",
36  "shift used to regularize reconstruction step", MS_NOT_AVAILABLE);
37 }
38 
39 
41 {
42 }
43 
45 {
46  ASSERT(k>0)
47  m_k = k;
48 }
49 
51 {
52  return m_k;
53 }
54 
56 {
57  m_nullspace_shift = nullspace_shift;
58 }
59 
61 {
62  return m_nullspace_shift;
63 }
64 
66 {
67  m_reconstruction_shift = reconstruction_shift;
68 }
69 
71 {
73 }
74 
76 {
77  return "LocallyLinearEmbedding";
78 }
79 
81 {
82  // oh my let me dirty cast it
83  CKernel* kernel = new CLinearKernel((CDotFeatures*)features,(CDotFeatures*)features);
84  TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
85  parameters.n_neighbors = m_k;
86  parameters.eigenshift = m_nullspace_shift;
87  parameters.method = SHOGUN_LOCALLY_LINEAR_EMBEDDING;
88  parameters.target_dimension = m_target_dim;
89  parameters.kernel = kernel;
90  CDenseFeatures<float64_t>* embedding = tapkee_embed(parameters);
91  SG_UNREF(kernel);
92  return embedding;
93 }
94 
Computes the standard linear kernel on CDotFeatures.
Definition: LinearKernel.h:35
class EmbeddingConverter (part of the Efficient Dimensionality Reduction Toolkit) used to construct e...
void set_reconstruction_shift(float64_t reconstruction_shift)
virtual const char * get_name() const
Features that support dot products among other operations.
Definition: DotFeatures.h:44
#define ASSERT(x)
Definition: SGIO.h:201
double float64_t
Definition: common.h:50
virtual CFeatures * apply(CFeatures *features)
void set_nullspace_shift(float64_t nullspace_shift)
#define SG_UNREF(x)
Definition: SGObject.h:52
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
The Kernel base class.
Definition: Kernel.h:159
#define SG_ADD(...)
Definition: SGObject.h:81

SHOGUN Machine Learning Toolbox - Documentation