lmcinnes / lmcinnes/umap

ZeroDivisionError when verbose=True

Open
#124 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

With verbose=False everything works fine

>> u = umap.UMAP(verbose=False, n_neighbors=15, n_components=256, metric='euclidean', n_epochs=100, min_dist=0.1)
>> u.fit(X)

With verbose=True it throws ZeroDivisionError exception

>> u = umap.UMAP(verbose=True, n_neighbors=15, n_components=256, metric='euclidean', n_epochs=100, min_dist=0.1)
>> u.fit(X)
UMAP(a=None, angular_rp_forest=False, b=None, init='spectral',
   learning_rate=1.0, local_connectivity=1.0, metric='euclidean',
   metric_kwds=None, min_dist=0.1, n_components=256, n_epochs=1,
   n_neighbors=15, negative_sample_rate=5, random_state=None,
   repulsion_strength=1.0, set_op_mix_ratio=1.0, spread=1.0,
   target_metric='categorical', target_metric_kwds=None,
   target_n_neighbors=-1, target_weight=0.5, transform_queue_size=4.0,
   transform_seed=42, verbose=True)
Construct fuzzy simplicial set
Construct embedding
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-149-b9c10a7f4872> in <module>()
---> 15         u.fit(X)

/usr/local/anaconda/lib/python3.6/site-packages/umap/umap_.py in fit_transform(self, X, y)
   1521             Embedding of the training data in low-dimensional space.
   1522         """
-> 1523         self.fit(X, y)
   1524         return self.embedding_
   1525 

/usr/local/anaconda/lib/python3.6/site-packages/umap/umap_.py in fit(self, X, y)
   1493             self.metric,
   1494             self._metric_kwds,
-> 1495             self.verbose,
   1496         )
   1497 

/usr/local/anaconda/lib/python3.6/site-packages/umap/umap_.py in simplicial_set_embedding(data, graph, n_components, initial_alpha, a, b, gamma, negative_sample_rate, n_epochs, init, random_state, metric, metric_kwds, verbose)
    974         initial_alpha,
    975         negative_sample_rate,
--> 976         verbose=verbose,
    977     )
    978 

ZeroDivisionError: integer modulo by zero

Environment:

>> print(umap.__version__, sys.version, sys.platform)
0.3.2 3.6.2 |Anaconda custom (64-bit)| (default, Sep 30 2017, 18:42:57) 
[GCC 7.2.0] linux

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 umap/umap_.py at simplicial_set_embedding and the call path shown in the traceback, then reproduce with the supplied UMAP parameters and verbose=True. Compare the verbose and non-verbose paths; done means the example no longer raises ZeroDivisionError and verbose output completes normally.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.