Mapping of elements gone bad
问题 I am implementing k-means and I want to create the new centroids. But the mapping leaves one element out! However, when K is of a smaller value, like 15, it will work fine. Based on that code I have: val K = 25 // number of clusters val data = sc.textFile("dense.txt").map( t => (t.split("#")(0), parseVector(t.split("#")(1)))).cache() val count = data.count() println("Number of records " + count) var centroids = data.takeSample(false, K, 42).map(x => x._2) do { var closest = data.map(p =>