def nmf_ensemble(data, k, n_runs=<NUM_LIT:10>, W_list=[], **nmf_params):
nmf = NMF(k)<EOL>if len(W_list)==<NUM_LIT:0>:<EOL><INDENT>W_list = []<EOL>for i in range(n_runs):<EOL><INDENT>W = nmf.fit_transform(data)<EOL>W_list.append(W)<EOL><DEDENT><DEDENT>W_stacked = np.hstack(W_list)<EOL>nmf_w = nmf.fit_transform(W_stacked)<EOL>nmf_h = nmf.components_<EOL>H_new = data.T.dot(nmf_w).T<EOL>nmf2 = NMF(k, init='<STR_LIT>')<EOL>nmf_w = nmf2.fit_transform(data, W=nmf_w, H=H_new)<EOL>H_new = nmf2.components_<EOL>return nmf_w, H_new<EOL>
Runs an ensemble method on the list of NMF W matrices...

Args:
    data: genes x cells array (should be log + cell-normalized)
    k: number of classes
    n_runs (optional): number of random initializations of state estimation
    M_list (optional): list of M arrays from state estimation
    se_params (optional): optional poisson_estimate_state params

Returns:
    W_new
    H_new