-
Notifications
You must be signed in to change notification settings - Fork 80
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
Memetic Distribution Modeling #219
Comments
Hi, some of them are already integrated (SEIR, SEIS). The others should be quite easy to implement: if you like to implement a few of them we can organize a CustomModels "recipe" section in the docs. |
For the SIZ model in the links the m factor of leaking is not part of it, will need to be added later https://doi.org/10.14419/IJAMS.V2I2.2307 import networkx as nx
import ndlib.models.ModelConfig as mc
import ndlib.models.CompositeModel as gc
import ndlib.models.compartments as cpm
from ndlib.viz.mpl.DiffusionTrend import DiffusionTrend
import matplotlib.pyplot as plt
%matplotlib inline # comment if ran outside a jupyter notebook
# Network generation
g = nx.erdos_renyi_graph(1000, 0.1)
# Composite Model instantiation
model = gc.CompositeModel(g)
# Model statuses
model.add_status("Susceptible")
model.add_status("Infected")
model.add_status("Stifler")
model.add_status("Emigrated")
phi = 0.05
# Compartment definition
alpha_phi = cpm.NodeStochastic(0.02*(1-phi), triggering_status="Infected")
alpha_no_phi = cpm.NodeStochastic(0.02*phi, triggering_status="Infected")
beta = cpm.NodeStochastic(0.01, triggering_status="Stifler")
gamma = cpm.NodeStochastic(0.015)
rho = cpm.NodeStochastic(0.01)
mu = cpm.NodeStochastic(0.01)
# Rule definition
model.add_rule("Susceptible", "Stifler", alpha_phi)
model.add_rule("Susceptible", "Infected", alpha_no_phi)
model.add_rule("Stifler", "Susceptible", rho)
model.add_rule("Infected", "Stifler", beta)
model.add_rule("Infected", "Stifler", gamma)
model.add_rule("Susceptible", "Emigrated", mu)
model.add_rule("Stifler", "Emigrated", mu)
model.add_rule("Infected", "Emigrated", mu)
# 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)
viz = DiffusionTrend(model, trends)
viz.plot() |
For the SCIR model in http://cea.ceaj.org/EN/abstract/abstract33105.shtml import networkx as nx
import ndlib.models.ModelConfig as mc
import ndlib.models.CompositeModel as gc
import ndlib.models.compartments as cpm
from ndlib.viz.mpl.DiffusionTrend import DiffusionTrend
import matplotlib.pyplot as plt
%matplotlib inline # comment if ran outside a jupyter notebook
# Network generation
g = nx.erdos_renyi_graph(1000, 0.1)
# Composite Model instantiation
model = gc.CompositeModel(g)
# Model statuses
model.add_status("Susceptible")
model.add_status("Contacted")
model.add_status("Infected")
model.add_status("Recovered")
# Compartment definition
c1 = cpm.NodeStochastic(0.02, triggering_status="Infected") # S-C
c2 = cpm.NodeStochastic(0.01) # C-I
c3 = cpm.NodeStochastic(0.015) # I-R
c4 = cpm.NodeStochastic(0.01) # S-I
c5 = cpm.NodeStochastic(0.01) # C-R
# Rule definition
model.add_rule("Susceptible", "Contacted", c1)
model.add_rule("Contacted", "Infected", c2)
model.add_rule("Infected", "Recovered", c3)
model.add_rule("Susceptible", "Infected", c4)
model.add_rule("Contacted", "Recovered", c5)
# 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)
viz = DiffusionTrend(model, trends)
viz.plot() |
SIRV model is hard to do https://arxiv.org/pdf/2103.07687.pdf |
@GiulioRossetti some of the items are noted, and I hope that they can be added to documentation. |
There are multiple meme models that can be assessed for information diffusion. I would consider contributing with some sample pieces of code for these models.
The problem with all these models is that they do not factor in competing pieces of information or information mutation.
The text was updated successfully, but these errors were encountered: