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