def viz_rank(Oi,k=None): if k is None: U, s, VT = np.linalg.svd(Oi) else: U, s, VT = thin_svd_randomized(Oi,k) plt.figure() plt.stem(np.arange(s.shape[0]),s)
def viz_rank2(y,i,k=None): Y = AR_striding(y,i-1).T l = Y.shape[0]//2 if k is None: _, s, _ = np.linalg.svd(np.cov(Y)[:l,l:]) else: _, s, _ = thin_svd_randomized(np.cov(Y)[:l,l:],k) plt.figure() plt.stem(np.arange(s.shape[0]),s)
def compute_gammas(Oi,nhat,p): U,s,VT = thin_svd_randomized(Oi,nhat) Gamma_i = U.dot(np.diag(np.sqrt(s))) Gamma_im1 = Gamma_i[:-p] return Gamma_i, Gamma_im1