简体   繁体   English

八度音阶 nmf_bpas 错误:垂直尺寸不匹配(8x1 与 1x400)

[英]octave nmf_bpas error: vertical dimensions mismatch (8x1 vs 1x400)

I have a problem with non-negative matrix factorization in octave.我在八度音阶中遇到非负矩阵分解的问题。 I try to estimate synergies from Emg-data, but octave only lets me do this for two or more synergies, but not for one.我试图从 Emg 数据中估计协同效应,但 octave 只能让我为两个或更多协同效应做这个,但不能为一个。 I was able to reproduce the problem with the following code.我能够使用以下代码重现该问题。 nmf_bpas is from the linear-algebra pkg from octave-forge. nmf_bpas 来自 octave-forge 的线性代数 pkg。

V=rand(4, 20);
k=1; k2=2;
[W, H, Iter, HIS]=nmf_bpas(V,k);

with this input I get the following error:使用此输入,我收到以下错误:

error: vertical dimensions mismatch (4x1 vs 1x20)
error: called from
    nmf_bpas>getStopCriterion at line 373 column 19
    nmf_bpas at line 266 column 26

when I define k>1 as in the following it works当我如下定义 k>1 时,它可以工作

[W2, H2, Iter2, HIS2]=nmf_bpas(V,k2);

with this input, it works fine, and the output matrices are W2 (4x2) and H2 (2x20).使用此输入,它可以正常工作,并且 output 矩阵是 W2 (4x2) 和 H2 (2x20)。

same problem is when I try it with other codes for nnmf and specify the input data Winit and Hinit for matrices (4x1) and (1x20) (eg.:[W, H] = nmf_pg (V, Winit, Hinit, tol, timelimit, maxiter))同样的问题是,当我尝试使用 nnmf 的其他代码并为矩阵 (4x1) 和 (1x20) 指定输入数据 Winit 和 Hinit 时(例如:[W, H] = nmf_pg (V, Winit, Hinit, tol, timelimit ,最大))

in matlab it works with the nnmf function.在 matlab 中,它与 nnmf function 一起使用。

I would be glad about help我会很高兴得到帮助

This seems to be a bug in nmf_bpas .这似乎是nmf_bpas中的一个错误。

From what I can tell, the bug is on line 373. Change据我所知,该错误位于第 373 行。更改

pGrad = [gradW(gradW<0|W>0); gradH(gradH<0|H>0)];

to

pGrad = [gradW(gradW<0|W>0); gradH(gradH<0|H>0)(:)];

and it will work.它会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM