mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-07 13:08:40 +00:00
impl. standard epsilon value
This commit is contained in:
parent
a7fc3812ae
commit
1d583a03ea
|
|
@ -24,6 +24,14 @@ namespace phpOMS\Algorithm\Clustering;
|
||||||
*/
|
*/
|
||||||
final class Kmeans
|
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
|
* 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user