bpp-core3  3.0.0
PrincipalComponentAnalysis.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_STAT_MVA_PRINCIPALCOMPONENTANALYSIS_H
6 #define BPP_NUMERIC_STAT_MVA_PRINCIPALCOMPONENTANALYSIS_H
7 
8 
9 #include "../../Matrix/Matrix.h"
10 #include "DualityDiagram.h"
11 
12 namespace bpp
13 {
23  public DualityDiagram
24 {
25 private:
26  std::vector<double> columnMeans_;
27  std::vector<double> columnSd_;
28 
29 public:
44  const Matrix<double>& data,
45  unsigned int nbAxes,
46  const std::vector<double>& rowW,
47  const std::vector<double>& colW,
48  bool centered = true,
49  bool scaled = true,
50  double tol = 0.0000001,
51  bool verbose = true);
52 
65  const Matrix<double>& data,
66  unsigned int nbAxes,
67  bool centered = true,
68  bool scaled = true,
69  double tol = 0.0000001,
70  bool verbose = true);
71 
73 
75 
76 public:
83  static void center(Matrix<double>& matrix, const std::vector<double>& rowW);
84 
91  static void scale(Matrix<double>& matrix, const std::vector<double>& rowW);
92 
93 public:
94  const std::vector<double>& getColumnMeans() const { return columnMeans_; }
95  const std::vector<double>& getColumnSd() const { return columnSd_; }
96 };
97 } // end of namespace bpp.
98 #endif // BPP_NUMERIC_STAT_MVA_PRINCIPALCOMPONENTANALYSIS_H
The matrix template interface.
Definition: Matrix.h:22
PrincipalComponentAnalysis(const Matrix< double > &data, unsigned int nbAxes, const std::vector< double > &rowW, const std::vector< double > &colW, bool centered=true, bool scaled=true, double tol=0.0000001, bool verbose=true)
Build a new PrincipalComponentAnalysis object.
static void scale(Matrix< double > &matrix, const std::vector< double > &rowW)
This function allows to center an input matrix from its column means.
const std::vector< double > & getColumnSd() const
static void center(Matrix< double > &matrix, const std::vector< double > &rowW)
This function allows to center an input matrix from its column means.
const std::vector< double > & getColumnMeans() const
PrincipalComponentAnalysis * clone() const
Create a copy of this object and send a pointer to it.
This class allows to perform a principal component analysis.
The core class of a multivariate analysis.