Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added C++ tests for LLE basic algorithms
- Loading branch information
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
examples/undocumented/libshogun/preprocessor_hessianlocallylinearembedding.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 <shogun/base/init.h> | ||
#include <shogun/features/SimpleFeatures.h> | ||
#include <shogun/preprocessor/DimensionReductionPreprocessor.h> | ||
#include <shogun/preprocessor/HessianLocallyLinearEmbedding.h> | ||
|
||
using namespace shogun; | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
init_shogun(); | ||
|
||
int N = 100; | ||
int dim = 3; | ||
float64_t* matrix = new double[N*dim]; | ||
for (int i=0; i<N*dim; i++) | ||
matrix[i] = i; | ||
|
||
CSimpleFeatures<double>* features = new CSimpleFeatures<double>(SGMatrix<double>(matrix,dim,N)); | ||
SG_REF(features); | ||
CHessianLocallyLinearEmbedding* hlle = new CHessianLocallyLinearEmbedding(); | ||
hlle->set_target_dim(2); | ||
hlle->set_k(8); | ||
hlle->apply_to_feature_matrix(features); | ||
hlle->parallel->set_num_threads(4); | ||
SG_UNREF(hlle); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |
39 changes: 39 additions & 0 deletions
39
examples/undocumented/libshogun/preprocessor_locallylinearembedding.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 <shogun/base/init.h> | ||
#include <shogun/features/SimpleFeatures.h> | ||
#include <shogun/preprocessor/DimensionReductionPreprocessor.h> | ||
#include <shogun/preprocessor/LocallyLinearEmbedding.h> | ||
|
||
using namespace shogun; | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
init_shogun(); | ||
|
||
int N = 100; | ||
int dim = 3; | ||
float64_t* matrix = new double[N*dim]; | ||
for (int i=0; i<N*dim; i++) | ||
matrix[i] = i; | ||
|
||
CSimpleFeatures<double>* features = new CSimpleFeatures<double>(SGMatrix<double>(matrix,dim,N)); | ||
SG_REF(features); | ||
CLocallyLinearEmbedding* lle = new CLocallyLinearEmbedding(); | ||
lle->set_target_dim(2); | ||
lle->set_k(4); | ||
lle->apply_to_feature_matrix(features); | ||
lle->parallel->set_num_threads(4); | ||
SG_UNREF(lle); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |
39 changes: 39 additions & 0 deletions
39
examples/undocumented/libshogun/preprocessor_localtangentspacealignment.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 <shogun/base/init.h> | ||
#include <shogun/features/SimpleFeatures.h> | ||
#include <shogun/preprocessor/DimensionReductionPreprocessor.h> | ||
#include <shogun/preprocessor/LocalTangentSpaceAlignment.h> | ||
|
||
using namespace shogun; | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
init_shogun(); | ||
|
||
int N = 100; | ||
int dim = 3; | ||
float64_t* matrix = new double[N*dim]; | ||
for (int i=0; i<N*dim; i++) | ||
matrix[i] = i; | ||
|
||
CSimpleFeatures<double>* features = new CSimpleFeatures<double>(SGMatrix<double>(matrix,dim,N)); | ||
SG_REF(features); | ||
CLocalTangentSpaceAlignment* ltsa = new CLocalTangentSpaceAlignment(); | ||
ltsa->set_target_dim(2); | ||
ltsa->set_k(4); | ||
ltsa->apply_to_feature_matrix(features); | ||
ltsa->parallel->set_num_threads(4); | ||
SG_UNREF(ltsa); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |