SHOGUN
v3.2.0
|
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 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 00011 #include <shogun/converter/LocalityPreservingProjections.h> 00012 #ifdef HAVE_EIGEN3 00013 #include <shogun/io/SGIO.h> 00014 #include <shogun/kernel/LinearKernel.h> 00015 #include <shogun/lib/tapkee/tapkee_shogun.hpp> 00016 00017 using namespace shogun; 00018 00019 CLocalityPreservingProjections::CLocalityPreservingProjections() : 00020 CLaplacianEigenmaps() 00021 { 00022 } 00023 00024 CLocalityPreservingProjections::~CLocalityPreservingProjections() 00025 { 00026 } 00027 00028 const char* CLocalityPreservingProjections::get_name() const 00029 { 00030 return "LocalityPreservingProjections"; 00031 }; 00032 00033 CFeatures* CLocalityPreservingProjections::apply(CFeatures* features) 00034 { 00035 TAPKEE_PARAMETERS_FOR_SHOGUN parameters; 00036 m_distance->init(features,features); 00037 parameters.n_neighbors = m_k; 00038 parameters.gaussian_kernel_width = m_tau; 00039 parameters.method = SHOGUN_LOCALITY_PRESERVING_PROJECTIONS; 00040 parameters.target_dimension = m_target_dim; 00041 parameters.distance = m_distance; 00042 parameters.features = (CDotFeatures*)features; 00043 CDenseFeatures<float64_t>* embedding = tapkee_embed(parameters); 00044 return embedding; 00045 } 00046 00047 #endif /* HAVE_EIGEN3 */