Skip to content

ChrisCurrin/opinion_dynamics

Repository files navigation

Depolarisation of opinions

Link to paper

Authors:

Binder Open In Colab


1. Clone repo

Options

  • git clone git@github.com:ChrisCurrin/opinion_dynamics.git
  • git clone https://github.com/ChrisCurrin/opinion_dynamics.git
cd opinion_dynamics

2. Create environment from requirements using conda

conda env create -f environment.yml

conda activate opinion_dynamics

Target Python version: >= 3.6

3. Play around with notebook

jupter notebook opdynamics.ipynb

jupter lab opdynamics.ipynb

4. Run desired scripts

python -m scripts.<script name>

5. Use as a module from the terminal

e.g.

python -m opdynamics --plot=all

Run a simulation with noise with the -D <value> parameter.

python -m opdynamics 1000 10 2 3 -D 0.01 -beta 2 --activity negpowerlaw 2.1 1e-2 -r 0.5 -T 10 --plot summary --save -v

Compare noise parameters by passing multiple values to -D

python -m opdynamics 1000 10 2 3 -D 0.01 0.1 -beta 2 --activity negpowerlaw 2.1 1e-2 -r 0.5 -T 10 --plot summary --save -v

Development

Note that the code is formatted using the black Python module.

Update environment.yml using conda env export --from-history > environment.yml


TODO:

  • Use alternate peak detection alogiorthms
  • Equations:
    • -> 1 other agent versus sample mean of other agents
  • Allow simulation.run_product to be run asyncronously.
  • Create metric for determining whether opinions are polarised or uniform.
  • Add sample_size to SampleChamber.__repr__
  • Test more efficient get_social_interaction
  • Test more efficient get_connection_probabilities
  • Test and plot results for "internal noise".
  • Restrict internal noise to be from an agent of opposite opinion.
  • Implement noise as coming from agent - "internal noise".
    • with sigmoid transformation (tanh):
  • plot vs
    • from
    • from
    • with different values
    • with different values
    • with different values
    • with different values
  • [low priority] Implement other SDE solvers using https://pypi.org/project/diffeqpy/
  • change density activity vs opinion plot to be density per activity
  • Apply noise after time
  • Calculate and