Giter VIP home page Giter VIP logo

Comments (10)

ryansmcgee avatar ryansmcgee commented on July 23, 2024

Thanks for reaching out, I'm sorry you're encountering this issue. I just tested the notebook on my machine and unfortunately I'm not able to reproduce this error on my end. It appears that in your case baseGraph has one or more nodes that have no edges which causes neighbors to be an empty list that numpy.random.choice can't handle. Are you using the baseGraph generation that was originally in the notebook, or did you modify how that graph is created? The current implementation of custom_exponential_graph implicitly assumes that all nodes have non-zero degree, but I will change the code to be safe for cases where nodes do have zero degree. I'll post here when that is updated on the repo and pip. If you think that is not the source of your error let me know!

from seirsplus.

fdabl avatar fdabl commented on July 23, 2024

Thanks for the quick response! Hmm, it is odd that you cannot reproduce it. I did not change anything in the notebook, but ran it as is. I don't think the explanation you suggested is correct, because

0 in dict(baseGraph.degree).values() # False

returns False, which means that all nodes have non-zero degree, right?

from seirsplus.

pjasc avatar pjasc commented on July 23, 2024

I am having the exact same error..

from seirsplus.

ryansmcgee avatar ryansmcgee commented on July 23, 2024

Thank you both for re-elevating this issue. I know a bunch of people have been able to run the notebooks and package generally, so the problem here seems to be a strange one, but I will investigate further. If you can let me know what version of python you're running and any other environment factors that might be relevant that'd be helpful.

from seirsplus.

pjasc avatar pjasc commented on July 23, 2024

I have python 2.7.15. Basically I have downloaded anaconda with python 2.7 and then launched Jupiter Notebook and ran your code

from seirsplus.

pjasc avatar pjasc commented on July 23, 2024

I created a virtual environment with python 3.7 and everything works fine now! So I guess there was some kind of issue with the python version

from seirsplus.

ryansmcgee avatar ryansmcgee commented on July 23, 2024

Thanks @pjasc, that's helpful for me to know in tracking down the issue for python 2 users.

from seirsplus.

akalai avatar akalai commented on July 23, 2024

I'm having this issue with Python 3.6.8 and numpy version 1.15.1
Should I try python 3.7?

from seirsplus.

akalai avatar akalai commented on July 23, 2024

I found the problem. You can either upgrade to a newer version of numpy, or better yet the code could be modified not to sample from an empty list. See the comparison below:

import numpy as np
print(np.version)
np.random.choice([], size=0, replace=False)
1.16.2
array([], dtype=float64)

but in another venv:

import numpy as np
print(np.version)
np.random.choice([], size=0, replace=False)
1.15.1


ValueError Traceback (most recent call last)
in
1 import numpy as np
2 print(np.version)
----> 3 np.random.choice([], size=0, replace=False)

mtrand.pyx in mtrand.RandomState.choice()

ValueError: a must be non-empty

from seirsplus.

fdabl avatar fdabl commented on July 23, 2024

Excellent, upgrading numpy fixed it for me; but I agree that it would be best to update the code. Thank you!

from seirsplus.

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.