int function ( DataPoint [ ] arg0 , DataPoint arg1 ) { double loc0 = Double . POSITIVE_INFINITY ; int loc1 = - 1 ; for ( int loc2 = 0 , loc3 = arg0 . length ; loc2 < loc3 ; loc2 ++ ) { double loc4 = distance ( arg0 [ loc2 ] , arg1 ) ; if ( loc4 < loc0 ) { loc0 = loc4 ; loc1 = loc2 ; } } return loc1 ; }
this method calculates the closest centroid for a given data point concode_field_sep DataPoint[] allCentroids concode_elem_sep Logger LOG concode_elem_sep DataPoint[] allDataPoints concode_elem_sep Cluster[] allClusters concode_elem_sep int k concode_field_sep void cluster concode_elem_sep void init concode_elem_sep void print concode_elem_sep void printMeans concode_elem_sep double distance concode_elem_sep double distance concode_elem_sep int getK concode_elem_sep double[] findCentroid concode_elem_sep void main concode_elem_sep DataPoint[] pickInitialCentroids concode_elem_sep DataPoint[] getAllCentroids concode_elem_sep void printAll concode_elem_sep Cluster[] getAllClusters