mirror of
https://github.com/muesli/kmeans.git
synced 2025-10-05 07:36:51 +08:00
Simplified and documented examples
This commit is contained in:
@@ -21,13 +21,10 @@ func main() {
|
||||
fmt.Printf("%d data points\n", len(d))
|
||||
|
||||
// Partition the data points into 4 clusters
|
||||
clusters, err := km.Run(d, 4)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
clusters, _ := km.Run(d, 4)
|
||||
|
||||
for i, c := range clusters {
|
||||
fmt.Printf("Cluster: %d\n", i)
|
||||
fmt.Printf("Center: X: %.2f Y: %.2f\n\n", c.Center[0]*255.0, c.Center[1]*255.0)
|
||||
fmt.Printf("Centered at x: %.2f y: %.2f\n", c.Center[0]*255.0, c.Center[1]*255.0)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user