MLPACK
1.0.4
|
00001 00023 #ifndef __MLPACK_METHODS_KERNEL_PCA_KERNEL_PCA_HPP 00024 #define __MLPACK_METHODS_KERNEL_PCA_KERNEL_PCA_HPP 00025 00026 #include <mlpack/core.hpp> 00027 #include <mlpack/core/kernels/linear_kernel.hpp> 00028 00029 namespace mlpack { 00030 namespace kpca { 00031 00032 template <typename KernelType> 00033 class KernelPCA 00034 { 00035 public: 00036 KernelPCA(const KernelType kernel = KernelType(), 00037 const bool scaleData = false); 00038 00047 void Apply(const arma::mat& data, 00048 arma::mat& transformedData, 00049 arma::vec& eigVal, 00050 arma::mat& coeff); 00051 00059 void Apply(const arma::mat& data, 00060 arma::mat& transformedData, 00061 arma::vec& eigVal); 00062 00073 void Apply(arma::mat& data, const size_t newDimension); 00074 00076 const KernelType& Kernel() const { return kernel; } 00078 KernelType& Kernel() { return kernel; } 00079 00082 bool ScaleData() const { return scaleData; } 00085 bool& ScaleData() { return scaleData; } 00086 00087 private: 00089 KernelType kernel; 00092 bool scaleData; 00093 00094 }; // class KernelPCA 00095 00096 }; // namespace kpca 00097 }; // namespace mlpack 00098 00099 // Include implementation. 00100 #include "kernel_pca_impl.hpp" 00101 00102 #endif // __MLPACK_METHODS_KERNEL_PCA_KERNEL_PCA_HPP