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

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) Error #9

Closed
joshdunnlime opened this issue Aug 3, 2022 · 3 comments

Comments

@joshdunnlime
Copy link

Using this example:

from sklearn import datasets
import numpy as np
from classix import CLASSIX

X, y = datasets.make_blobs(n_samples=5000, centers=2, n_features=2, cluster_std=1, random_state=1)
clx = CLASSIX(sorting='pca', radius=0.15, group_merging='density', verbose=1, minPts=13, post_alloc=False)
clx.fit(X)

I am getting the following error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-569-bb587af68fc1> in <module>
      5 X, y = datasets.make_blobs(n_samples=5000, centers=2, n_features=2, cluster_std=1, random_state=1)
      6 clx = CLASSIX(sorting='pca', radius=0.15, group_merging='density', verbose=1, minPts=13, post_alloc=False)
----> 7 clx.fit(X)
      8 
      9 X

~/miniconda3/envs/ltf-analysis/lib/python3.8/site-packages/classix/clustering.py in fit(self, data)
    506             self.labels_ = copy.deepcopy(self.groups_)
    507         else:
--> 508             self.labels_ = self.clustering(
    509                 data=self.data,
    510                 agg_labels=self.groups_,

~/miniconda3/envs/ltf-analysis/lib/python3.8/site-packages/classix/clustering.py in clustering(self, data, agg_labels, splist, sorting, radius, method, minPts)
    724             # self.merge_groups = merge_pairs(self.connected_pairs_)
    725 
--> 726         self.merge_groups, self.connected_pairs_ = self.fast_agglomerate(data, splist, radius, method, scale=self.scale)
    727         maxid = max(labels) + 1
    728 

~/miniconda3/envs/ltf-analysis/lib/python3.8/site-packages/classix/merging.py in fast_agglomerate(data, splist, radius, method, scale)
    115             # den1 = splist[int(i), 2] / volume # density(splist[int(i), 2], volume = volume)
    116             for j in select_stps.astype(int):
--> 117                 sp2 = data[splist[j, 0]] # splist[int(j), 3:]
    118 
    119                 c2 = np.linalg.norm(data-sp2, ord=2, axis=-1) <= radius

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

python==3.8.12
classixclustering==0.6.5
numpy==1.22.0
scipy==1.7.3

@chenxinye
Copy link
Member

Hi @joshdunnlime

Thanks so much for pointing out this! we just fixed it in the next version 0.6.6. Please use the latest version of classix.
Also, it seems like you do not install Cython properly. Please let us know if you have further questions.

Best,
Xinye

@joshdunnlime
Copy link
Author

I'll give it a spin and report back! Thanks for the prompt action!!

@joshdunnlime
Copy link
Author

This seems to be working now. It do say that it isn't using Cython but was quick enough anyway for what I was doing.

Many thanks!

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

2 participants