DeGroot Model#

The DeGroot Model is a fundamental framework in social influence theory, illustrating how agents in a network update their opinions based on the opinions of their neighbors. At its core, the model posits that each agent revises their opinion by taking the weighted average of their neighbors’ opinions. This iterative process continues until the opinions converge to a consensus or a stable state.

In practical terms, consider a group of individuals—such as a committee or a team—each holding a subjective probability distribution for an unknown parameter. The DeGroot Model describes how these individuals might converge on a unified subjective probability distribution through iterative opinion updates, effectively pooling their individual insights.

Additionally, the model is versatile and can be applied to scenarios where opinions are represented as point estimates rather than probability distributions. In such cases, the DeGroot Model helps illustrate how a group can achieve consensus on a specific parameter estimate, reflecting the collective judgment of the group.

Key features#

Opinion Averaging:

Agents update their opinions based on the average opinions of their neighbors, fostering convergence and consensus.

Iterative Process:

The model operates through a series of iterations, with opinions being refined each step until stability is achieved.

Consensus Formation:

Applicable to both probability distributions and point estimates, showing how diverse opinions can be aggregated into a common view.

The DeGroot Model provides a clear and elegant approach to understanding how social influence and information sharing lead to collective agreement within a network of agents.

Example:#

>>> from pyseldonlib import DeGroot_Model
>>> # Create the DeGroot Model
>>> model = DeGroot_Model(max_iterations=1000, convergence_tol=1e-6)
>>> # Run the simulation
>>> model.run("output_dir")
>>> # Access the network
>>> network = model.get_Network()
>>> # Access the opinions of the agents
>>> opinions = model.agents_opinions()

Reference:#

[1]

Morris H. Degroot. Reaching a consensus. Journal of the American Statistical Association, 69(345):118–121, 1974. URL: https://www.tandfonline.com/doi/abs/10.1080/01621459.1974.10480137, arXiv:https://www.tandfonline.com/doi/pdf/10.1080/01621459.1974.10480137, doi:10.1080/01621459.1974.10480137.


class pyseldonlib.DeGrootModel.DeGroot_Model(max_iterations: int = None, convergence_tol: float = 1e-06, rng_seed: int | None = None, agent_file: str | None = None, network_file: str | None = None, other_settings: Other_Settings = None)[source]#

Bases: Base_Model

DeGroot Model base class for Simulation.

Parameters:
  • max_iterations (int, default=None) – The maximum number of iterations to run the simulation. If None, the simulation runs infinitely.

  • convergence_tol (float, default=1e-6) – The tolerance for convergence of the simulation.

  • rng_seed (int, default=None) – The seed for the random number generator. If not provided, a random seed is picked.

  • agent_file (str, default=None) – The file to read the agents from. If None, the agents are generated randomly.

  • network_file (str, default=None) – The file to read the network from. If None, the network is generated randomly

  • other_settings (Other_Settings, default=None) – The other settings for the simulation. If None, the default settings are used.

Network#

The network generated by the simulation.

Type:

Network (Object)

Opinion#

The opinions of the agents or nodes of the network.

Type:

Float

see also
Type:

seldoncore.Network

property Network#

Access the network generated by the simulation.

Returns:

The network generated by the simulation.

Return type:

seldoncore.Network

agent_opinion(index: int = None)#

Access the agents data from the simulation.

Parameters:

index (int) – The index of the agent to access. The index is 0-based. If not provided, all agents are returned.

print_settings()#

Print the settings of the simulation.

run(output_dir: str = None)#

Run the simulation.

Parameters:

output_dir (str, default="./output") – The directory to output the files to.

set_agent_opinion(index: int, opinion: float)#

Set the opinion of a specific agent.

Parameters:
  • index (int) – The index of the agent whose opinion is to be set.

  • opinion (float) – The new opinion value for the agent.