文献:NeNMF: An Optimal Gradient Method for Nonnegative Matrix Factorization
;
(1)固定W,优化H
(2)优化W,固定H;
(3)更新W_k
(4)更新Y_k
具体算法:
matlab 代码
function [W,H] = myNeNMF(X,k)
%% min_{W,H}||X-WH||_2^2;
%% s.t W,H>0;
max_epoch = 200;
[dim,nSmp] = size(X);
Wt = abs(rand(dim,k));
Ht = abs(rand(k,nSmp));
%%
deltPH = -Wt'*X + Wt'*Wt*Ht;
deltPW = -X*Ht' + Wt*(Ht*Ht');
Wwt = [Wt',Ht];
DeltHW = [deltPW',deltPH];
tol = norm(DeltHW(DeltHW<0|Wwt>0));
tol_optgap = 1e-5;
tolH = 1e-3*tol;
tolW = 1e-3*tol;
innerloop = 10;
for i = 1:max_epoch
%% update H
[Ht,deltPH,iterH] = updateH(X,Wt,Ht,tolH,innerloop);
if iterH0);
if i>1
if (abs(obj(i)-obj(i-1))0);
if i>innerloop
if norm(pGd)<=tol
break;
end
end
end
H = Hk;
end
聚类效果: