继回答这个问题 How to convert type Row into Vector to feed to the KMeans 我创建了功能表我的数据。(assembler是一个Vector汇编) val kmeanInput = assembler.transform(table1).select("features")
当我跑k均值与kmeanInput val clusters =
我使用修改后的Lloyd算法来获得k = 2的k均值的相同簇大小输出。 以下是伪代码: - Randomly choose 2 points as initialization for the 2 clusters (denoted as c1, c2)
- Repeat below steps until convergence
- Sort all points xi accord