SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
NeighborhoodPreservingEmbedding.cpp
Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2011-2013 Sergey Lisitsyn
00008  * Copyright (C) 2011-2013 Sergey Lisitsyn
00009  */
00010 
00011 #include <shogun/converter/NeighborhoodPreservingEmbedding.h>
00012 #include <shogun/lib/config.h>
00013 #ifdef HAVE_EIGEN3
00014 #include <shogun/io/SGIO.h>
00015 #include <shogun/kernel/LinearKernel.h>
00016 #include <shogun/lib/tapkee/tapkee_shogun.hpp>
00017 
00018 using namespace shogun;
00019 
00020 CNeighborhoodPreservingEmbedding::CNeighborhoodPreservingEmbedding() :
00021         CLocallyLinearEmbedding()
00022 {
00023 }
00024 
00025 CNeighborhoodPreservingEmbedding::~CNeighborhoodPreservingEmbedding()
00026 {
00027 }
00028 
00029 const char* CNeighborhoodPreservingEmbedding::get_name() const
00030 {
00031     return "NeighborhoodPreservingEmbedding";
00032 }
00033 
00034 CFeatures* CNeighborhoodPreservingEmbedding::apply(CFeatures* features)
00035 {
00036     CKernel* kernel = new CLinearKernel((CDotFeatures*)features,(CDotFeatures*)features);
00037     TAPKEE_PARAMETERS_FOR_SHOGUN parameters;
00038     parameters.n_neighbors = m_k;
00039     parameters.eigenshift = m_nullspace_shift;
00040     parameters.method = SHOGUN_NEIGHBORHOOD_PRESERVING_EMBEDDING;
00041     parameters.target_dimension = m_target_dim;
00042     parameters.kernel = kernel;
00043     parameters.features = (CDotFeatures*)features;
00044     CDenseFeatures<float64_t>* embedding = tapkee_embed(parameters);
00045     SG_UNREF(kernel);
00046     return embedding;
00047 }
00048 
00049 #endif /* HAVE_EIGEN3 */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation