Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different computation of symmetrized conditional probabilities #57

Closed
javagl opened this issue Apr 8, 2017 · 2 comments
Closed

Different computation of symmetrized conditional probabilities #57

javagl opened this issue Apr 8, 2017 · 2 comments

Comments

@javagl
Copy link

javagl commented Apr 8, 2017

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?

@lvdmaaten
Copy link
Owner

Both achieve the same goal, although I can imagine sum_P may be slightly different from 2n in practice because of numerical issues.

@javagl
Copy link
Author

javagl commented Apr 9, 2017

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).

@javagl javagl closed this as completed Apr 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants