| title | spatial_demonstratives |
|---|---|
| author | Sihan Chen, Richard Futrell, Kyle Mahowald |
| date | July 6 2023 |
-
figures: all the figures in the paper (Figures 1-8) -
sheets: all data files generated by the scripts -
readable_data_tables: all the spatial deictic demonstratives complied by Nintemann et al. (2020), as spreadsheets -
deictic_appendix_docs: the original appendix in Nintemann et al. (2020)
Fit_gamma_new.ipynb: the main file. It executesrun_ib.pyto perform the relevent calculation and generates the data files.
-
run_ib_new.py: the Python script for calculating the informativity and complexity of real lexicons and all possible lexicons, given a number of distal levels, decay parameter$\mu$ , and place/goal/source coordinates -
ib.py: the Python script for the Information Bottleneck (IB) method in general -
stirling.py: the Python script for calculating the Stirling number of the second kind, given 2 parameters$(n, k)$ . Code credit to EXTR3ME. -
get_prior.py: the Python script for interpolating the prior / need probability$p(m)$ from the Finnish corpus -
get_lang_data.py: the Python script for processing the data from Nintemann et al. (2020) -
enumerate_lexicons.py: the Python script for generating all possible lexicons
-
Plot Figures.Rmd: the R script for generating the main figures (Experiments 1 and 3) -
Plot Grid Search.Rmd: the R script for analyzing the grid search data (Experiment 2) -
plot maps.Rmd: the R script for plotting the maps (Figure 4) -
Plot Figures_merge_d1d2.Rmd: the R script for the analysis in Appendix E
- Launch
Fit_gamma.ipynb. Parameters in the model are:
-
logsp: the trade-off parameter array. The default settingnp.logspace(3,0, num = 2000)generates 2000 log-spaced tradeoff parameters$\beta$ from 1000 to 1. -
mu: the decay parameter. The default is 0.2. -
num_dists: the number of distal levels. The default is 3. -
pgs_dists: the coordinates of place/goal/source. The default is [0, 0.789, -1.315]The script will generate 4 files, saved in the
sheetsfolder: -
2 data files for real lexicons and all possible lexicons, respectively.
- File 1: a data file for real lexicons, syntax:
real_lexicons_fit_mu_<mu value>_pgs_<pgs values>num_dists_<number of distal levels>.csv(the default name isreal_lexicons_fit_mu_0.2_pgs_0_0.789_-1.315num_dists_3.csv) - File 2: a data file for all possible lexicons, syntax:
sim_lexicons_fit_mu_<mu value>_pgs_<pgs values>num_dists_<number of distal levels>.csv(the default name issim_lexicons_fit_mu_0.2_pgs_0_0.789_-1.315num_dists_3.csv)
- File 1: a data file for real lexicons, syntax:
-
2 files for the deterministic and non-deterministic optimal frontier, respectively.
- 1 data file for the deterministic optimal frontier, syntax:
ib_curve_deter_mu_<mu value>_pgs_<pgs values>num_dists_<number of distal levels>.csv - 1 data file for the non-deterministic optimal frontier, syntax:
ib_curve_non_deter_mu_<mu value>_pgs_<pgs values>num_dists_<number of distal levels>.csv
- 1 data file for the deterministic optimal frontier, syntax:
- Open and run the
plot_figs.Rmdscript. Figures will be generated in thefiguresfolder.
- Open a terminal on the repo, run the lines below, assuming you're following the default condition.
- Place/goal/source coordinate search: Run the code below (warning: this might take a day to execute. We recommend skipping this step and using our output file.). This will generate a file called
total_grid_search_gridsearch.csvin thesheetsfolder.
- Place/goal/source coordinate search: Run the code below (warning: this might take a day to execute. We recommend skipping this step and using our output file.). This will generate a file called
python run_ib.py --total_search --outfile sheets/total_grid_search
- Prior search: Run the code below. This will generate a file called ``prior_search_gridsearch.csv`` in the ``sheets`` folder.
python run_ib.py --prior_search --outfile sheets/prior_search
- Mu search: Run the code below. This will generate a file called ``mu_search_gridsearch.csv`` in the ``sheets`` folder.
python run_ib.py --mu_search --outfile sheets/mu_search
- Open and run the
Plot Grid Search.Rmdscript. Figures will be generated in thefiguresfolder.