16 lines
410 B
Matlab
16 lines
410 B
Matlab
function visualizeBoundaryLinear(X, y, model)
|
|
%VISUALIZEBOUNDARYLINEAR plots a linear decision boundary learned by the
|
|
%SVM
|
|
% VISUALIZEBOUNDARYLINEAR(X, y, model) plots a linear decision boundary
|
|
% learned by the SVM and overlays the data on it
|
|
|
|
w = model.w;
|
|
b = model.b;
|
|
xp = linspace(min(X(:,1)), max(X(:,1)), 100);
|
|
yp = - (w(1)*xp + b)/w(2);
|
|
plotData(X, y);
|
|
hold on;
|
|
plot(xp, yp, '-b');
|
|
hold off
|
|
|
|
end
|