| 1 | <?php |
||
| 10 | class KMeans implements Clusterer |
||
| 11 | { |
||
| 12 | public const INIT_RANDOM = 1; |
||
| 13 | |||
| 14 | public const INIT_KMEANS_PLUS_PLUS = 2; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | private $clustersNumber; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | private $initialization; |
||
| 25 | |||
| 26 | public function __construct(int $clustersNumber, int $initialization = self::INIT_KMEANS_PLUS_PLUS) |
||
| 35 | |||
| 36 | public function cluster(array $samples): array |
||
| 50 | |||
| 51 | public function acluster(array $samples): array |
||
| 65 | } |
||
| 66 |