From 632cd925a2957220ec0bfaae151e87c04b77a6e0 Mon Sep 17 00:00:00 2001 From: Zach Bjornson Date: Mon, 6 Dec 2021 08:09:24 -0700 Subject: [PATCH] Simplify perplexity normalization in t-SNE (#4425) P_sum is equal to n. See #2622 where I made this change once before. #4208 changed it back while consolidating code. Authors: - Zach Bjornson (https://github.com/zbjornson) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: https://github.com/rapidsai/cuml/pull/4425 --- cpp/src/tsne/tsne_runner.cuh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/src/tsne/tsne_runner.cuh b/cpp/src/tsne/tsne_runner.cuh index 9bbebb6d5a..6dad3d586c 100644 --- a/cpp/src/tsne/tsne_runner.cuh +++ b/cpp/src/tsne/tsne_runner.cuh @@ -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);