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/plotData.m
863 views
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
%
6
% Note: This was slightly modified such that it expects y = 1 or y = 0
7
8
% Find Indices of Positive and Negative Examples
9
pos = find(y == 1); neg = find(y == 0);
10
11
% Plot Examples
12
plot(X(pos, 1), X(pos, 2), 'k+','LineWidth', 1, 'MarkerSize', 7)
13
hold on;
14
plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', 'MarkerSize', 7)
15
hold off;
16
17
end
18
19