This relates to #35.
As the cosine similarity metric is symmetric, we don't need the upper triangle indices to calculate the mean of the matrix.
Just subtract the diagonal (all ones) and divide by the number of distances (without the diagonal).
This way the performance is increased and is noticeable on matrices over 50k x 50k.
All tests passed.
Performance before and after the modification (skipping make_rec_matrix):
This relates to #35. As the cosine similarity metric is symmetric, we don't need the upper triangle indices to calculate the mean of the matrix. Just subtract the diagonal (all ones) and divide by the number of distances (without the diagonal). This way the performance is increased and is noticeable on matrices over 50k x 50k. All tests passed. Performance before and after the modification (skipping make_rec_matrix):