This repository contains the course project for the R language class during the Spring 2024 semester at Southern Medical University.
The project focuses on implementing two fast algorithms for dynamic PCA (Principal Component Analysis) updates: recursive and stochastic gradient methods. The codebase also includes auxiliary functions designed to update the sample mean and covariance.
- Recursive PCA Update Algorithm: Efficiently updates principal components as new data arrives, using a recursive methodology.
- Stochastic Gradient PCA Update Algorithm: Implements a more randomized approach to updating principal components, which can be advantageous in large-scale applications.
- Performance Evaluation of Recursive PCA: The accuracy (RMSE & RSE) and timing (User & Elapsed) of the Recursive PCA have been thoroughly tested. Comparative visualizations using ggplot2 illustrate the differences and potential advantages over the traditional PCA approach using the Eigen method.
- Utility Functions: Functions to update the sample mean and sample covariance, essential for maintaining accurate PCA in dynamic environments. Includes a Timer implemented using closures to efficiently track and manage the performance and timing of updates, ensuring minimal overhead and maximal efficiency.
- Convergence Issue in
secular_pca
Solver: We have identified that thesecular_pca
solver does not always converge within a finite number of iterations under certain conditions. This issue is currently under investigation, and further research and debugging are needed to resolve this problem.
- Enhance Solver Stability: Investigate and enhance the stability and reliability of the
secular_pca
solver. - Optimize Performance: Continuous optimization of the algorithms to handle larger datasets more efficiently.
- Expand Documentation: Improve documentation to provide clear usage instructions and examples.
This project is licensed under the MIT License - see the LICENSE.md file for details.
This repository is an academic project and is part of the ongoing learning and research in dynamic PCA methods at Southern Medical University. Contributions that help improve the functionality and accuracy of these PCA update algorithms are highly appreciated.