points.map(point => closestCentroid(point) -> (point, 1))
其中,
points: Seq[Double];
centroids: Seq[Double]
def closestCentroid(point: Point) = {
centroids.reduceLeft((a, b) => if ((point distance a) < (point distance b)) a else b)
}
表示看不懂closetCentroid(point) -> (point, 1)
这里的数字1有什么作用?
求指教