I'm working on k-mean algorthim to cluster list of number, let we say my list is
my_list = [13, 15, 13, 23, 45, 25, 7]
how could I use k-mean to grouped into clusters of similar numbers? So the output would be this:
clusters = {
1 : [7],
2 : [13, 15, 13],
3 : [23, 25],
4 : [45]
}
then randomly select one number to represent each cluster?
(for example max value in each cluster), 7, 15, 25, and 45 are selected respectively. how can I do it?