[mlpack-svn] r10581 - mlpack/trunk/src/mlpack/methods/pca

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Dec 6 04:50:48 EST 2011


Author: ajinkya
Date: 2011-12-06 04:50:48 -0500 (Tue, 06 Dec 2011)
New Revision: 10581

Modified:
   mlpack/trunk/src/mlpack/methods/pca/pca.hpp
Log:
changed the api to accomodate centering and scaling of initial dataset.

Modified: mlpack/trunk/src/mlpack/methods/pca/pca.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/pca/pca.hpp	2011-12-06 09:50:30 UTC (rev 10580)
+++ mlpack/trunk/src/mlpack/methods/pca/pca.hpp	2011-12-06 09:50:48 UTC (rev 10581)
@@ -16,8 +16,40 @@
 class PCA
 {
  public:
-  PCA();
+  PCA(const bool centerData = false, const bool scaleData = false);
 
+  /* Return whether or not this PCA object will center the data when PCA
+   *  is performed.
+   */
+  bool CenterData() const
+  {
+    return centerData_;
+  }
+
+  /* Modify whether or not this PCA object will center the data when PCA
+   * is performed.
+   */
+  bool& CenterData()
+  {
+    return centerData_;
+  }
+
+  /* Return whether or not this PCA object will scale(by standard deviation) the data when PCA
+   *  is performed.
+   */
+  bool ScaleData() const
+  {
+    return scaleData_;
+  }
+
+  /* Modify whether or not this PCA object will scale(by standard deviation) the data when PCA
+   * is performed.
+   */
+  bool& ScaleData()
+  {
+    return scaleData_;
+  }
+
   /**
    * Apply Principal Component Analysis to the provided data set.
    *
@@ -56,6 +88,10 @@
    */
   ~PCA();
 
+ private:
+   bool centerData_;
+   bool scaleData_;
+
 }; // class PCA
 
 }; // namespace pca




More information about the mlpack-svn mailing list