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

Negative values for births and deaths #88

Closed
christian-oreilly opened this issue Nov 15, 2019 · 7 comments
Closed

Negative values for births and deaths #88

christian-oreilly opened this issue Nov 15, 2019 · 7 comments

Comments

@christian-oreilly
Copy link

I apologize in advance if this is explained somewhere or if it is a trivial question. I admit being very new to topological analyses. Anyway, I could not find anything (e.g., some normalization or transformation) that would explain the fact that I obtain negative values for births and deaths on the persistence plot I obtained with Ripser. This happens using the following code:

from ripser import Rips
rips = Rips(maxdim=4)
diagrams = rips.fit_transform(data, distance_matrix=True)
rips.plot(diagrams)

which produced the following figure: https://pasteboard.co/IGNZumH.png

Let me know if this is a bug, in which case I'll share the data that are used in this example so that you can reproduce the issue. If it is not a bug, maybe the documentation can highlight more clearly the fact that the plots generated are not standard persistence plots (i.e., with positive births and deaths) and in which way they depart from standard persistence plots.

@sauln
Copy link
Member

sauln commented Nov 15, 2019

oh very weird. Thanks for bringing this up.

Does your distance matrix have negative values?

@christian-oreilly
Copy link
Author

Right... I was using a correlation matrix, so you are totally right... with both positives and negative values. My bad. If it is expecting a distance metric it is not surprising that it would give weird results. Maybe I could suggest testing for positivity and throwing a warning if the input matrix has negative values... for dumb-proofing the function call and helping spotting eventual issues :) Thanks for the fast feedback and for your time.

@sauln
Copy link
Member

sauln commented Nov 16, 2019

Phew! I'm glad that was the problem.

The test and warning is a great idea and would probably save others in the future. If you'd like to submit a pull request with that implementation, I would readily review and merge!

@ctralie
Copy link
Member

ctralie commented Nov 16, 2019 via email

@christian-oreilly
Copy link
Author

@sauln I can have a look at it.

@ctralie Could you provide an example of a function call that relates to that? Not knowing that much about ripser, it could take me some time to figure out what objects/functions/methods are related to your "lower start image filtration".

@ctralie
Copy link
Member

ctralie commented Nov 16, 2019 via email

@christian-oreilly
Copy link
Author

Alright. Nice notebook @ctralie

So, no change for the moment. At least this ticket provides a minimum of documentation on the existence of negative birth and death time.

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

3 participants