/
converter_localitypreservingprojections.cpp
49 lines (43 loc) · 1.26 KB
/
converter_localitypreservingprojections.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2011 Sergey Lisitsyn
* Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
*/
#include <lib/config.h>
#ifdef SHOGUN_HAVE_EIGEN3
#include <base/init.h>
#include <features/DenseFeatures.h>
#include <converter/LocalityPreservingProjections.h>
#include <mathematics/Math.h>
using namespace shogun;
int main(int argc, char** argv)
{
init_shogun_with_defaults();
int N = 100;
int dim = 3;
float64_t* matrix = new double[N*dim];
for (int i=0; i<N*dim; i++)
matrix[i] = CMath::sin((i/float64_t(N*dim))*3.14);
CDenseFeatures<double>* features = new CDenseFeatures<double>(SGMatrix<double>(matrix,dim,N));
SG_REF(features);
CLocalityPreservingProjections* lpp = new CLocalityPreservingProjections();
lpp->set_target_dim(2);
lpp->set_k(10);
lpp->parallel->set_num_threads(4);
CDenseFeatures<double>* embedding = lpp->embed(features);
SG_UNREF(embedding);
SG_UNREF(lpp);
SG_UNREF(features);
exit_shogun();
return 0;
}
#else
int main(int argc, char **argv)
{
return 0;
}
#endif