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

2 次查看(过去 30 天)
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

回答(1 个)

KALYAN ACHARJYA
KALYAN ACHARJYA 2021-1-24
编辑:KALYAN ACHARJYA 2021-1-24
  2 个评论
Arsen Driashkaba
Arsen Driashkaba 2021-1-24
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 2021-1-24
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.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by