Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finally added missing libshogun tests for DR preprocessors (no leaks)
- Loading branch information
Showing
10 changed files
with
163 additions
and
9 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
38 changes: 38 additions & 0 deletions
38
examples/undocumented/libshogun/preprocessor_diffusionmaps.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,38 @@ | ||
/* | ||
* 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/DiffusionMaps.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); | ||
CDiffusionMaps* dmaps = new CDiffusionMaps(); | ||
dmaps->set_target_dim(2); | ||
dmaps->set_t(10); | ||
dmaps->parallel->set_num_threads(4); | ||
dmaps->apply_to_feature_matrix(features); | ||
SG_UNREF(dmaps); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |
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
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,40 @@ | ||
/* | ||
* 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/Isomap.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); | ||
CIsomap* isomap = new CIsomap(); | ||
isomap->set_target_dim(2); | ||
isomap->set_landmark(true); | ||
isomap->set_k(4); | ||
isomap->parallel->set_num_threads(4); | ||
isomap->apply_to_feature_matrix(features); | ||
SG_UNREF(isomap); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |
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
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
38 changes: 38 additions & 0 deletions
38
examples/undocumented/libshogun/preprocessor_laplacianeigenmaps.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,38 @@ | ||
/* | ||
* 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/LaplacianEigenmaps.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); | ||
CLaplacianEigenmaps* lem = new CLaplacianEigenmaps(); | ||
lem->set_target_dim(2); | ||
lem->set_k(10); | ||
lem->parallel->set_num_threads(4); | ||
lem->apply_to_feature_matrix(features); | ||
SG_UNREF(lem); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |
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
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_multidimensionalscaling.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/MultidimensionalScaling.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); | ||
CMultidimensionalScaling* mds = new CMultidimensionalScaling(); | ||
mds->set_target_dim(2); | ||
mds->set_landmark(true); | ||
mds->parallel->set_num_threads(4); | ||
mds->apply_to_feature_matrix(features); | ||
SG_UNREF(mds); | ||
SG_UNREF(features); | ||
exit_shogun(); | ||
return 0; | ||
} |