diff --git a/Algorithm/Clustering/Kmeans.php b/Algorithm/Clustering/Kmeans.php index f9ef03493..d084b4aed 100644 --- a/Algorithm/Clustering/Kmeans.php +++ b/Algorithm/Clustering/Kmeans.php @@ -136,6 +136,7 @@ final class Kmeans foreach ($points as $point) { $clusterPoint = $clusterCenters[$point->getGroup()]; + // this should ensure that clusterPoint and therfore the center group is never 0. But this is not true. $clusterPoint->setGroup( $clusterPoint->getGroup() + 1 ); diff --git a/Algorithm/Clustering/Point.php b/Algorithm/Clustering/Point.php index 07c3eb833..b3d868f7b 100644 --- a/Algorithm/Clustering/Point.php +++ b/Algorithm/Clustering/Point.php @@ -27,7 +27,7 @@ class Point implements PointInterface /** * Coordinates of the point * - * @var array + * @var array * @sicne 1.0.0 */ private array $coordinates = []; @@ -81,7 +81,7 @@ class Point implements PointInterface /** * {@inheritdoc} */ - public function setCoordinate($index, $value) + public function setCoordinate($index, $value) : void { $this->coordinates[$index] = $value; } diff --git a/Algorithm/Clustering/PointInterface.php b/Algorithm/Clustering/PointInterface.php index a14d436ff..02a258d71 100644 --- a/Algorithm/Clustering/PointInterface.php +++ b/Algorithm/Clustering/PointInterface.php @@ -39,7 +39,7 @@ interface PointInterface * * @param mixed $index Index of the coordinate (e.g. 0 = x); * - * @return array + * @return int|float * * @since 1.0.0 */ @@ -51,11 +51,11 @@ interface PointInterface * @param mixed $index Index of the coordinate (e.g. 0 = x); * @param mixed $value Value of the coordinate * - * @return array + * @return void * * @since 1.0.0 */ - public function setCoordinate($index, $value); + public function setCoordinate($index, $value) : void; /** * Get group this point belongs to