1
0
Fork 0

Train num_labels one-vs-all logistic regression classifiers

master
neingeist 10 years ago
parent 9117809537
commit cf0d25440c

@ -49,18 +49,20 @@ X = [ones(m, 1) X];
% initial_theta, options);
%
for c = 1:num_labels
% Train a one-vs all classifier for this class c
initial_theta = zeros(n + 1, 1);
options = optimset('GradObj', 'on', 'MaxIter', 50);
[theta] = fmincg(@(t)(lrCostFunction(t, X, (y == c), lambda)),
initial_theta, options);
all_theta(c,:) = theta';
end
% =========================================================================
end