function [W,A] = SVDstoch_icamp(X,K) % [W,A] = SVDstoch_icamp(X,K) % Code to perform stochastic matrix decomposition. % W and A are learned to approximate the non-zero entries in X. % non-zero entries are picked randomly and gradient updates on A and W are % performend. % Input: X (matrix to be approximated), K (nr. of dimensions to project % down to) % Output: W and A such that X ~ W*A. % In doing so, the zeros entries will be fileld in as well which produces % predictions. [Nattr,Ndata] = size(X); showit = 1000; T = 100000; ErrR = zeros(1,T); Mask = (X~=0); Nv = sum(Mask(:)); alpha = 0; beta = 0; eta_W = 0.01; eta_A = 0.01; fac = 0.5; W = 0.1*randn(Nattr,K); A = 0.1*randn(K,Ndata); ddW = zeros(Nattr,K); ddA = zeros(K,Ndata); t=0; t_plot=0; while t