This is an implementation of cPCA from scratch, along with a simulated example that shows how cPCA could help in cases where PCA fails.
The original paper by Abid et. al. is implemented.
To understand the use cases of cPCA, refer towards the bottom of the notebook CPCA.ipynb
The same notebook also contains a simulated example showing the usefulness of cPCA along with explanations on why PCA failed & cPCA works.
Image Experiments folder demonstrates CPCA implemeted on a real target data formed by superimposition of images.
Find my detailed blog on CPCA with nice visualizations logged using Weights & Biases here: https://wandb.ai/srishti-gureja-wandb/Contrastive%20PCA%20-%20Let's%20Visualize%20Clusters%20in%20our%20Data%20!%20/reports/Contrastive-PCA-Let-s-Visualize-Clusters-in-our-Data---VmlldzoyMTYwMjA5
Note: No plagiarism intended. Project for learning purposes only.