This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
class PCA: | |
def __init__(self,n_component=None): | |
"""Principal component analysis (PCA) implementation. | |
Transforms a dataset of possibly correlated values into n linearly | |
uncorrelated components. The components are ordered such that the first | |
has the largest possible variance and each following component as the | |
largest possible variance given the previous components. This causes | |
the early components to contain most of the variability in the dataset. |