# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np
import sys
sys.path.append('../utils')
import gennoisy
from pca import pca
import matplotlib.pylab as plt
# %matplotlib inline

X,S,A,N = gennoisy.gennoisy()
plt.plot(X)
plt.title('Mixed Signals (3 channels)')
plt.figure()
plt.plot(S)
plt.title('Original Signals')

evals,evecs,m = pca(X,0)
rX = (X-m).dot(evecs.T).dot( np.linalg.inv(evecs.dot(evecs.T)))
plt.plot(rX)
plt.title('Rotated mixed')

evecs.T.dot(evecs) / len(evecs)

StarcoderdataJupyterScriptsDedupFiltered