i have rdd of form
(3,compactbuffer((-0.063763,0.060122,0.250393), (0.006971,-0.096478,0.123718), (-0.198281,-0.079444,-0.015460)))
i need calculate average of vectors in compactbuffer
val averagevector = filteredvectors.reduce((a,b) => sum(b)/b.size)
by doing reduce action 1 shown above.
my averagevector
should (3, (avg(1), avg(2), avg(3)))
avg(1)
average of first elements in compactbuffer
shown above.
Comments
Post a Comment