<commit_before>/**
 * @file pca.hpp
 * @author <NAME>
 *
 * Defines the PCA class to perform Principal Components Analysis on the
 * specified data set.
 */
#ifndef __MLPACK_METHODS_PCA_PCA_HPP
#define __MLPACK_METHODS_PCA_PCA_HPP

#include <mlpack/core.hpp>

namespace mlpack {
namespace pca {

class PCA
{
 public:
  PCA();

  /**
   * Apply Principal Component Analysis to the provided data set.
   *
   * @param data - Data matrix
   * @param transformedData - Data with PCA applied
   * @param eigVal - contains eigen values in a column vector
   * @param coeff - PCA Loadings/Coeffs/EigenVectors
   */
  void Apply(const arma::mat& data, arma::mat& transformedData, arma::vec&
             eigVal, arma::mat& coeff);

  /**
   * Apply Principal Component Analysis to the provided data set.
   *
   * @param data - Data matrix
   * @param transformedData - Data with PCA applied
   * @param eigVal - contains eigen values in a column vector
   */
  void Apply(const arma::mat& data, arma::mat& transformedData,
             arma::vec& eigVal);

  /**
   * Apply Dimensionality Reduction using Principal Component Analysis
   * to the provided data set.
   *
   * @param data - M x N Data matrix
   * @param newDimension - matrix consisting of N column vectors,
   * where each vector is the projection of the corresponding data vector
   * from data matrix onto the basis vectors contained in the columns of
   * coeff/eigen vector matrix with only newDimension number of columns chosen.
   */
  void Apply(arma::mat& data, const int newDimension);

  /**
   * Delete PCA object
   */
  ~PCA();

}; // class PCA

}; // namespace pca
}; // namespace mlpack

#endif<commit_msg>changed the api to accomodate centering and scaling of initial dataset.<commit_after>/**
 * @file pca.hpp
 * @author <NAME>
 *
 * Defines the PCA class to perform Principal Components Analysis on the
 * specified data set.
 */
#ifndef __MLPACK_METHODS_PCA_PCA_HPP
#define __MLPACK_METHODS_PCA_PCA_HPP

#include <mlpack/core.hpp>

namespace mlpack {
namespace pca {

class PCA
{
 public:
  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.
   *
   * @param data - Data matrix
   * @param transformedData - Data with PCA applied
   * @param eigVal - contains eigen values in a column vector
   * @param coeff - PCA Loadings/Coeffs/EigenVectors
   */
  void Apply(const arma::mat& data, arma::mat& transformedData, arma::vec&
             eigVal, arma::mat& coeff);

  /**
   * Apply Principal Component Analysis to the provided data set.
   *
   * @param data - Data matrix
   * @param transformedData - Data with PCA applied
   * @param eigVal - contains eigen values in a column vector
   */
  void Apply(const arma::mat& data, arma::mat& transformedData,
             arma::vec& eigVal);

  /**
   * Apply Dimensionality Reduction using Principal Component Analysis
   * to the provided data set.
   *
   * @param data - M x N Data matrix
   * @param newDimension - matrix consisting of N column vectors,
   * where each vector is the projection of the corresponding data vector
   * from data matrix onto the basis vectors contained in the columns of
   * coeff/eigen vector matrix with only newDimension number of columns chosen.
   */
  void Apply(arma::mat& data, const int newDimension);

  /**
   * Delete PCA object
   */
  ~PCA();

 private:
   bool centerData_;
   bool scaleData_;

}; // class PCA

}; // namespace pca
}; // namespace mlpack

#endif
{'fraction_non_alphanumeric': 0.08761040821198376, 'fraction_numerical': 0.0, 'mean_word_length': 3.021113243761996, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3688874', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1224, 'n_words': 479}