annotate general/numerical/cauchy_norm.m @ 4:e44f49929e56

Adding reorganised general toolbox, now in several subdirectories.
author samer
date Sat, 12 Jan 2013 19:21:22 +0000
parents
children
rev   line source
samer@4 1 function l=cauchy_norm(DF,eta,maxit)
samer@4 2 % cauchy_norm - Quick and dirty function to fit Cauchy density to data
samer@4 3 %
samer@4 4 % cauchy_norm ::
samer@4 5 % [[N,L]] ~'data',
samer@4 6 % real ~'learning rate',
samer@4 7 % natural ~'max iterations'
samer@4 8 % -> [[1,L]] ~'the norms'.
samer@4 9
samer@4 10 w=1./mean(abs(DF));
samer@4 11 for k=1:maxit
samer@4 12 y=w*DF;
samer@4 13 g=1-mean(y.*score(y));
samer@4 14 w=w.*exp(eta*g);
samer@4 15 if all(abs(g))<0.002, break; end;
samer@4 16 end
samer@4 17 l=1./w;
samer@4 18
samer@4 19 function g=score(x)
samer@4 20 g=2*x./(1+x.^2);
samer@4 21