pca.hpp
Go to the documentation of this file.00001
00023 #ifndef __MLPACK_METHODS_PCA_PCA_HPP
00024 #define __MLPACK_METHODS_PCA_PCA_HPP
00025
00026 #include <mlpack/core.hpp>
00027
00028 namespace mlpack {
00029 namespace pca {
00030
00038 class PCA
00039 {
00040 public:
00047 PCA(const bool scaleData = false);
00048
00058 void Apply(const arma::mat& data,
00059 arma::mat& transformedData,
00060 arma::vec& eigval,
00061 arma::mat& eigvec) const;
00062
00071 void Apply(const arma::mat& data,
00072 arma::mat& transformedData,
00073 arma::vec& eigVal) const;
00074
00086 double Apply(arma::mat& data, const size_t newDimension) const;
00087
00089 inline double Apply(arma::mat& data, const int newDimension) const
00090 {
00091 return Apply(data, size_t(newDimension));
00092 }
00093
00109 double Apply(arma::mat& data, const double varRetained) const;
00110
00113 bool ScaleData() const { return scaleData; }
00116 bool& ScaleData() { return scaleData; }
00117
00118 private:
00121 bool scaleData;
00122
00123 };
00124
00125 };
00126 };
00127
00128 #endif