visualizeBoundaryLinear.m 410 B

12345678910111213141516
  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. w = model.w;
  7. b = model.b;
  8. xp = linspace(min(X(:,1)), max(X(:,1)), 100);
  9. yp = - (w(1)*xp + b)/w(2);
  10. plotData(X, y);
  11. hold on;
  12. plot(xp, yp, '-b');
  13. hold off
  14. end