...
No Format |
---|
partition(index i, key key_j, int N) { // N is num reducers // find the data per reducer int dataPerRed = mC2 / N; // assuming m is known int prev_sum = 0; // calculate the total combinations contributed by previous indexes for (k=1; k < i; k++) { prev_sum += m - k + 1; // this adds the number of combinations contributed by kth index } prev_sum += j - i + 1 // self contribution return prev_sum % dataPerRed } |
Calculate |a|·|b|cos(q)
...
on Map/Reduce
...
Collect the similarity result of the two users
...