function [W,H] = nmf(V,Winit,Hinit,tol,timelimit,maxiter)
% NMF by alternative non-negative least squares using projected gradients
% Author: Chih-Jen Lin, National Taiwan University
% W,H: output solution 输出结果
% Winit,Hinit: initial solution
% tol: tolerance for a relative stopping condition
% timelimit, maxiter: limit of time and iterations
毒蛇排名W = Winit; H = Hinit; initt = cputime;
儿童动画片排行榜
gradW = W*(H*H’) - V*H’;
gradH = (W’*W)*H - W’*V;
initgrad = norm([gradW; gradH’],’fro’);
fprintf(’Init gradient norm %f\n’, initgrad);
tolW = max(0.001,tol)*initgrad; tolH = tolW;
for iter=1:maxiter,
冷锋和暖锋示意图% stopping condition
projnorm = norm([gradW(gradW<0 | W>0); gradH(gradH<0 | H>0)]);能谋善断
if projnorm < tol*initgrad | cputime-initt > timelimit,
break;
end深圳市物价局
[W,gradW,iterW] = nlssub prob(V’,H’,W’,tolW,1000); W = W’; gradW = gradW’; if iterW==1,
tolW = 0.1 * tolW;
end
[H,gradH,iterH] = nlssubprob(V,W,H,tolH,1000);跨行存款要手续费吗>为什么刘畊宏突然爆火
if iterH==1,
tolH = 0.1 * tolH;
end
if rem(iter,10)==0, fprintf(’.’); end
从的组词
end
fprintf(’\nIter = %d Final proj-grad norm %f\n’, iter, projnorm);