I'm using python and I have RDDs like this.
rdd1:
[ (['A', '1', '2', '3'], 0),
(['B', '2', '3', '4'], 1),
(['B', '3', '4', '5'], 2),
(['C', '7', '8', '9'], 3) ]
rdd2:
[ (['C', '4', '5', '6'], 4) ]
The numbers located at last(0, 1, 2, 3, 4) are indexes . What I want to get is the distance of elements of rdd1 and rdd2. For that, I have to calculate distance of index 0 and 4, index 1 and 4, index 2 and 4, and so on.
The form I want is like this:
[ ((1-4)^2 + (2-5)^2 + (3-6)^2),
((2-4)^2 + (3-5)^2 + (4-6)^2),
((3-4)^2 + (4-5)^2 + (5-6)^2),
((7-4)^2 + (8-5)^2 + (9-6)^2) ]
But there's no need to follow this form. It is just for my convenience. I tried to calculate it with map operation, but I couldn't.
Help me, please!
Comments
Post a Comment