How can I do constrained kmeans in Matlab?
6 views (last 30 days)
Show older comments
I have an n*p matrix. I want to do normal kmeans but there is a limit such that the max number of sum of values in third column of the cluster should be 100. Can you please help
2 Comments
Shubham Rawat
on 28 Aug 2020
Edited: Shubham Rawat
on 28 Aug 2020
Hi Ninto,
As per my understanding, you are trying to apply some condition on the cluster matrix. Could you please shed some more light on your question?
Answers (1)
Shubham Rawat
on 28 Aug 2020
Hi Ninto,
As per my knowledge there is no as such function in MATLAB which can do constrained K-means clustering. In standard K-means, clustering is based upon only distances. You may have to build your own code for adding any constraints.
May be a good start would be if you:
- Assigned population to clusters.
- Then compute centroids of clusters.
- Assign points to centroids such that sum of population in that is in between 300-350.
3 Comments
Shubham Rawat
on 28 Aug 2020
You have to build your own code like K-means from scratch. In that you have to add constraints in the clusters that sum of the popluation is in between 300-350.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!