Comments (10)
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.
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.
I am having the exact same error..
from seirsplus.
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.
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.
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.
Thanks @pjasc, that's helpful for me to know in tracking down the issue for python 2 users.
from seirsplus.
I'm having this issue with Python 3.6.8 and numpy version 1.15.1
Should I try python 3.7?
from seirsplus.
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.
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)
- Scalability and complexity? HOT 2
- Identify nodes in each state HOT 1
- Most images on main page (https://github.com/ryansmcgee/seirsplus) are broken HOT 2
- Wiki typo about accessing sim results HOT 2
- Update to text of Basic SEIRS Model Description HOT 1
- Random "division by zero" error HOT 1
- KeyError triggered by model.run() HOT 2
- Events might sometimes skip a day HOT 1
- Testing a fixed amount of randomly selected individuals HOT 1
- Variable name errors in models.py HOT 1
- Running seirsplus on top of a graph_tool network. HOT 1
- Color return-to-work model
- Problem in running Extended SEIRS Model
- Problem running Basic_SEIRS_Network_Model_Demo
- iuhih
- joi
- want to see the 2.0 version code, please
- Apply the Version 2.0 code
- bug in models.py
- README.MD code example incorrect - nonexistent keyword "Q" being passed to constructor of SEIRSNetworkModel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seirsplus.