Skip to content

Instantly share code, notes, and snippets.

@bistaumanga
bistaumanga / pca.py
Last active May 14, 2021 08:32
Principal component analysis in python.
import numpy as np
import pylab as plt
'''
Performs the Principal Coponent analysis of the Matrix X
Matrix must be n * m dimensions
where n is # features
m is # examples
'''
def PCA(X, varRetained = 0.95, show = False):