Clustering Using Mean Shift Algorithm in ML (Practical using MATLAB)
Code:
clc
clear all
close all
warning off
x=readtable('Mall_customers.csv');
x=table2array(x(:,4:5));
scatter(x(:,1),x(:,2),'filled')
[clustCent,idx,not_required] = MeanShiftCluster(x',25,0);
% numel(unique(idx))
gscatter(x(:,1),x(:,2),idx);
clustCent=clustCent';
hold on;
for
i=1:5
t=0:0.01:2*pi;
x=clustCent(i,1)+cos(t);
y=clustCent(i,2)+sin(t);
fill(x,y,'k');
end
Join us on Facebook Group:
https://www.facebook.com/groups/matlabcodes
No comments