Opinion Evolution

The Opinion Evolution plot shows the node-wise opinion evolution in a continuous states model.

class ndlib.viz.mpl.OpinionEvolution.OpinionEvolution(model, trends)
OpinionEvolution.__init__(model, trends)
  • model – The model object
  • trends – The computed simulation trends

Generates the plot

  • filename – Output filename
  • percentile – The percentile for the trend variance area

Below is shown an example of Opinion Evolution description and visualization for the Algorithmic Bias model.

import networkx as nx
import ndlib.models.ModelConfig as mc
import ndlib.models.opinions as op
from ndlib.viz.mpl.OpinionEvolution import OpinionEvolution

# mMean field scenario
g = nx.complete_graph(100)

# Algorithmic Bias model
model = op.AlgorithmicBiasModel(g)

# Model configuration
config = mc.Configuration()
config.add_model_parameter("epsilon", 0.32)
config.add_model_parameter("gamma", 0)

# Simulation execution
iterations = model.iteration_bunch(100)

viz = OpinionEvolution(model, iterations)
Algorithmic Bias Opinion Evolution Example

SIR Diffusion Trend Example.