I've to do NMF with sklearn, I've used the instructions here: http://scikit-learn.org/stable/modules/generated/sklearn.decomposition.NMF.html
I want to add my initialized matrix H, there is option to do init='custom' but I don't know how to give him the matrix H. I've tried:
model = NMF(n_components=2, init='custom',H=myInitializationH random_state=0);
but it doesn't work.
In addition, is someone know how to fix my matrix and update only W?
edit:
Thanks for the answer
When I choose the custom option, I get the error:
ValueError: input contains nan infinity or a value too large for dtype('float64')
However, the matrix don't contains any nan or infinity. Moreover, I did it for very small matrix to see if it is fine and its not:
import numpy as np
from sklearn.decomposition import NMF
x=np.ones((2,3));
#model = NMF(n_components=1, init='custom', solver='mu',beta_loss=1,max_iter=500,random_state=0,alpha=0,verbose=0, shuffle=False);
model = NMF(n_components=1, init='custom');
fixed_W = model.fit_transform(x,H=np.ones((1,3)));
fixed_H = model.components_;
print(np.matmul(fixed_W,fixed_H));
I got the same error unless I do 'random' instead of 'custom'.
Is it happen also to you? why is it happen?