Different computation of symmetrized conditional probabilities
javagl opened this issue · 2 comments
Apologies if this is not an "issue", but rather a question that I have about the implementation (or my lack of understanding thereof).
The paper says in section 3.1 (and in the pseudocode of Algorithm 1)
set pij = (pj | i+pi | j) / 2n
The actual implementation of the symmetrization in tsne.cpp
, line 112 seems to be
double sum_P = .0;
for(int i = 0; i < N * N; i++) sum_P += P[i];
for(int i = 0; i < N * N; i++) P[i] /= sum_P;
thus not dividing by 2n
, but by the sum of all elements.
Which one is right?
My gut feeling is: It does not matter. Both achieve the same goal. But then, I wonder why the effort of computing the sum is undertaken.
Am I overlooking something here?
Both achieve the same goal, although I can imagine sum_P
may be slightly different from 2n in practice because of numerical issues.
Well. Sure, they are different. They have different values. But although I have to admit that this is not really a satisfactory answer, it answers my question at least implicitly: There are some magic factors and guesses involved, and the implementation may have some degrees of freedom (only justified by how well they work in one or the other case).