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

=perism-0.1.3 multiple tests fail with AttributeError: module 'collections' has no attribute 'Iterable' #64

Closed
TheChymera opened this issue Jan 14, 2023 · 2 comments

Comments

@TheChymera
Copy link

This is the full build log, any idea what's going on?

@kevin931
Copy link

I used persim v0.3.1 from PyPI with Python 3.10.9, and I ran into the same error. Here is the traceback I got:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[4], line 17
     15     dgm0 = ripser(D, maxdim=0, distance_matrix=True)['dgms'][0]
     16     pds.append(np.clip(dgm0,a_min=-2,a_max=2))  # clip min/max birth/death
---> 17     pims.append(pim.transform(pds[i])) # vectorise by persistence image
     18 for i in range(4):   # plot persistence images
     19     ax = plt.subplot(240+i+1)

File ~/anaconda3/envs/tda/lib/python3.10/site-packages/sklearn/utils/_set_output.py:142, in _wrap_method_output.<locals>.wrapped(self, X, *args, **kwargs)
    140 @wraps(f)
    141 def wrapped(self, X, *args, **kwargs):
--> 142     data_to_wrap = f(self, X, *args, **kwargs)
    143     if isinstance(data_to_wrap, tuple):
    144         # only wrap the first output for cross decomposition
    145         return (
    146             _wrap_data_with_container(method, data_to_wrap[0], X, self),
    147             *data_to_wrap[1:],
    148         )

File ~/anaconda3/envs/tda/lib/python3.10/site-packages/persim/images.py:577, in PersistenceImager.transform(self, pers_dgms, skew, n_jobs)
    574     return np.zeros(self.resolution)
    576 # convert to a list of diagrams if necessary 
--> 577 pers_dgms, singular = self._ensure_iterable(pers_dgms)
    579 if parallelize:
    580     pers_imgs = Parallel(n_jobs=n_jobs)(delayed(_transform)(pers_dgm, skew, self.resolution, self.weight, self.weight_params, self.kernel, self.kernel_params, self._bpnts, self._ppnts) for pers_dgm in pers_dgms)

File ~/anaconda3/envs/tda/lib/python3.10/site-packages/persim/images.py:618, in PersistenceImager._ensure_iterable(self, pers_dgms)
    615 def _ensure_iterable(self, pers_dgms):
    616     # if first entry of first entry is not iterable, then diagrams is singular and we need to make it a list of diagrams
    617     try:
--> 618         singular = not isinstance(pers_dgms[0][0], collections.Iterable)
    619     except IndexError:
    620         singular = False

AttributeError: module 'collections' has no attribute 'Iterable'

From a quick search, it looks like it's a deprecation issue? I'm not familiar with this, but I'm just wanting to add what I ran into.

@catanzaromj
Copy link
Contributor

@TheChymera @kevin931 This should be fixed in persim v0.3.2. If the issue remains, please re-open.

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

4 participants