influence-model

A Python implementation of the influence model, a generative model that describes the interactions between networked Markov chains

https://github.com/keelerh/influence-model

Science Score: 57.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 1 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.4%) to scientific vocabulary

Keywords

generative-model influence-models markov-chain python
Last synced: 6 months ago · JSON representation ·

Repository

A Python implementation of the influence model, a generative model that describes the interactions between networked Markov chains

Basic Info
  • Host: GitHub
  • Owner: keelerh
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 12.7 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
generative-model influence-models markov-chain python
Created over 2 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

influence-model

influence_model is a Python implementation of the influence model, a generative model that describes the interactions between networked Markov chains.

Why influencemodel_? It provides an efficient and well-documented implementation of Asavathiratham's original influence model and supports defining new influence models as well as generating observations by applying the model's evolution equations.

Installation: Install influence-model by:

pip install influence-model

Example Usage: We define two sites (nodes) in the network, a leader and a follower. The follower always copies the behavior of the leader. Both sites have two possible statuses, 0 or 1, represented by indicator vectors. We also define a network matrix $D$ and a state-transition matrix $A$ to instantiate the influence model.

```python import numpy as np

from influencemodel.influencemodel import InfluenceModel from influence_model.site import Site

leader = Site('leader', np.array([[1], [0]])) follower = Site('follower', np.array([[0], [1]])) D = np.array([ [1, 0], [1, 0], ]) A = np.array([ [.5, .5, 1., 0.], [.5, .5, 0., 1.], [.5, .5, .5, .5], [.5, .5, .5, .5], ]) model = InfluenceModel([leader, follower], D, A) initialstate = model.getstatevector() print(initialstate) ```

The initial state of the network is a vector stack of the initial statuses of the two sites.

python [[1] [0] [0] [1]]

Next, we apply the evolution equations of the influence model to progress to the next network state.

python next(model) next_state = model.get_state_vector() print(next_state)

We see that the follower has adopted the previous status of the leader.

python [[0] [1] [1] [0]]

This following behavior continues through all subsequent iterations.

Acknowledgements: If you find this library helpful to your work, please cite the following paper:

@article{Erhardt_Hidden_Messages_Mapping_2023, author = {Erhardt, Keeley and Pentland, Alex}, doi = {10.0000/00000}, journal = {Computational and Mathematical Organization Theory}, month = sep, number = {3}, pages = {1--10}, title = {{Hidden Messages: Mapping Nations’ Media Campaigns}}, volume = {29}, year = {2023} }

Owner

  • Name: Keeley Erhardt
  • Login: keelerh
  • Kind: user
  • Location: Cambridge, MA
  • Company: MIT

PhD student at MIT Media Lab @HumanDynamics

Citation (CITATION.cff)

cff-version: 1.2.0
title: influence-model
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Keeley
    family-names: Erhardt
    email: keeley@mit.edu
    affiliation: MIT Media Lab
    orcid: 'https://orcid.org/0000-0002-1341-5569'
repository-code: 'https://github.com/keelerh/influence-model'
abstract: >-
  A Python implementation of the influence model, a
  generative model that describes the interactions between
  networked Markov chains
keywords:
  - python
  - markov-chain
  - generative-model
  - influence-models
license: MIT
version: 0.1.0
date-released: '2023-08-01'
preferred-citation:
  type: article
  authors:
  - family-names: "Erhardt"
    given-names: "Keeley"
    orcid: "https://orcid.org/0000-0002-1341-5569"
  - family-names: "Pentland"
    given-names: "Alex"
    orcid: "https://orcid.org/0000-0002-8053-9983"
  doi: "10.0000/00000"
  journal: "Computational and Mathematical Organization Theory"
  month: 9
  start: 1
  end: 10
  title: "Hidden Messages: Mapping Nations’ Media Campaigns"
  issue: 3
  volume: 29
  year: 2023
  

GitHub Events

Total
Last Year

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 10 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: influence-model

A Python implementation of the influence model, a generative model that describes the interactions between networked Markov chains

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 10 Last month
Rankings
Dependent packages count: 6.6%
Average: 26.7%
Forks count: 30.5%
Dependent repos count: 30.6%
Stargazers count: 39.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

pyproject.toml pypi