How do I remove normalization after running the nnmf algorithm
2 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I've spent a day on this and still cant figure it out. I have run the nnmf analysis on my EMG data. Prior to the analyis, the data was normalized to unit variance to ensure each muscle is equally weighted in the nnmf extraction. The EMG data(EMGo) is an 8*505 where each row represents a different muscle. To achieve the unit variance normalization, I divided each row by the standard deviation of that row to get EMG_unit_var.
Now after I run the nnmf, I get two parameters, [W, H].
my question is how do I remove the unit variance normalization from the W and H parameters. I tried multiplying by the standard deviaton(std_EMG) but its incorrect.
load('EMGo.mat')
std_EMG = std(EMGo,0,2); %find the standard deviation of EMGo
EMG_unit_var = EMGo/std_EMG; %divide by standard deviation for unit variance
k= 2; %assuming the rank is equal to 2
opt = statset('MaxIter',500,'Display','final'); %opions for nnmf
[W0,H0] = nnmf(EMG_unit_var' ,k,'replicates',10,'options',opt,'algorithm','mult'); %set the initials of nnmf
opt = statset('Maxiter',1000,'Display','final'); %set options for the nnmf
[W,H] = nnmf(EMG_unit_var' ,k,'w0',W0,'h0',H0,'options',opt,...
'algorithm','als'); % find the W and H nnmf factors
0 个评论
回答(1 个)
Harimurali
2023-9-13
Hi Jay,
I understand that you want to remove the unit variance normalization from the “W"and "H” parameters that you obtained after performing the NNMF(Non-Negative Matrix Factorization) analysis on the normalized data, "EMG_unit_var".
The result of NNMF is two matrices: “W”, a feature matrix, and “H”, the coefficient matrix.
To denormalize the resulting matrices “W” and “H”,the denormalization formula is applied. For matrix “W”, the denormalization involves multiplying it by the row-wise standard deviation vector obtained from the “EMGo" matrix. Matrix “H” remains unchanged as it represents the coefficients.
In this case, I noticed that you have normalized the data and then performed NNMF on the transpose of the so obtained data, that is, the transpose of “EMG_unit_var”.This could cause an issue while denormalizing as the resulting “W” matrix cannot be multiplied with the standard deviation vector.
I recommend you take the transpose of the data and then normalize it before performing the NNMF analysis. Refer to the following modified code that incorporates this change:
load('EMGo.mat');
std_EMG = std(EMGo',0,2); %find the standard deviation of EMGo
EMG_unit_var = EMGo' ./ std_EMG; %divide by standard deviation for unit variance
k= 2; %assuming the rank is equal to 2
opt = statset('MaxIter',500,'Display','final'); %opions for nnmf
[W0,H0] = nnmf(EMG_unit_var ,k,'replicates',10,'options',opt,'algorithm','mult'); %set the initials of nnmf
opt = statset('Maxiter',1000,'Display','final'); %set options for the nnmf
[W,H] = nnmf(EMG_unit_var ,k,'w0',W0,'h0',H0,'options',opt, 'algorithm','als'); % find the W and H nnmf factors
W_denormalized = W .* std_EMG;
H_denormalized = H;
Hope this helps.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!