Skip to content

albarsil/affective-dynamics-model-experiments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Continuous-Time Dynamical Model of Dyadic Affective Interaction: Bistability, Memory, and Negativity Dominance Under Cognitive Saturation

Online supplement for A Continuous-Time Dynamical Model of Dyadic Affective Interaction: Bistability, Memory, and Negativity Dominance Under Cognitive Saturation.

This repository holds the Julia experiment campaign (six model families, full theorem verification) and the Python analysis/plotting scripts that produced the paper's figures.

Project Structure

.
├── Project.toml             # Root environment marker (no deps)
├── src/                      # Julia: ADMExperiments.jl package
│   ├── ADMExperiments.jl     # Package entry point (includes all submodules)
│   ├── Project.toml          # Julia deps (DifferentialEquations, DynamicalSystems, etc.)
│   ├── core/                 # dimensions, physics, system composition, sampling
│   ├── models/                # Six model families: atomic, kuramoto, hierarchical,
│   │                           distance, multicapital, flat
│   ├── metrics/                # Theorem verification + dynamical systems diagnostics
│   │   └── README.md          # Full reference: every metric, formula, and paper theorem it verifies
│   ├── run.jl                  # Main experiment runner (single-pass, all metrics)
│   ├── runner.jl                # Core run loop used by run.jl
│   └── run_*.jl                  # Targeted runs (hysteresis, robustness, solver comparison, etc.)
├── python/
│   ├── analysis/              # Notebooks + scripts (equilibrium, hysteresis, power-law fits,
│   │                            robustness/sensitivity figure export)
│   ├── scripts/                # parameter_recovery.py, results_to_csv.py
│   └── pyproject.toml          # Python deps (uv-managed): numpy, scipy, matplotlib, pandas, seaborn, jupyter
└── results/                    # JSON experiment configs and outputs
    ├── experiments.json        # Full experiment configuration (all families/dimensions)
    ├── experiments-subset.json
    └── experiments_top10.json

Model Families

Six architectural families are tested, each composing the core 2D valence system (a, b) with optional dimensions (memory weights, capital, spatial distance, oscillator phase): atomic, kuramoto, hierarchical, distance, multicapital, flat. State-space dimensionality ranges from 3D to 13D across the full configuration matrix (13,923 configurations).

Commands

Julia experiment runner

cd src
julia --project=. -e 'using Pkg; Pkg.instantiate()'   # one-time setup

# Standard metrics (full campaign)
julia --threads=auto --project=. run.jl --json=../results/experiments.json

# Single family only
julia --threads=auto --project=. run.jl --json=../results/experiments.json --family=atomic

# Paper theorem verification instead of standard metrics
julia --threads=auto --project=. run.jl --json=../results/experiments.json --verify

# Resume into an existing output directory
julia --threads=auto --project=. run.jl --json=../results/experiments.json --output-dir=../results-18-06-2026-12-00

Output is written to a timestamped results-<dd-mm-yyyy-HH-MM>/ directory at the repo root.

Python analysis and plotting

cd python
uv sync                                              # restore pinned environment (uv.lock)

uv run jupyter notebook analysis/analysis.ipynb
uv run python analysis/export_robustness_figures.py
uv run python analysis/export_sensitivity_figures.py
uv run python analysis/phase1_equilibrium.py
uv run python analysis/phase1_hysteresis.py
uv run python analysis/phase1_powerlaw.py

uv run python scripts/parameter_recovery.py
uv run python scripts/results_to_csv.py

Reproducing Results

Environment

  • Python: managed by uv. python/uv.lock pins exact versions; uv sync from python/ reproduces the environment.
  • Julia: pinned via src/Manifest.toml (deps declared in src/Project.toml). Run julia --project=. -e 'using Pkg; Pkg.instantiate()' from src/ to restore the exact package state.

Random seeds

Stochastic experiments (noise resilience, basin sampling, Monte Carlo vulnerability) use a fixed seed of 42 by default, set in src/runner.jl. The --seed flag on targeted scripts (e.g., run_joint_robustness.jl) also defaults to 42.

Theorem verification

src/metrics/README.md is the authoritative reference for every verification metric: the formal claim it checks, the mathematical formulation, pass/fail criteria, and which paper theorem or proposition it corresponds to. Use it alongside run.jl --verify to reproduce the theorem-by-theorem validation reported in the paper's appendix.

Requirements

  • Julia: 1.10+ (developed against 1.12.6), with deps in src/Project.toml (DifferentialEquations.jl, DynamicalSystems.jl, ForwardDiff.jl, JSON3.jl, Optim.jl, StaticArrays.jl, StochasticDiffEq.jl, ArgParse.jl)
  • Python: 3.11+, managed via uv (see python/pyproject.toml)

About

Online supplement for the paper: A Continuous-Time Dynamical Model of Dyadic Affective Interaction: Bistability, Memory, and Negativity Dominance Under Cognitive Saturation

Topics

Resources

License

Stars

Watchers

Forks

Contributors