KernelPCA class is the main class that implements several spectral methods that are variances of Kernel PCA Most of them share an affinity (proximity) )matrix that is computed with the dual-tree all nearest algorithm. More...
Classes | |
class | GaussianKernel |
Example of a kernel. More... | |
Public Member Functions | |
template<typename DISTANCEKERNEL > | |
void | ComputeDiffusionMaps (DISTANCEKERNEL kernel, index_t num_of_eigenvalues) |
Not implemented yet. | |
template<typename DISTANCEKERNEL > | |
void | ComputeGeneralKernelPCA (DISTANCEKERNEL kernel, index_t num_of_eigenvalues, Matrix *eigen_vectors, Vector *eigen_values) |
After computing the neighboroods and loading the affinity matrix call this function to compute the num_of_eigenvalues first components of kernel pca. | |
void | ComputeIsomap (index_t num_of_eigenvalues) |
Not implemented yet. | |
void | ComputeLaplacialnEigenmaps (index_t) |
Not implemented yet. | |
void | ComputeLLE (index_t num_of_eigenvalues, Matrix *eigen_vectors, Vector *eigen_values) |
Local Linear Embedding. | |
void | ComputeNeighborhoods () |
Generates the neighborhoods with the dual tree all nearest neighbors algorithm and stores them to a file allnn.txt. | |
template<typename DISTANCEKERNEL > | |
void | ComputeSpectralRegression (DISTANCEKERNEL kernel, std::map< index_t, index_t > &data_label, Matrix *embedded_coordinates, Vector *eigenvalues) |
Spectral Regression std::map<index_t, index_t> &data_label: For some data points it assign numerical labels. | |
void | Destruct () |
void | EstimateBandwidth (double *bandwidth) |
Estimates the local bandwidth by taking tha average k-nearest neighbor distance. | |
void | Init (std::string data_file, index_t knns, index_t leaf_size) |
Initializer data_file: contains the data in a csv file knns: the number of the k-neighborhood for the affinity(proximity) matrix leaf_size: maximun number of points on a leaf. | |
void | LoadAffinityMatrix () |
Loads the results to the sparse affinity matrix. | |
Static Public Member Functions | |
static void | SaveToBinaryFile (std::string file, Matrix &eigen_vectors, Vector &eigen_values) |
static void | SaveToTextFile (std::string file, Matrix &eigen_vectors, Vector &eigen_values) |
A simple way to save the results to a file. | |
Friends | |
class | KernelPCATest |
KernelPCA class is the main class that implements several spectral methods that are variances of Kernel PCA Most of them share an affinity (proximity) )matrix that is computed with the dual-tree all nearest algorithm.
All these methods share this affinity matrix and then define their own kernel matrix based on that. Only distance kernels are supported, kernels that are f(distance)
It computes kernel pca as described by Smola in the following paper. {scholkopf1999kpc, title={{Kernel principal component analysis}}, author={Scholkopf, B. and Smola, A. and Muller, K.R.}, journal={Advances in Kernel Methods-Support Vector Learning}, pages={327--352}, year={1999}, publisher={Cambridge MA: MIT Press} } It also computes Local Linear Embedding as described in the paper {roweis2000ndr, title={{Nonlinear Dimensionality Reduction by Locally Linear Embedding}}, author={Roweis, S.T. and Saul, L.K.}, journal={Science}, volume={290}, number={5500}, pages={2323--2326}, year={2000} }
Another spectral method implemented here is spectral regression as described in the paper {cai2007sru, title={{Spectral regression: a unified subspace learning framework for content-based image retrieval}}, author={Cai, D. and He, X. and Han, J.}, journal={Proceedings of the 15th international conference on Multimedia}, pages={403--412}, year={2007}, publisher={ACM Press New York, NY, USA} } In the future it will also support Laplacian Eigenmaps described here: {belkin2003led, title={{Laplacian Eigenmaps for Dimensionality Reduction and Data Representation}}, author={Belkin, M. and Niyogi, P.}, journal={Neural Computation}, volume={15}, number={6}, pages={1373--1396}, year={2003}, publisher={MIT Press} } and Diffusion Maps described here: {lafon:dma, title={{Diffusion Maps and Geodesic Harmonics}}, author={Lafon, S.}, school={Ph. D. Thesis, Yale University, 2004} }
Definition at line 110 of file kernel_pca.h.
void KernelPCA::ComputeDiffusionMaps | ( | DISTANCEKERNEL | kernel, | |
index_t | num_of_eigenvalues | |||
) | [inline] |
Not implemented yet.
void KernelPCA::ComputeGeneralKernelPCA | ( | DISTANCEKERNEL | kernel, | |
index_t | num_of_eigenvalues, | |||
Matrix * | eigen_vectors, | |||
Vector * | eigen_values | |||
) | [inline] |
After computing the neighboroods and loading the affinity matrix call this function to compute the num_of_eigenvalues first components of kernel pca.
void KernelPCA::ComputeIsomap | ( | index_t | num_of_eigenvalues | ) |
Not implemented yet.
void KernelPCA::ComputeLaplacialnEigenmaps | ( | index_t | ) |
Not implemented yet.
void KernelPCA::ComputeLLE | ( | index_t | num_of_eigenvalues, | |
Matrix * | eigen_vectors, | |||
Vector * | eigen_values | |||
) |
Local Linear Embedding.
Note that you have to call first ComputeNeighborhoods and then Load Affinity Matrix
void KernelPCA::ComputeNeighborhoods | ( | ) |
Generates the neighborhoods with the dual tree all nearest neighbors algorithm and stores them to a file allnn.txt.
void KernelPCA::ComputeSpectralRegression | ( | DISTANCEKERNEL | kernel, | |
std::map< index_t, index_t > & | data_label, | |||
Matrix * | embedded_coordinates, | |||
Vector * | eigenvalues | |||
) | [inline] |
Spectral Regression std::map<index_t, index_t> &data_label: For some data points it assign numerical labels.
void KernelPCA::EstimateBandwidth | ( | double * | bandwidth | ) |
Estimates the local bandwidth by taking tha average k-nearest neighbor distance.
void KernelPCA::Init | ( | std::string | data_file, | |
index_t | knns, | |||
index_t | leaf_size | |||
) |
Initializer data_file: contains the data in a csv file knns: the number of the k-neighborhood for the affinity(proximity) matrix leaf_size: maximun number of points on a leaf.
void KernelPCA::LoadAffinityMatrix | ( | ) |
Loads the results to the sparse affinity matrix.
static void KernelPCA::SaveToTextFile | ( | std::string | file, | |
Matrix & | eigen_vectors, | |||
Vector & | eigen_values | |||
) | [static] |
A simple way to save the results to a file.