Moving course1 to course1 subdir.
This commit is contained in:
17
machine_learning/course1/mlclass-ex6-008/mlclass-ex6/plotData.m
Executable file
17
machine_learning/course1/mlclass-ex6-008/mlclass-ex6/plotData.m
Executable file
@@ -0,0 +1,17 @@
|
||||
function plotData(X, y)
|
||||
%PLOTDATA Plots the data points X and y into a new figure
|
||||
% PLOTDATA(x,y) plots the data points with + for the positive examples
|
||||
% and o for the negative examples. X is assumed to be a Mx2 matrix.
|
||||
%
|
||||
% Note: This was slightly modified such that it expects y = 1 or y = 0
|
||||
|
||||
% Find Indices of Positive and Negative Examples
|
||||
pos = find(y == 1); neg = find(y == 0);
|
||||
|
||||
% Plot Examples
|
||||
plot(X(pos, 1), X(pos, 2), 'k+','LineWidth', 1, 'MarkerSize', 7)
|
||||
hold on;
|
||||
plot(X(neg, 1), X(neg, 2), 'ko', 'MarkerFaceColor', 'y', 'MarkerSize', 7)
|
||||
hold off;
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user