Cursera: machine learning ex7.
This commit is contained in:
14
machine_learning/mlclass-ex7-008/mlclass-ex7/plotDataPoints.m
Executable file
14
machine_learning/mlclass-ex7-008/mlclass-ex7/plotDataPoints.m
Executable file
@@ -0,0 +1,14 @@
|
||||
function plotDataPoints(X, idx, K)
|
||||
%PLOTDATAPOINTS plots data points in X, coloring them so that those with the same
|
||||
%index assignments in idx have the same color
|
||||
% PLOTDATAPOINTS(X, idx, K) plots data points in X, coloring them so that those
|
||||
% with the same index assignments in idx have the same color
|
||||
|
||||
% Create palette
|
||||
palette = hsv(K + 1);
|
||||
colors = palette(idx, :);
|
||||
|
||||
% Plot the data
|
||||
scatter(X(:,1), X(:,2), 15, colors);
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user