Error in spectral.py
See original GitHub issueGetting a TypeError in the spectral initialization in version 0.4.0rc2. No Error in 0.4.0rc1 (just a warning).
Reproducer here: https://github.com/acwooding/covid_nlp/blob/umap-bug/notebooks/999-UMAP-bug.ipynb
%%time embedding_2d = umap.UMAP(n_components=2, metric='hellinger', random_state=42).fit(umap_bug_matrix)
TypeError Traceback (most recent call last)
<timed exec> in <module>
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/umap/umap_.py in fit(self, X, y)
1927 self.output_metric in ("euclidean", "l2"),
1928 self.random_state is None,
-> 1929 self.verbose,
1930 )[inverse]
1931
~/miniconda3/envs/covid_nlp/lib/python3.7/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, output_metric, output_metric_kwds, euclidean_output, parallel, verbose)
1036 random_state,
1037 metric=metric,
-> 1038 metric_kwds=metric_kwds,
1039 )
1040 expansion = 10.0 / np.abs(initialisation).max()
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/umap/spectral.py in spectral_layout(data, graph, dim, random_state, metric, metric_kwds)
273 random_state,
274 metric=metric,
--> 275 metric_kwds=metric_kwds,
276 )
277
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/umap/spectral.py in multi_component_layout(data, graph, n_components, component_labels, dim, random_state, metric, metric_kwds)
160 random_state,
161 metric=metric,
--> 162 metric_kwds=metric_kwds,
163 )
164 else:
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/umap/spectral.py in component_layout(data, n_components, component_labels, dim, random_state, metric, metric_kwds)
89 else:
90 distance_matrix = pairwise_distances(
---> 91 component_centroids, metric=metric, **metric_kwds
92 )
93
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/sklearn/metrics/pairwise.py in pairwise_distances(X, Y, metric, n_jobs, **kwds)
1586 func = partial(distance.cdist, metric=metric, **kwds)
1587
-> 1588 return _parallel_pairwise(X, Y, func, n_jobs, **kwds)
1589
1590
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/sklearn/metrics/pairwise.py in _parallel_pairwise(X, Y, func, n_jobs, **kwds)
1204
1205 if effective_n_jobs(n_jobs) == 1:
-> 1206 return func(X, Y, **kwds)
1207
1208 # enforce a threading backend to prevent data communication overhead
~/miniconda3/envs/covid_nlp/lib/python3.7/site-packages/sklearn/metrics/pairwise.py in _pairwise_callable(X, Y, metric, **kwds)
1231 iterator = itertools.combinations(range(X.shape[0]), 2)
1232 for i, j in iterator:
-> 1233 out[i, j] = metric(X[i], Y[j], **kwds)
1234
1235 # Make symmetric
TypeError: not enough arguments: expected 4, got 2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Spectral Algorithms — Spectral Python 0.21 documentation
Unsupervised classification algorithms divide image pixels into groups based on spectral similarity of the pixels without using any prior knowledge of the ...
Read more >Problem in importing Spectral Library in Python - Stack Overflow
I have installed spectral library in Python 3.7 according to the commands given on the documentation site of SPy(spectral python).
Read more >Spectral Python _ Hypercube not Responding · Issue #90
Im using the spectral python documentation to learn it: ... wx just fine) still view_cube is broken but for a different error this...
Read more >Loading satellite spectral bands in Ipython error
You seem to be using spectral python's class for ENVI format files, whilst it looks like you are trying to read a single...
Read more >spectral - PyPI
Spectral Python (SPy) is a pure Python module for processing hyperspectral image data (imaging spectroscopy data). It has functions for reading, displaying, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m on it; for now you can use
init='random'
to work around it.On Wed, Mar 25, 2020 at 4:16 PM Graham Clendenning notifications@github.com wrote:
Just got this error with
0.4.0rc3
. It doesn’t look to me like https://github.com/lmcinnes/umap/commit/a62ffb3d1a35b477c2e1846007529bb1e7e9e09c is part of any releases yet (according to git tags).I passed a
scipy.sparse.csr_matrix
tofit_transform
.