Skip to main content

Python Bindings for the Seldon Framework

Project description

PySeldonlib

pyseldonlib PySeldonlib is a Python Package for Opinion Dynamics Simulation, an extension of the Seldon Framework. It provides:

  • Tools for the simulation of various Opinion Dynamics Models like the classical DeGroot Model, Deffuant Model, Activity Driven Model, etc.
  • Tools to create, manipulate, and study complex networks which are either randomly generated or provided by the user.
  • A clean and robust interface for conducting the simulations.

Opinion Dynamics

Opinion dynamics is a field of study within the realm of complex systems and sociophysics that explores how opinions, beliefs, and attitudes evolve and spread within social networks. It combines elements of physics, social science, and mathematics to understand the mechanisms driving opinion formation and change under various influences, such as personal convictions, peer pressure, media impact, and societal norms.

Our work contributes to this interdisciplinary field by providing robust tools for simulation and analysis, aiding in the understanding of complex opinion dynamics phenomena Seldon-Code.

DeGroot Model Example

The DeGroot model is a model of social influence. It describes how agents in a network can reach a consensus by updating their opinions based on the opinions of their neighbors. The DeGroot model is a simple model of social influence that has been studied extensively in the literature. It is used to model a wide range of social phenomena, such as the spread of information, the formation of opinions, and the emergence of social norms.

Below is an example of reaching consensus in a network using the DeGroot model. We will create a network of 20 agents with random opinions and random connections between them. We will then conduct the simulation.

Initial Opinions

Initial opinions of the agents in the network in the range of [0,1] are shown below:

Initial Opinions

Final Opinions

Final opinions of the agents in the network after the simulation are shown below:

Final Opinions

We can conclude that the agents have reached a consensus after the simulation.

Reference

Usage

import pyseldonlib

pyseldonlib.run_simulation_from_config_file(config_file_path = '/path/to/config/file')
import pyseldonlib

model = pyseldonlib.DeGroot_Model(max_iterations=1000,
                               convergence_tol=1e-6,
                               rng_seed=120, 
                               other_settings=other_settings)

output_dir_path = str("./output")

model.run(output_dir_path)

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

pyseldonlib-1.0.0.tar.gz (3.2 MB view hashes)

Uploaded Source

Built Distributions

pyseldonlib-1.0.0-cp313-cp313-win_amd64.whl (656.5 kB view hashes)

Uploaded CPython 3.13 Windows x86-64

pyseldonlib-1.0.0-cp313-cp313-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.2+ x86-64

pyseldonlib-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (763.8 kB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

pyseldonlib-1.0.0-cp313-cp313-macosx_12_6_x86_64.whl (539.7 kB view hashes)

Uploaded CPython 3.13 macOS 12.6+ x86-64

pyseldonlib-1.0.0-cp313-cp313-macosx_12_6_arm64.whl (514.5 kB view hashes)

Uploaded CPython 3.13 macOS 12.6+ ARM64

pyseldonlib-1.0.0-cp312-cp312-win_amd64.whl (656.5 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

pyseldonlib-1.0.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

pyseldonlib-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (763.9 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pyseldonlib-1.0.0-cp312-cp312-macosx_12_6_x86_64.whl (539.7 kB view hashes)

Uploaded CPython 3.12 macOS 12.6+ x86-64

pyseldonlib-1.0.0-cp312-cp312-macosx_12_6_arm64.whl (514.5 kB view hashes)

Uploaded CPython 3.12 macOS 12.6+ ARM64

pyseldonlib-1.0.0-cp311-cp311-win_amd64.whl (658.5 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pyseldonlib-1.0.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

pyseldonlib-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (764.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyseldonlib-1.0.0-cp311-cp311-macosx_12_6_x86_64.whl (524.1 kB view hashes)

Uploaded CPython 3.11 macOS 12.6+ x86-64

pyseldonlib-1.0.0-cp311-cp311-macosx_12_6_arm64.whl (499.4 kB view hashes)

Uploaded CPython 3.11 macOS 12.6+ ARM64

pyseldonlib-1.0.0-cp310-cp310-win_amd64.whl (656.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pyseldonlib-1.0.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

pyseldonlib-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (763.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyseldonlib-1.0.0-cp310-cp310-macosx_12_6_x86_64.whl (522.8 kB view hashes)

Uploaded CPython 3.10 macOS 12.6+ x86-64

pyseldonlib-1.0.0-cp310-cp310-macosx_12_6_arm64.whl (498.7 kB view hashes)

Uploaded CPython 3.10 macOS 12.6+ ARM64

pyseldonlib-1.0.0-cp39-cp39-win_amd64.whl (656.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pyseldonlib-1.0.0-cp39-cp39-musllinux_1_2_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

pyseldonlib-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (763.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyseldonlib-1.0.0-cp39-cp39-macosx_12_6_x86_64.whl (522.9 kB view hashes)

Uploaded CPython 3.9 macOS 12.6+ x86-64

pyseldonlib-1.0.0-cp39-cp39-macosx_12_6_arm64.whl (498.7 kB view hashes)

Uploaded CPython 3.9 macOS 12.6+ ARM64

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