Skip to main content

A tool for social network simulations in the Alvim-Knight-Valencia model.

Project description

akvmodel: A Python Tool for Social Network Simulations in the Alvim-Knight-Valencia Model

DOI

Formal models for social networks aim to capture the crucial aspects of the evolution of agents' beliefs over time, as communication occurs in a network. The Alvim-Knight-Valencia (AKV) social network model (2019) works on the dynamics of belief updates using a quantitative spectrum of belief values, and an influence graph representing the relationships between agents. Previous work on the AKV model developed belief update functions representing a range of belief update methods.

This package implements the AKV model and a catalog of its belief updates, initial configurations, and update functions from the literature, creating a general tool that incorporates a wide range of possible approaches to belief updates. In addition, we allow the AKV model to have multiple outcomes (or truth values) for the proposition used in the model. This tool facilitates future research using the AKV model without the need to reimplement it also allowing its reproducibility.

Installation

Use the package manager pip to install akvmodel.

pip install akvmodel

Usage

The full reference of the package can be found in DOCUMENTATION.md.

import numpy as np
from akvmodel import *

# Create model with 10 agents, mildly polarized initial configuration, faintly communicating influence graph, and confirmation bias belief update.
akvmodel = AKV(
    belief_state=InitialConfigurations.mildly(10),
    influence_graph=InfluenceGraphs.faintly(10),
    update_function=UpdateFunctions.confirmation_bias,
)

# Update the model 100 times
for _ in range(100):
    akvmodel.update()

# Get polarization
p = akvmodel.get_polarization()

# Plot polarization evolution for the first outcome in the domain
plt.plot(p[0])

Full example can be found in the Jupyter Notebook example.ipynb.

Trying the package with Docker

This project includes a Dockerfile that builds an image with Jupyter Notebook and necessary requirements to run the example.

Build the image:

docker build -t akvmodel-test .

Run the image:`

docker run -p 8888:8888 akvmodel-test

Open localhost:8888 on your browser, use the password test and open the file example.ipynb. Changes on example.ipynb will not be saved.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

akvmodel-1.2.2.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

akvmodel-1.2.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file akvmodel-1.2.2.tar.gz.

File metadata

  • Download URL: akvmodel-1.2.2.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for akvmodel-1.2.2.tar.gz
Algorithm Hash digest
SHA256 a8d30bf3087085a97b0d8a8566736675fe2eca5ad1b88a62302e11814ae6c9a2
MD5 b2b8f4696f0e99a8719611a1348c3cc0
BLAKE2b-256 fff05e9b9c164bfa28e0ab67131cbae5eda896c04ec41d7ad8ee396c0bcac2ce

See more details on using hashes here.

File details

Details for the file akvmodel-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: akvmodel-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for akvmodel-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd39dcc7fb65663eb86b072c9d6a8c34ceaa7935bc1f7325f50b544cd05bfc79
MD5 629ac45d7ed1e65f826bd99bc4232e27
BLAKE2b-256 8b15da4cf975944d1dbe27f06fe59668665c02c73c68e01189bdf0202dd98377

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page