1
0
Fork 0

Train num_labels one-vs-all logistic regression classifiers

This commit is contained in:
neingeist 2014-10-23 21:17:20 +02:00
parent 9117809537
commit cf0d25440c

View file

@ -49,18 +49,20 @@ X = [ones(m, 1) X];
% initial_theta, options); % 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 end