I am new to scala and I am practicing it with k-means algorithm following the tutorial from k-means
I am confused by this part of this tutorial:
var newCentroids = pointsGroup.mapValues(ps => average(ps)).collectAsMap()
This causes a type mismatch error because function average
needs a Seq
, while we give it an Iterable
. How can I fix this? What caused this error?
groupByKey
was returningRDD[(K, Seq[V])]
while now it's giving usRDD[(K, Iterable[V])]
– Odomontois