def lensNMF(data, k, ks=<NUM_LIT:1>):
<EOL>n_rounds = k/ks<EOL>R_i = data.copy()<EOL>nmf = NMF(ks)<EOL>nmf2 = NMF(ks, init='<STR_LIT>')<EOL>w_is = []<EOL>h_is = []<EOL>rs = []<EOL>w_i = np.zeros((data.shape[<NUM_LIT:0>], ks))<EOL>h_i = np.zeros((ks, data.shape[<NUM_LIT:1>]))<EOL>for i in range(n_rounds):<EOL><INDENT>R_i = R_i - w_i.dot(h_i)<EOL>R_i[R_i < <NUM_LIT:0>] = <NUM_LIT:0><EOL>"""<STR_LIT>"""<EOL>w_i = nmf.fit_transform(R_i)<EOL>h_i = nmf.components_<EOL>w_is.append(w_i)<EOL>h_is.append(h_i)<EOL>rs.append(R_i)<EOL><DEDENT>return np.hstack(w_is), np.vstack(h_is), rs<EOL>
Runs L-EnsNMF on the data. (Suh et al. 2016)