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
Hello !
I'm currently a engineer student and I'm using NdLib for a project. I'm quite new to NdLib so I strongly hope my question/bug report is relevant. In short, I think the class NodeNumericalAttribute has no parameter "triggering_status" as indicated in the documentation.
I'm using Ubuntu 20.04.2, NDLib 5.1.0 and Python 3.8.
I wanted to use NodeNumericalAttribute in order to build a specific epidemic model where you need to test whether to person is vaccinated or not to move from a status to an other. Though, as I looked into the source code of the class NodeNumericalAttribute, I did not find any mention of "triggering_status". I decided to check by myself with the code below. I expected that the two rules c1 ( the one in commentary and the actual one) would do the exact same thing, as all of my nodes have an age between 0 and 100. Yet, when you run this code with a condition and the other, you get the graphs shown below. vm=MultiPlot() g = nx.erdos_renyi_graph(1000,0.001)
# Setting edge attribute attr = {n: {"Age": random.choice(range(0, 100))} for n in g.nodes()} nx.set_node_attributes(g, attr)
# Composite Model instantiation model = gc.CompositeModel(g)
# Model statuses model.add_status("Susceptible") model.add_status("Infected") model.add_status("Removed")
Thus, I wonder if the parameter "triggering_status" actually is implemented in NodeNumericalAttribute ? By the way, I think the issue is the same for NodeNumericalVariable.
I really hope the answer to the question is not obvious and I thank you by advance for your help.
Have a good day,
Justin
The text was updated successfully, but these errors were encountered:
Hello !
Just to give a quick update, I created a new class NodeNumericalAttribute where a triggering state is taken into account and it seems to work pretty well. There may be a more correct way to do it but it seems to work pretty well for the moment.
Have a good day,
Justin
Hello !
I'm currently a engineer student and I'm using NdLib for a project. I'm quite new to NdLib so I strongly hope my question/bug report is relevant. In short, I think the class NodeNumericalAttribute has no parameter "triggering_status" as indicated in the documentation.
I'm using Ubuntu 20.04.2, NDLib 5.1.0 and Python 3.8.
I wanted to use NodeNumericalAttribute in order to build a specific epidemic model where you need to test whether to person is vaccinated or not to move from a status to an other. Though, as I looked into the source code of the class NodeNumericalAttribute, I did not find any mention of "triggering_status". I decided to check by myself with the code below. I expected that the two rules c1 ( the one in commentary and the actual one) would do the exact same thing, as all of my nodes have an age between 0 and 100. Yet, when you run this code with a condition and the other, you get the graphs shown below.
vm=MultiPlot()
g = nx.erdos_renyi_graph(1000,0.001)
# Setting edge attribute
attr = {n: {"Age": random.choice(range(0, 100))} for n in g.nodes()}
nx.set_node_attributes(g, attr)
# Composite Model instantiation
model = gc.CompositeModel(g)
# Model statuses
model.add_status("Susceptible")
model.add_status("Infected")
model.add_status("Removed")
# Compartment definition
# c1a = cpm.NodeNumericalAttribute("Age", value=[0, 100], op="IN", probability=1,triggering_status="Infected")
c1b = cpm.NodeStochastic(1,triggering_status="Infected")
c2 = cpm.NodeStochastic(0.01)
# Rule definition
model.add_rule("Susceptible", "Infected", c1b)
model.add_rule("Infected", "Removed", c2)
# Model initial status configuration
config = mc.Configuration()
config.add_model_parameter('fraction_infected', 0.1)
# Simulation execution
model.set_initial_status(config)
iterations = model.iteration_bunch(100)
trends = model.build_trends(iterations)
Thus, I wonder if the parameter "triggering_status" actually is implemented in NodeNumericalAttribute ? By the way, I think the issue is the same for NodeNumericalVariable.
I really hope the answer to the question is not obvious and I thank you by advance for your help.
Have a good day,
Justin
The text was updated successfully, but these errors were encountered: