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

조회 수: 4 (최근 30일)
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');

답변 (1개)

Steven Lord
Steven Lord 2020년 9월 15일
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
xiaoqian chang
xiaoqian chang 2020년 9월 15일
I knowwhat you mean,BUT How to specify w0 and h0? maybe code can achieve it ? Thank you!
Steven Lord
Steven Lord 2020년 9월 15일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by