Computational Physics, Python, Linear Algebra, Svd, Code.
penalty(pW).mean() + penalty(pH).mean() def loss(): return (M-pW.mm(pH)).norm(2) + penalize()*lam M = Variable(t_vectors) opt = torch.optim.Adam([pW,pH], lr=1e-3, betas=(0.9,0.9)) lr = 0.05 #report() for i in range(1000): opt.zero_grad() l = loss() l.backward() opt.step() if i % 100 == 99: report()