フィルターのクリア

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

7 ビュー (過去 30 日間)
xiaoqian chang
xiaoqian chang 2020 年 9 月 15 日
コメント済み: Steven Lord 2020 年 9 月 15 日
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 Center および File ExchangeDimensionality 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