Git Product home page Git Product logo

Comments (7)

dkobak avatar dkobak commented on July 24, 2024

I don't know what is going on here, so just a side remark: you don't need to run query() after NNDescent() if you used the desired number of neighbors for index construction. The kNN graph is stored as the neighbor_graph attribute of the index. Source: https://twitter.com/leland_mcinnes/status/1213946195162390528

from pynndescent.

lmcinnes avatar lmcinnes commented on July 24, 2024

This cropped up very recently. I believe it may be related to some combination of numba and llvmlite versions. If you can try falling back to numba v0.46 and see if that corrects the issue. I'm still trying to work out the causes here.

from pynndescent.

GWW avatar GWW commented on July 24, 2024

Thanks for the remark regarding the query function @dkobak that will be really helpful.

@lmcinnes Thanks so much for the quick reply. I tried degrading to v0.46 and reinstalling pynndescent and umap.

When I run pynndescent now I get the error below I also get a similar error when I import umap.

TypingError                               Traceback (most recent call last)
<ipython-input-10-7175d2ad6206> in <module>
----> 1 sapi.KNN(vg, 30, metric='euclidean')

~/projects/scapi/scapi/grph/__init__.py in KNN(sample, n_neighbors, metric, random_state, use_pca, use_pcs, verbose, metric_kwds)
     98         X = sample.norm.T
     99 
--> 100     knni, knnd = _KNN(X, random_state, n_neighbors, metric=metric, metric_kwds=metric_kwds, verbose=verbose)
    101     sample.cm.knn = knni
    102     sample.cm.knnd = knnd

~/projects/scapi/scapi/grph/__init__.py in _KNN(X, random_state, n_neighbors, metric, metric_kwds, verbose)
     77 
     78 def _KNN(X, random_state, n_neighbors = 20, metric='euclidean', metric_kwds=None, verbose=False):
---> 79     index = NNDescent(X, n_neighbors=n_neighbors, metric=metric, random_state=random_state)
     80     knn_indices, knn_dists = index.query(X, n_neighbors=20)
     81     sample.cm.distances, sample.cm.connectivities = _compute_connectivities_umap(knn_indices, knn_dists, X.shape[0], n_neighbors)

~/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/pynndescent_.py in __init__(self, data, metric, metric_kwds, n_neighbors, n_trees, leaf_size, pruning_degree_multiplier, diversify_epsilon, n_search_trees, tree_init, random_state, algorithm, low_memory, max_candidates, n_iters, delta, n_jobs, compressed, seed_per_row, verbose)
    977                     leaf_array=leaf_array,
    978                     verbose=verbose,
--> 979                     seed_per_row=seed_per_row,
    980                 )
    981         else:

~/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
    399                 e.patch_message(msg)
    400 
--> 401             error_rewrite(e, 'typing')
    402         except errors.UnsupportedError as e:
    403             # Something unsupported is present in the user code, add help info

~/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/numba/dispatcher.py in error_rewrite(e, issue_type)
    342                 raise e
    343             else:
--> 344                 reraise(type(e), e, None)
    345 
    346         argtypes = []

~/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/numba/six.py in reraise(tp, value, tb)
    666             value = tp()
    667         if value.__traceback__ is not tb:
--> 668             raise value.with_traceback(tb)
    669         raise value
    670 

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Internal error at <numba.typeinfer.CallConstraint object at 0x127361da0>.
Failed in nopython mode pipeline (step: nopython mode backend)
Type of #4 arg mismatch: i1 != i32

File "../../../.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/utils.py", line 138:
def make_heap(n_points, size):
    <source elided>
    """
    result = np.zeros((3, int(n_points), int(size)), dtype=np.float32)
    ^

[1] During: lowering "$0.14 = call $0.2($0.10, func=$0.2, args=[Var($0.10, /Users/gww/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/utils.py (138))], kws=[('dtype', Var($0.12, /Users/gww/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/utils.py (138)))], vararg=None)" at /Users/gww/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/utils.py (138)
[2] During: resolving callee type: type(CPUDispatcher(<function make_heap at 0x1274c5378>))
[3] During: typing of call at /Users/gww/.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/pynndescent_.py (461)

Enable logging at debug level for details.

File "../../../.pyenv/versions/3.6.6/Python.framework/Versions/3.6/lib/python3.6/site-packages/pynndescent/pynndescent_.py", line 461:
def nn_descent(
    <source elided>

    current_graph = make_heap(data.shape[0], n_neighbors)
    ^

This is not usually a problem with Numba itself but instead often caused by
the use of unsupported features or an issue in resolving types.

To see Python/NumPy features supported by the latest release of Numba visit:
http://numba.pydata.org/numba-doc/latest/reference/pysupported.html
and
http://numba.pydata.org/numba-doc/latest/reference/numpysupported.html

For more information about typing errors and how to debug them visit:
http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile

If you think your code should work with Numba, please report the error message
and traceback, along with a minimal reproducer at:
https://github.com/numba/numba/issues/new

from pynndescent.

lmcinnes avatar lmcinnes commented on July 24, 2024

This seems very odd -- everything was working very recently, but has been broken with some of the numba updates. The llvmlite version may also matter. I'm really not sure what is going on here. I'm working with the numba people to try and determine what is up.

from pynndescent.

GWW avatar GWW commented on July 24, 2024

I think you are correct that the problem is llvmlite. I downgraded to numba==0.46 (0.47 requires llvmlite 0.31) and llvmlite==0.30 and pynndescent is working and umap imports fine.

from pynndescent.

lmcinnes avatar lmcinnes commented on July 24, 2024

from pynndescent.

GWW avatar GWW commented on July 24, 2024

No need to apologize. Both umap and pynndescent have been immensely useful for my research projects so thank you for creating them and making them so easy to use!

from pynndescent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.