Ensure another iteration after randomly assigning a point to a cluster

This commit is contained in:
Christian Muehlhaeuser
2018-06-05 20:40:30 +02:00
parent c58ae78401
commit 8801d19944

View File

@@ -85,6 +85,10 @@ func (m Kmeans) Partition(dataset clusters.Observations, k int) (clusters.Cluste
}
cc[ci].Append(dataset[ri])
points[ri] = ci
// Ensure that we always see at least one more iteration after
// randomly assigning a data point to a cluster
changes = len(dataset)
}
}