Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeWarning: divide by zero encountered in power | return 1.0 / (1.0 + a * x ** (2 * b)) #471

Open
nathanielbd opened this issue Jul 27, 2020 · 0 comments

Comments

@nathanielbd
Copy link

This is a duplicate of #22 opened by @fedden. It was apparently resolved by passing correct parameters, but no specific details are mentioned.

Some things I am adding upon which were unresolved in that issue:

Expanded stack trace

/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/umap_.py:1052: RuntimeWarning: divide by zero encountered in power
  return 1.0 / (1.0 + a * x ** (2 * b))
Traceback (most recent call last):
  File "pipeline.py", line 271, in <module>
    coords, nodes = umap(new_gi_df, args, out_dir)
  File "pipeline.py", line 141, in umap
    embedding = reducer.fit_transform(gi_df.values)
  File "/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/umap_.py", line 1598, in fit_transform
    self.fit(X, y)
  File "/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/umap_.py", line 1429, in fit
    self.verbose,
  File "/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/umap_.py", line 281, in nearest_neighbors
    verbose=verbose,
  File "/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/numba/core/dispatcher.py", line 401, in _compile_for_args
    error_rewrite(e, 'typing')
  File "/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/numba/core/dispatcher.py", line 344, in error_rewrite
    reraise(type(e), e, None)
  File "/project/csbio/envs_dirs/viz/lib/python3.6/site-packages/numba/core/utils.py", line 80, in reraise
    raise value.with_traceback(tb)
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<built-in function empty>) with argument(s) of type(s): (float64, dtype=class(int64))
 * parameterized
In definition 0:
    All templates rejected with literals.
In definition 1:
    All templates rejected without literals.
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<built-in function empty>)
[2] During: typing of call at /project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/utils.py (94)


File "../../../envs_dirs/viz/lib/python3.6/site-packages/umap/utils.py", line 94:
def rejection_sample(n_samples, pool_size, rng_state):
    <source elided>
    """
    result = np.empty(n_samples, dtype=np.int64)
    ^

[1] During: resolving callee type: type(CPUDispatcher(<function rejection_sample at 0x7f51f9e38950>))
[2] During: typing of call at /project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/nndescent.py (63)

[3] During: resolving callee type: type(CPUDispatcher(<function rejection_sample at 0x7f51f9e38950>))
[4] During: typing of call at /project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/nndescent.py (63)

[5] During: resolving callee type: type(CPUDispatcher(<function rejection_sample at 0x7f51f9e38950>))
[6] During: typing of call at /project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/nndescent.py (63)

[7] During: resolving callee type: type(CPUDispatcher(<function rejection_sample at 0x7f51f9e38950>))
[8] During: typing of call at /project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/nndescent.py (63)

[9] During: resolving callee type: type(CPUDispatcher(<function rejection_sample at 0x7f51f9e38950>))
[10] During: typing of call at /project/csbio/envs_dirs/viz/lib/python3.6/site-packages/umap/nndescent.py (63)


File "../../../envs_dirs/viz/lib/python3.6/site-packages/umap/nndescent.py", line 63:
    def nn_descent(
        <source elided>
        for i in range(data.shape[0]):
            indices = rejection_sample(n_neighbors, data.shape[0], rng_state)
            ^


Reproducible Parameters

Output when verbose=True:

UMAP(a=None, angular_rp_forest=False, b=None, init='spectral',
     learning_rate=1.0, local_connectivity=1.0, metric='correlation',
     metric_kwds=None, min_dist=0.1, n_components=2, n_epochs=None,
     n_neighbors=2.0, negative_sample_rate=5, random_state=None,
     repulsion_strength=1.0, set_op_mix_ratio=1.0, spread=0.1,
     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
Wed Jul 22 23:28:22 2020 Finding Nearest Neighbors
Wed Jul 22 23:28:22 2020 Building RP forest with 9 trees
Wed Jul 22 23:28:24 2020 NN descent for 12 iterations

Same error occurs when spread is changed to 1 or 10. Same error also occurs when min_dist is 0.0, 0.1, or 0.99 while spread is default.

It may be helpful to add a more informative error message.

parashardhapola added a commit to parashardhapola/scarf that referenced this issue Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant