tags:

views:

384

answers:

2

Hi all, I would like to know simple k-means algorithm in java. I want to use k-means only for grouping one dimensional array not multi. For example, before grouping the array consists of 2,4,7,5,12,34,18,25 if we want four group then we got group 1: 2,4,5 group 2: 7,12 group 3: 18,25 group 4: 34

+1  A: 

You can take a look at the Weka implementation or simply use the Weka API if all you need are the clusters and not the implementation.

Tomislav Nakic-Alfirevic
A: 

The standard (heuristic) algorithm for K-means clustering is presented on the Wikipedia page, together with links to variations and some existing implementations.

(This is programming forum, so it is reasonable to assume that you are capable of writing Java code yourself ... if you cannot find an existing implementation that it is suitable.)

Stephen C