MLPACK  1.0.7
kernel_pca.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_KERNEL_PCA_KERNEL_PCA_HPP
24 #define __MLPACK_METHODS_KERNEL_PCA_KERNEL_PCA_HPP
25 
26 #include <mlpack/core.hpp>
28 
29 namespace mlpack {
30 namespace kpca {
31 
45 template <typename KernelType>
46 class KernelPCA
47 {
48  public:
57  KernelPCA(const KernelType kernel = KernelType(),
58  const bool centerTransformedData = false);
59 
68  void Apply(const arma::mat& data,
69  arma::mat& transformedData,
70  arma::vec& eigval,
71  arma::mat& eigvec);
72 
80  void Apply(const arma::mat& data,
81  arma::mat& transformedData,
82  arma::vec& eigval);
83 
97  void Apply(arma::mat& data, const size_t newDimension);
98 
100  const KernelType& Kernel() const { return kernel; }
102  KernelType& Kernel() { return kernel; }
103 
108 
109  private:
111  KernelType kernel;
115 
122  void GetKernelMatrix(const arma::mat& data, arma::mat& kernelMatrix);
123 
124 }; // class KernelPCA
125 
126 }; // namespace kpca
127 }; // namespace mlpack
128 
129 // Include implementation.
130 #include "kernel_pca_impl.hpp"
131 
132 #endif // __MLPACK_METHODS_KERNEL_PCA_KERNEL_PCA_HPP