You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
410 B
Matlab
17 lines
410 B
Matlab
10 years ago
|
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
|