I have a big data frame with over 1000 rows. I am able to find the most similar rows to a certain index using cosine similarity and weight them accordingly. So my similar_rows data frame looks like this...
eg. similar_rows(60):
A B C Weight
0 5 6 7 0.2
1 8 3 2 0.3
2 1 4 6 0.1
I multiply each value by the weight column, and then find the average of all rows, so my result would be like so:
A B C
0 1.16 0.83 0.86
How can I apply this function to all 1000 rows so I'm left with a data frame like this for example:
A B C
0 0.1 0.24 0.5
1 0.3 0.2 0.3
. . . .
. . . .
1000 0.12 0.45 0.67
Thanks in advance...