Clear Filters
Clear Filters

could anyone help me how to change the number of clusters for every iteration

3 views (last 30 days)
I am having an array of data set A=[1 2;
3 4;
5 6;
7 8;
9 10;
11 12]
I want to group A into different number of clusters under the condition the number of clusters should not be more than size(A,1)
I need to run for several iterations.
For every iteration the number of clusters needs to be changed.

Accepted Answer

KSSV
KSSV on 18 Feb 2019
A=[1 2;
3 4;
5 6;
7 8;
9 10;
11 12] ;
G = size(A,1) ;
idx = cell(G,1) ;
for i = 1:G
idx{i} = kmeans(A,i) ;
end
  5 Comments
jaah navi
jaah navi on 18 Feb 2019
Those lines are meant for grouping the data set into clusters in a successive manner
first all are grouped into 1 cluster.
then 2 clusters,3 clusters ..................8 clusters.
But what i need is for one iteration the dataset needs to be grouped either in 1 or 2 or 3 or 4 or.......8.
for example if data set are grouped into 2 clusters during 1st iteration,it can be grouped into different number or same number of clusters in second iteration.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!