标签:andrew
这是UFLDL的编程练习。
M = theta*data; %exp(theta(l)‘ * x(i))
M = bsxfun(@minus, M, max(M, [], 1));
h = exp(M);
h = bsxfun(@rdivide, h, sum(h));
size(groundTruth);
cost = -1/numCases*sum(sum(groundTruth.*log(h)))+lambda/2*sum(sum(theta.^2));
thetagrad = -1/numCases*((groundTruth-h)*data‘)+lambda*theta;
[index , pred]= max(theta * data,[],1);
Deep Learning by Andrew Ng --- Softmax regression
标签:andrew
原文地址:http://blog.csdn.net/meanme/article/details/44873519