Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hackassin
GitHub Repository: hackassin/Coursera-Machine-Learning
Path: blob/master/Week 7/Programming Assignment - 6/ex6/visualizeBoundaryLinear.m
863 views
1
function visualizeBoundaryLinear(X, y, model)
2
%VISUALIZEBOUNDARYLINEAR plots a linear decision boundary learned by the
3
%SVM
4
% VISUALIZEBOUNDARYLINEAR(X, y, model) plots a linear decision boundary
5
% learned by the SVM and overlays the data on it
6
7
w = model.w;
8
b = model.b;
9
xp = linspace(min(X(:,1)), max(X(:,1)), 100);
10
yp = - (w(1)*xp + b)/w(2);
11
plotData(X, y);
12
hold on;
13
plot(xp, yp, '-b');
14
hold off
15
16
end
17
18