mirror of
https://github.com/muesli/kmeans.git
synced 2025-09-26 19:51:27 +08:00
Abort processing when iterationThreshold has been reached
This commit is contained in:
@@ -107,7 +107,8 @@ func (m Kmeans) Partition(dataset Points, k int) (Clusters, error) {
|
||||
if m.plotter != nil {
|
||||
m.plotter.Plot(clusters, i)
|
||||
}
|
||||
if changes < int(float64(len(dataset))*m.deltaThreshold) {
|
||||
if i == m.iterationThreshold ||
|
||||
changes < int(float64(len(dataset))*m.deltaThreshold) {
|
||||
// fmt.Println("Aborting:", changes, int(float64(len(dataset))*m.TerminationThreshold))
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user