You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from seirsplus.models import *
from seirsplus.networks import *
import networkx as nx
graph = nx.barabasi_albert_graph(n=500, m=10)
graph = custom_exponential_graph(graph)
base_model = SEIRSNetworkModel(G=graph,
beta=0.25,
sigma=1/5,
gamma=1/15,
initE=10)
base_model.run(T=100)
Code produces the following error occasionally; interestingly enough the same error shows up in the model wiki example (line 6):
seirsplus\models.py:838: RuntimeWarning: divide by zero encountered in log
self.delta = numpy.log(self.degree)/numpy.log(numpy.mean(self.degree)) if self.parameters['delta'] is None else numpy.array(self.parameters['delta']) if isinstance(self.parameters['delta'], (list, numpy.ndarray)) else numpy.full(fill_value=self.parameters['delta'], shape=(self.numNodes,1))
seirsplus\models.py:839: RuntimeWarning: divide by zero encountered in log
self.delta_Q = numpy.log(self.degree_Q)/numpy.log(numpy.mean(self.degree_Q)) if self.parameters['delta_Q'] is None else numpy.array(self.parameters['delta_Q']) if isinstance(self.parameters['delta_Q'], (list, numpy.ndarray)) else numpy.full(fill_value=self.parameters['delta_Q'], shape=(self.numNodes,1))
I believe the randomness comes from the way custom_exponential_graph modifies the original graph. One might have to run the code several times to reproduce the issue.
The text was updated successfully, but these errors were encountered:
This is a warning coming from taking the log of 0 when calculating the delta parameter for node(s) with 0 degree (which can happen when you call custom_exponential_graph on a network). This warning wasn't affecting the execution of the model, but I've updated the relevant lines to handle the log calculation more cleanly and do a resulting value check. Thanks for prompting this improvement.
Minimal working example:
Code produces the following error occasionally; interestingly enough the same error shows up in the model wiki example (line 6):
I believe the randomness comes from the way
custom_exponential_graph
modifies the original graph. One might have to run the code several times to reproduce the issue.The text was updated successfully, but these errors were encountered: