Skip to content

Instantly share code, notes, and snippets.

View theWrongCode-dev's full-sized avatar
☠️
Algorithm lover💓

Adarsh Raj theWrongCode-dev

☠️
Algorithm lover💓
  • theWrongCode
View GitHub Profile
@theWrongCode-dev
theWrongCode-dev / pca.py
Created February 5, 2020 15:45
PCA Implemented using Python 3
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.