fit($points, 3); // display the cluster centers and attached points foreach ($clusters as $num => $cluster) { $coordinates = $cluster->getCentroid()->getCoordinates(); assert(is_int($num)); printf( "Cluster #%s [%d,%d] has %d points\n", $num, $coordinates[0], $coordinates[1], count($cluster->getPoints()) ); }