You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

plotData.m 798 B

8 years ago
123456789101112131415161718192021222324252627282930
  1. function plotData(X, y)
  2. %PLOTDATA Plots the data points X and y into a new figure
  3. % PLOTDATA(x,y) plots the data points with + for the positive examples
  4. % and o for the negative examples. X is assumed to be a Mx2 matrix.
  5. % Create New Figure
  6. figure; hold on;
  7. % ====================== YOUR CODE HERE ======================
  8. % Instructions: Plot the positive and negative examples on a
  9. % 2D plot, using the option 'k+' for the positive
  10. % examples and 'ko' for the negative examples.
  11. %
  12. pos = find(y == 1);
  13. neg = find(y == 0);
  14. plot(X(pos, 1), X(pos, 2), 'k+' ,'LineWidth', 2, 'MarkerSize', 7);
  15. plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', 'MarkerSize', 7);
  16. % =========================================================================
  17. hold off;
  18. end

机器学习

Contributors (1)