I have a RDD consisting of dense vectors which contain probability distribution like below
[DenseVector([0.0806, 0.0751, 0.0786, 0.0753, 0.077, 0.0753, 0.0753, 0.0777, 0.0801, 0.0748, 0.0768, 0.0764, 0.0773]),
DenseVector([0.2252, 0.0422, 0.0864, 0.0441, 0.0592, 0.0439, 0.0433, 0.071, 0.1644, 0.0405, 0.0581, 0.0528, 0.0691]),
DenseVector([0.0806, 0.0751, 0.0786, 0.0753, 0.077, 0.0753, 0.0753, 0.0777, 0.0801, 0.0748, 0.0768, 0.0764, 0.0773]),
DenseVector([0.0924, 0.0699, 0.083, 0.0706, 0.0766, 0.0708, 0.0705, 0.0793, 0.09, 0.0689, 0.0758, 0.0743, 0.0779]),
DenseVector([0.0806, 0.0751, 0.0785, 0.0753, 0.077, 0.0753, 0.0753, 0.0777, 0.0801, 0.0748, 0.0768, 0.0764, 0.0773]),
DenseVector([0.0806, 0.0751, 0.0786, 0.0753, 0.077, 0.0753, 0.0753, 0.0777, 0.0801, 0.0748, 0.0768, 0.0764, 0.0773])
I want to calculate similarities between a vector and all the other vectors and store the result in a matrix.
I could convert the full RDD into a matrix and then take each row and calculate the distance against all the other rows. I was wondering if there is a more efficient way to do this using pyspark RDD methods.