I want to make 4 clusters using k mean clustering and for each of the 4 clusters i want to set centroid initially and then accordingly make the cluster. how can I.

1 次查看(过去 30 天)
X3=[-6.189; -3.251; 2.926; 6.534; 10.79; 5.203; -4.465; 1.42; -8.66; -0.8748; 6.534 ; 11.251] ;
Y3=[ 1.393; 10.42; 6.639; 5.821; 8.425; 2.924; 1.139; 0.7508; -7.917; -6.928; -10.01; -7.03; 5.639];
X3 and Y3 are my corrdinates of data.
I want 4 clusters whose centroid would be (x_b,y_b)
x_b=[0.7298; 3; -5.23; 11.86];
y_b=[12.48; -1.497; -6.139; -3.23];
how can i do this..?

采纳的回答

KSSV
KSSV 2022-3-29
X3=[-6.189; -3.251; 2.926; 6.534; 10.79; 5.203; -4.465; 1.42; -8.66; -0.8748; 6.534 ; 11.251] ;
Y3=[ 1.393; 10.42; 6.639; 5.821; 8.425; 2.924; 1.139; 0.7508; -7.917; -6.928; -10.01; -7.03; ];
x_b=[0.7298; 3; -5.23; 11.86];
y_b=[12.48; -1.497; -6.139; -3.23];
P = [X3 Y3] ; % points
G = 4 ; % number of groups
C = [x_b y_b] ; % centroids
idx = kmeans(P,G,'MaxIter',10,'Start',C);
gscatter(P(:,1),P(:,2),idx)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by