K-means implementation for matrix A(n x m) that returns a vector of length n with values from 1 to k, depending on which cluster the vector ended in

1 visualización (últimos 30 días)
Hi,
Sorry for bad english
Here is my task
I need to implement the function mykmeans (A, k), where the input wil be a matrix A with dimensions n x m, where n will be the number of vectors and m is the length of the flag vector. k will be the parameter of the k-means algorithm. The function returns a vector of length n in which the integer values will be 1 to k, depending on which cluster the vector ended in. I need to initialize the centroids so that they are in the areas where the input vectors are located.
Can someone hel me with this task?
Thank you
Best regards, Arsen

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 24 de En. de 2021
Editada: KALYAN ACHARJYA el 24 de En. de 2021
  2 comentarios
Arsen Driashkaba
Arsen Driashkaba el 24 de En. de 2021
Hi,
Thank you for your reply,
I need to implement my own function that returns a vector of lenght n with values from 1 to k.
if you have any ideas could you help me with this?
Best regards, Arsen
Image Analyst
Image Analyst el 24 de En. de 2021
Are you saying that you're not allowed to use the built-in kmeans() function(s), or any code from anyone else either? And that you need to write your own kmeans function without any help from us or Mathworks? I believe you can probably find the algorithm in Wikipedia or elsewhere on the web.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by