How can I do constrained kmeans in Matlab?

11 visualizaciones (últimos 30 días)
Ninto Antony
Ninto Antony el 24 de Ag. de 2020
Comentada: Ninto Antony el 28 de Ag. de 2020
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 comentarios
Shubham Rawat
Shubham Rawat el 28 de Ag. de 2020
Editada: Shubham Rawat el 28 de Ag. de 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?
Ninto Antony
Ninto Antony el 28 de Ag. de 2020
I have 600 points with me in a matrix with three columns. The first and second columns represent the latitude and longitude of the point The third column is a number(population) for that point. I want to cluster in such a way that the sum of all the population in one cluster is in between 300 and 350. If the above condition is met I want to get the centroid of that cluster.
Can you please guide me as to how I should proceed
Your help is much appreciated

Iniciar sesión para comentar.

Respuestas (1)

Shubham Rawat
Shubham Rawat el 28 de Ag. de 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 comentarios
Shubham Rawat
Shubham Rawat el 28 de Ag. de 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.
Ninto Antony
Ninto Antony el 28 de Ag. de 2020
I can't even understand the code for normal kmeans. I think I would need some external help. But thanks for the solution 😊

Iniciar sesión para comentar.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by