wiki:application_pages/tutorial_apps/java/kmeans

Application Name

K-means

Summary

  • Name: K-means
  • Contact Person: support-compss@bsc.es
  • Access Level: public
  • License Agreement: GPL
  • Platform: COMPSs
  • Repository: K-means

Description

K-means clustering is a method of cluster analysis that aims to partition n points into k clusters in which each point belongs to the cluster with the nearest mean. It follows an iterative refinement strategy to find the centers of natural clusters in the data.

When executed with COMPSs, K-means first generates the input points by means of initialization tasks. For parallelism purposes, the points are split in a number of fragments received as parameter, each fragment being created by an initialization task and filled with random points.

After the initialization, the algorithm goes through a set of iterations. In every iteration, a computation task is created for each fragment; then, there is a reduction phase where the results of each computation are accumulated two at a time by merge tasks; finally, at the end of the iteration the main program post-processes the merged result, generating the current clusters that will be used in the next iteration. Consequently, if F is the total number of fragments, K-means generates F computation tasks and F-1 merge tasks per iteration.

Execution instructions

Usage: runcompss kmeans.KMeans <...>

where:

  • - debug: Set the debug mode on

Execution Example

runcompss kmeans.KMeans runcompss kmeans.KMeans -c 4 -i 10 -n 2000 -d 2 -f 2

Build

Option 1: Native java

cd ~/tutorial_apps/java/kmeans/; javac src/main/java/kmeans/*.java cd src/main/java/; jar cf kmeans.jar kmeans/ cd ../../../; mv src/main/java/kmeans.jar jar/

Option 2: Maven

cd ~/tutorial_apps/java/kmeans/ mvn clean package

Last modified 7 years ago Last modified on 06/14/17 12:16:56

Attachments (3)

Download all attachments as: .zip