Skip to content

Commit

Permalink
Simplify perplexity normalization in t-SNE (rapidsai#4425)
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.

Authors:
  - Zach Bjornson (https://github.com/zbjornson)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#4425
  • Loading branch information
zbjornson authored Dec 6, 2021
1 parent 660282d commit 632cd92
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 632cd92

Please sign in to comment.