lmcinnes / lmcinnes/umap

Error with transform if n_neighbors > data.shape

Open
#313 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

Hi,

I've run across an error in the transform function when trying to find neighbor samples using the rejection_sample due to my own overlooking of parameter transform_queue_size (by default set to 4). This made the while loop in the rejection_sample function never converge as the number of desired neighbors was bigger than the actual fitted population). Adding a simple size test before starting rejection_sample could help other users make my mistake.

Thanks for your amazing work!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the transform path and the rejection_sample function, where the issue reports non-convergence when the requested neighbors exceed the fitted population. Trace how n_neighbors and the fitted data size are handled before rejection_sample runs. Done means an oversized request no longer loops indefinitely and the resulting behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.