Files
matlab/RBM/UFLDL/rica/softICACost.m
T
jens 7b34529b24 imported RBM
git-svn-id: http://moon:8086/svn/matlab/trunk@91 801c6759-fa7c-4059-a304-17956f83a07c
2016-07-12 11:24:12 +00:00

15 lines
388 B
Matlab

%% Your job is to implement the RICA cost and gradient
function [cost,grad] = softICACost(theta, x, params)
% unpack weight matrix
W = reshape(theta, params.numFeatures, params.n);
% project weights to norm ball (prevents degenerate bases)
Wold = W;
W = l2rowscaled(W, 1);
%%% YOUR CODE HERE %%%
% unproject gradient for minFunc
grad = l2rowscaledg(Wold, W, Wgrad, 1);
grad = grad(:);