Giter Club home page Giter Club logo

Comments (2)

kevin931 avatar kevin931 commented on May 28, 2024

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.

from persim.

catanzaromj avatar catanzaromj commented on May 28, 2024

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

from persim.

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.