我正在使用http://www.quuxlabs.com/blog当前给出的代码
它给出了很好的结果。而且我可以清楚地看到矩阵发生了哪些变化。
我也尝试在sklearn.decomposition.NMF使用 sklearn 库, 但是我用相同的输入得到的结果还不够好。也许我错过了一些东西。
这是我的示例代码 -
from sklearn.decomposition import NMF , ProjectedGradientNMF
R = [
[5,3,0,1],
[4,0,0,1],
[1,1,0,5],
[1,0,0,4],
[0,1,5,4],
]
R = numpy.array(R)
nmf = NMF(beta=0.001, eta=0.0001, init='random', max_iter=2000,nls_max_iter=20000, random_state=0, sparseness=None,tol=0.001)
nR = nmf.fit_transform(R)
print nR
print
print nmf.reconstruction_err_
print
正如我使用博客中给出的代码所看到的,它没有维护矩阵中的现有/填充值。
谁能帮我理解!