TutteInstitute / fast_hdbscan

A fast multi-core implementation of HDBSCAN for low dimensional Euclidean spaces
BSD 2-Clause "Simplified" License
78 stars 8 forks source link

numba.core.errors.TypingError #16

Closed LJ191021 closed 10 months ago

LJ191021 commented 10 months ago

the error below happened when i just import fast_hdbscan.

Traceback (most recent call last): File "F:\LZQ\jingsai\rr.py", line 1, in import fast_hdbscan File "E:\anaconda3\lib\site-packages\fast_hdbscan__init.py", line 7, in HDBSCAN(allow_single_cluster=True).fit(random_data) File "E:\anaconda3\lib\site-packages\fast_hdbscan\hdbscan.py", line 217, in fit ) = fast_hdbscan(clean_data, return_trees=True, **kwargs) File "E:\anaconda3\lib\site-packages\fast_hdbscan\hdbscan.py", line 149, in fast_hdbscan edges = parallel_boruvka( File "E:\anaconda3\lib\site-packages\fast_hdbscan\boruvka.py", line 270, in parallel_boruvka new_edges = merge_components(components_disjoint_set, candidate_indices, candidate_distances, point_components) File "E:\anaconda3\lib\site-packages\numba\core\dispatcher.py", line 468, in _compile_for_args error_rewrite(e, 'typing') File "E:\anaconda3\lib\site-packages\numba\core\dispatcher.py", line 409, in error_rewrite raise e.with_traceback(None) numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) Cannot unify DictType[int32,Tuple(int64, int32, float32)] and DictType[int64,Tuple(int64, int32, float32)] for 'closure_localsdictcompv54vphi36_0', defined at E:\anaconda3\lib\site-packages\fast_hdbscan\boruvka.py (9)

File "E:\anaconda3\lib\site-packages\fast_hdbscan\boruvka.py", line 9: def merge_components(disjoint_set, candidate_neighbors, candidate_neighbor_distances, point_components): component_edges = {0: (0, np.int32(1), np.float32(0.0)) for i in range(0)} ^

During: typing of assignment at E:\anaconda3\lib\site-packages\fast_hdbscan\boruvka.py (9)

File "E:\anaconda3\lib\site-packages\fast_hdbscan\boruvka.py", line 9: def merge_components(disjoint_set, candidate_neighbors, candidate_neighbor_distances, point_components): component_edges = {0: (0, np.int32(1), np.float32(0.0)) for i in range(0)} ^

lmcinnes commented 10 months ago

This was fixed in main; but I have made a new release that should contain the fix. It should be on PyPI soon.

LJ191021 commented 10 months ago

i modify the codes showed in the figure below and it could run successfully. image

i wonder that if this modification will affect the clustering results.