Last active
November 19, 2015 19:32
-
-
Save yuitest/b26db553c555c8925a40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/decomposition/nmf.py | |
from sklearn.decomposition import NMF | |
import numpy | |
A = numpy.random.uniform(size=[40, 30]) | |
nmf_model = NMF(n_components=3, init='random', random_state=0) | |
nmf_model.fit(A) | |
W = nmf_model.fit_transform(A) | |
H = nmf_model.components_ | |
print(A.shape) | |
print(W.shape) | |
print(H.shape) | |
print(numpy.dot(W, H).shape) | |
print(A - numpy.dot(W, H)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment