def calcMU(self,k): uk_temp=svdt(n_components=k); u=np.asarray(sv.fit_transform(self.X)); bot=np.sum(u**2,asix=0); bot=[math.sqrt(i) for i in bot] self.Uk=uk_temp/bot; MU_temp=self.X-np.dot(self.Uk,np.dot((self.Uk).T,self.X)); self.MU=MU_temp.T; sd=np.sum(self.MU**2,axis=1); sd=[math.sqrt(s) for s in sd]; self.MU=self.MU/np.asarray(sd)[:,np.newaxis];
def calcMU(self, k, exact=False): self.k = k if not exact: uk_temp = svdt(n_components=k) u = np.asarray(uk_temp.fit_transform(self.X)) else: u = self.exactSVD() bot = np.sum(u**2, axis=0) bot = [math.sqrt(i) for i in bot] self.Uk = u / bot MU_temp = self.X - np.dot(self.Uk, np.dot((self.Uk).T, self.X)) self.MU = MU_temp.T sd = np.sum(self.MU**2, axis=1) sd = [math.sqrt(s) for s in sd] self.MU = self.MU / np.asarray(sd)[:, np.newaxis]
def calcMU(self,k,exact=False): self.k=k if not exact: uk_temp=svdt(n_components=k); u=np.asarray(uk_temp.fit_transform(self.X)); else: u=self.exactSVD(); bot=np.sum(u**2,axis=0); bot=[math.sqrt(i) for i in bot] self.Uk=u/bot; MU_temp=self.X-np.dot(self.Uk,np.dot((self.Uk).T,self.X)); self.MU=MU_temp.T; sd=np.sum(self.MU**2,axis=1); sd=[math.sqrt(s) for s in sd]; self.MU=self.MU/np.asarray(sd)[:,np.newaxis];