public static ClusterSetInfo classifyPoints ( final ClusterSet clusterSet , List < Point > points , ExecutorService executorService ) { final ClusterSetInfo clusterSetInfo = ClusterSetInfo . initialize ( clusterSet , true ) ; List < Runnable > tasks = new ArrayList <> ( ) ; for ( final Point point : points ) { //tasks.add(new Runnable() { // public void run() { try { PointClassification result = classifyPoint ( clusterSet , point ) ; if ( result . isNewLocation ( ) ) clusterSetInfo . getPointLocationChange ( ) . incrementAndGet ( ) ; clusterSetInfo . getClusterInfo ( result . getCluster ( ) . getId ( ) ) . getPointDistancesFromCenter ( ) . put ( point . getId ( ) , result . getDistanceFromCenter ( ) ) ; } catch ( Throwable t ) { log . warn ( "Error classifying point" , t ) ; } // } } //MultiThreadUtils.parallelTasks(tasks, executorService); return clusterSetInfo ; }
Classify the set of points base on cluster centers . This also adds each point to the ClusterSet