def NMF_results(data, n_comps=None): nmf = NMF(n_components=n_comps) model = nmf.fit(data) out_data = {'model' : model, 'reconstruction error': nmf.reconstruction_err_ } return 'NMF', out_data