I have two LabeledPoints
- Prediction1
and Prediction2
. Both of these LabeledPoints
have a value as first element and a prediction as second element. I want to check if the first
element in Prediction1
is equal to first
element in Prediction2
or not. So something like this:
for each value in Prediction1 and Prediction2:
if Prediction1.tup[0] != Prediction2.tup[0]:
print 'Value unequal'
break
Example:
Suppose following is the RDD
of LabeledPoints
Prediction1
:
[(1,2),(3,4),(5,6)]
Prediction2
:
[(1,12),(3,13),(5,2)]
In above example 1st element of each LabeledPoint
of Prediction1
(1,3,5) is equal to 1st element of each LabeledPoint
of Prediction2
(1,3,5). But if even one of these didn't matched then I want to exit of the process and print that they don't match and end.
How can I do that in PySpark