Skip to content

Commit

Permalink
Simplify perplexity normalization in t-SNE
Browse files Browse the repository at this point in the history
P_sum is equal to n. See rapidsai#2622 where I made this change once before. rapidsai#4208 changed it back while consolidating code.
  • Loading branch information
zbjornson committed Dec 6, 2021
1 parent c364d05 commit 2b02e89
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cpp/src/tsne/tsne_runner.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ class TSNE_runner {
START_TIMER;
//---------------------------------------------------
// Normalize perplexity to prepare for symmetrization
value_t P_sum = thrust::reduce(rmm::exec_policy(stream), P.begin(), P.end());
raft::linalg::scalarMultiply(P.data(), P.data(), 1.0f / (2.0f * P_sum), P.size(), stream);
raft::linalg::scalarMultiply(P.data(), P.data(), 1.0f / (2.0f * n), P.size(), stream);
//---------------------------------------------------
END_TIMER(NormalizeTime);

Expand Down

0 comments on commit 2b02e89

Please sign in to comment.