Code and data to reproduce simulation results from the paper, "Computational principles underlying the evolution of cultural learning mechanisms", presented at CogSci 2023.
- Figures (.eps and .png versions) can be found in
plots/
. - Underlying data from the figures can be found in
data/
. - Simulation results from the paper (generated using default settings) can be downloaded from this link.
create_charts.R
generates the figures used in the paper. It requires that analyzed simulation data is present indata/
, and it outputs figures toplots/
.data_cleaning.ipynb
contains functionality to clean and analyze simulation results. It requires simulation results insims/
orsims_gn/
and it saves prepared simulation data todata/
.run_simulation_gn.py
launches the Model 1 simulation. It can be used from the command line. Documentation is below.run_simulation.py
generates the Model 2 simulation from the command line, as below.theme_mprl_ggplot.R
contains aggplot
theme for recreating figures.
- Ensure you are using
python >= 3.11.1
and that you have cloned the git repo into the appropriate folder. This may, but is not guaranteed to, work with earlier python versions. - Install requirements using
pip install --upgrade pip
pip install -r requirements.txt
- Launch the simulation by typing
python run_simulation.py
orpython run_simulation_gn.py
(this takes a while!).
Note: The simulation scripts take the following arguments:
--path
: The path to save simulation results (defaults tosims/
orsims_gn/
depending on the script)--size
: Initial population size (default120
)--gens
: Number of generations to simulate (default5000
)--lo
: Lower bound of parameter space (default0.0
)--hi
: Upper bound of parameter space (default1.0
)--ns
: Number of steps; how many values to interpolate betweenlo
andhi
(default11
)--seed
: Random number generator seed (default42
)--ncores
: Number of CPU cores to use (defaults to a single core, which is extremely slow. Suggest using a multiple ofns
)--params_path
: Optional argument containing a .csv file with the parameters to run in columns namedDelta
,Lambda
, andKappa
. If used, this overrideslo
,hi
, andns
. This will throw an error if the file is not a .csv formatted correctly.
Please create an issue here or email the corresponding author (Xavier Roberts-Gaal) if you have any questions.