view arrows/stats/aica.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents beb8a3f4a345
children
line wrap: on
line source
% aica -  ICA
%
% aica ::
%    model(real) ~'probability model for components',
%    [[N,N]]     ~'initial weight matrix',
%    options {
%       rate    :: nonneg/1e-4 ~'adaptation rate';
%    }
% -> arrow({[[N]]},{[[N]]},aica_state).

function o=aica(model,W0,varargin)
	opts=options('rate',1e-4,varargin{:});
	score=scorefn(model);

	rate=opts.rate;
	o=loop(@update,@(s)W0);

	function [y,W]=update(x,W)
%		y=W'*x; W=W+rate*(W-(W*y)*score(y)');
		y=W*x;  W=W+rate*(W-(score(y)/size(y,2))*(y'*W));
	end
end