2023-01-24 18:57:18 +01:00
|
|
|
|
|
|
|
#ifndef MLPP_PCA_H
|
|
|
|
#define MLPP_PCA_H
|
|
|
|
|
2023-01-23 21:13:26 +01:00
|
|
|
//
|
|
|
|
// PCA.hpp
|
|
|
|
//
|
|
|
|
// Created by Marc Melikyan on 10/2/20.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2023-01-24 19:20:18 +01:00
|
|
|
|
2023-01-24 19:00:54 +01:00
|
|
|
class PCA {
|
|
|
|
public:
|
|
|
|
PCA(std::vector<std::vector<double>> inputSet, int k);
|
|
|
|
std::vector<std::vector<double>> principalComponents();
|
|
|
|
double score();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<std::vector<double>> inputSet;
|
|
|
|
std::vector<std::vector<double>> X_normalized;
|
|
|
|
std::vector<std::vector<double>> U_reduce;
|
|
|
|
std::vector<std::vector<double>> Z;
|
|
|
|
int k;
|
|
|
|
};
|
2023-01-24 19:20:18 +01:00
|
|
|
|
2023-01-23 21:13:26 +01:00
|
|
|
|
|
|
|
#endif /* PCA_hpp */
|