Go 的现用 Kmeans 算法包:
<pre box-sizing:="" font-family:="" liberation="" font-size:="" margin-top:="" margin-bottom:="" font-stretch:="" line-height:="" word-wrap:="" padding:="" overflow:="" background-color:="" border-radius:="" word-break:="">package mainimport ( "fmt"
"github.com/salkj/kmeans")func main() { data := []kmeans.Point{}
data = append(data, kmeans.Point{[]float64{1.0,3.0,5.0,2.0}})
data = append(data, kmeans.Point{[]float64{43.0,7.0,12.0,7.0}})
data = append(data, kmeans.Point{[]float64{2.0,12.0,5.0,8.0}})
data = append(data, kmeans.Point{[]float64{12.0,1945.0,34.0,65.0}})
fmt.Println(kmeans.KMEANS(data, 2, 0.001))
}</pre>