Skip to content

Commit

Permalink
Don't throw an error if the required number of neighbors is too high.
Browse files Browse the repository at this point in the history
This is none of our business - if the user requests a certain perplexity
for a dataset, then we'll respect it and proceed with compute.
  • Loading branch information
LTLA committed Oct 15, 2024
1 parent 5196f09 commit 76a3406
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions include/qdtsne/initialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ Status<num_dim_, Index_, Float_> initialize(NeighborList<Index_, Float_> neighbo
*/
template<int num_dim_, typename Dim_, typename Index_, typename Float_>
Status<num_dim_, Index_, Float_> initialize(const knncolle::Prebuilt<Dim_, Index_, Float_>& prebuilt, const Options& options) {
const Index_ K = perplexity_to_k(options.perplexity);
Index_ N = prebuilt.num_observations();
if (K >= N) {
throw std::runtime_error("number of observations should be greater than 3 * perplexity");
}

const int K = perplexity_to_k(options.perplexity);
auto neighbors = find_nearest_neighbors(prebuilt, K, options.num_threads);
return internal::initialize<num_dim_>(std::move(neighbors), options.perplexity, options);
}
Expand Down

0 comments on commit 76a3406

Please sign in to comment.