git-svn-id: http://moon:8086/svn/matlab/trunk@91 801c6759-fa7c-4059-a304-17956f83a07c
15 lines
388 B
Matlab
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(:); |