akvmodel

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

https://github.com/josecoliveira/akvmodel

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

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

Basic Info
  • Host: GitHub
  • Owner: josecoliveira
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 143 KB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 6
Created about 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

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.

bash pip install akvmodel

Usage

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

```python 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( beliefstate=InitialConfigurations.mildly(10), influencegraph=InfluenceGraphs.faintly(10), updatefunction=UpdateFunctions.confirmationbias, )

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: bash docker build -t akvmodel-test .

Run the image: bash 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

Owner

  • Name: José C. Oliveira
  • Login: josecoliveira
  • Kind: user
  • Location: Duluth, Minnesota, USA
  • Company: University of Minnesota Duluth

MS student in Computer Science at University of Minnesota Duluth. Currently working with formal models for social networks.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: 'josecoliveira/akvmodel: v1.2.3'
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: José C.
    family-names: Oliveira
    email: josecarlosdeoliveirajr@gmail.com
    affiliation: 'University of Minnesota, Duluth'
    orcid: 'https://orcid.org/0009-0000-2266-0032'
  - given-names: Sophia
    family-names: Knight
    email: sophia.knight@gmail.com
    affiliation: 'University of Minnesota, Duluth'
    orcid: 'https://orcid.org/0000-0001-6203-1505'
identifiers:
  - type: doi
    value: 10.5281/zenodo.10695209
  - type: url
    value: 'https://github.com/josecoliveira/akvmodel'
repository-code: 'https://github.com/josecoliveira/akvmodel'
keywords:
  - social networks
  - dynamic quantitative belief
  - opinion change
  - polarization
  - multi-agent systems
license: MIT
commit: 07b08ed57840939bbe13adf261e2560cb258a45d
version: v1.2.3
date-released: '2024-03-04'

GitHub Events

Total
Last Year

Dependencies

pyproject.toml pypi
  • numpy *
.github/workflows/python-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite