Why the results are different every time using the code of Nonnegative matrix factorization ?

4 visualizaciones (últimos 30 días)
I use this code to deal the same EMG data ,but every time the results are different ,what's wrong of the code ? how to change the code?
I think I follwe the 'help' about the nnmf.
K=5;
opt = statset('MaxIter',100,'Display','off');
[W0,H0] = nnmf(EMG,K,'replicates',10,'options',opt,'algorithm','mult');
opt = statset('Maxiter',10000,'Display','final');
[W,H] = nnmf(EMG,K,'w0',W0,'h0',H0, 'options',opt,'algorithm','als');

Respuestas (1)

Steven Lord
Steven Lord el 15 de Sept. de 2020
From the documentation page for the nnmf function: "The factorization uses an iterative method starting with random initial values for W and H." If you want each call to nnmf to use the same initial values, specify w0 and h0 in the options structure, specify Streams in the options structure, and/or initialize the random number generator to a known state using rng before each call to nnmf.
  2 comentarios
xiaoqian chang
xiaoqian chang el 15 de Sept. de 2020
I knowwhat you mean,BUT How to specify w0 and h0? maybe code can achieve it ? Thank you!
Steven Lord
Steven Lord el 15 de Sept. de 2020
More from the documentation page: if A is an n-by-m matrix and k is the second input, pass "An n-by-k matrix to be used as the initial value for W." in as w0 and "A k-by-m matrix to be used as the initial value for H." as h0. The last block of code in the second example shows the syntax for how to do that.
If you're asking which particular n-by-k and k-by-m matrices you should specify, that depends on your A matrix. Ideally you want w0 and h0 that are "close to" the actual solution. You'll have an easier time finding Mount Everest if you start somewhere in the Himalayas than if you started in the middle of the ocean.

Iniciar sesión para comentar.

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by