diff --git a/Algorithm/Clustering/Kmeans.php b/Algorithm/Clustering/Kmeans.php index 9fcd3b42b..6e35e3ff6 100644 --- a/Algorithm/Clustering/Kmeans.php +++ b/Algorithm/Clustering/Kmeans.php @@ -24,6 +24,14 @@ namespace phpOMS\Algorithm\Clustering; */ final class Kmeans { + /** + * Epsilon for float comparison. + * + * @var float + * @since 1.0.0 + */ + public const EPSILON = 4.88e-04; + /** * Metric to calculate the distance between two points * @@ -163,7 +171,7 @@ final class Kmeans } } - if ($changed <= $n * 0.001 || $n * 0.001 < 2) { + if ($changed <= $n * self::EPSILON || $n * self::EPSILON < 2) { break; } }