Skip to content

Commit b88130a

Browse files
Merge pull request #113 from ContextLab/revision-3
Nature Communications revision 3
2 parents cd47cd6 + 19cc88c commit b88130a

File tree

54 files changed

+153233
-20882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+153233
-20882
lines changed

README.md

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ analyses via [Docker](https://www.docker.com/).
1717

1818
## Table of Contents
1919

20-
- [Repo Organization](#repo-organization)
21-
- [Installing Docker](#installing-docker)
22-
- [Running the Analyses](#running-the-analyses)
23-
- [Option 1: `launch_notebooks.sh`](#option-1-launch_notebookssh)
24-
- [Option 2: Manual setup](#option-2-manual-setup)
25-
- [Additional info](#additional-info)
26-
- [Running the Experiment](#running-the-experiment)
27-
- [Useful docs](#useful-docs)
20+
- [Text embedding models yield high-resolution insights into conceptual knowledge from short multiple-choice quizzes](#text-embedding-models-yield-high-resolution-insights-into-conceptual-knowledge-from-short-multiple-choice-quizzes)
21+
- [Table of Contents](#table-of-contents)
22+
- [Repo Organization](#repo-organization)
23+
- [Installing Docker](#installing-docker)
24+
- [Running the Analyses](#running-the-analyses)
25+
- [Option 1: `launch_notebooks.sh`](#option-1-launch_notebookssh)
26+
- [Option 2: Manual setup](#option-2-manual-setup)
27+
- [Additional information](#additional-information)
28+
- [Running the Experiment](#running-the-experiment)
29+
- [Useful additional documentation](#useful-additional-documentation)
2830

2931

3032
## Repo Organization
@@ -35,7 +37,7 @@ The repository is organized as follows:
3537
.
3638
├── code : all analysis code used in the paper
3739
│ ├─ notebooks : Jupyter notebooks for running analyses
38-
│ └─── khan_helpers : Python package with helper code for analyses
40+
│ └─ khan_helpers : Python package with helper code for analyses
3941
├── data : all data analyzed in the paper
4042
│ ├── embeddings : 2D UMAP embeddings for knowledge maps
4143
│ ├── models : trained models
@@ -91,7 +93,7 @@ The script will:
9193
2. Build the image from [`Dockerfile-analyses`](docker/Dockerfile-analyses), if
9294
it doesn't already exist
9395
3. Create and run a container from the image, if one doesn't already exist
94-
4. Launch a [Jupyter notebook](https://jupyter.org/) server inside the
96+
4. Launch a [Jupyter notebook](https://jupyter.org/) server inside the
9597
container, if one isn't already running
9698
5. Open the notebook app in your default browser
9799
6. Attach stdout to the notebook server logs in the container
@@ -129,10 +131,10 @@ analysis environment following the steps below
129131

130132
### Option 2: Manual setup
131133

132-
1. After [installing Docker](#installing-docker), launch the desktop app or
134+
1. After [installing Docker](#installing-docker), launch the desktop app or
133135
start the daemon from the command line.
134-
2. _From the repository's root directory_, build the "`khan`" image from the
135-
[Dockerfile-analyses](docker/Dockerfile-analyses) file in the
136+
2. _From the repository's root directory_, build the "`khan`" image from the
137+
[Dockerfile-analyses](docker/Dockerfile-analyses) file in the
136138
[docker](docker) directory:
137139

138140
```sh
@@ -145,17 +147,17 @@ analysis environment following the steps below
145147
docker run -it -p 8888:8888 --name Khan -v $PWD:/mnt khan
146148
```
147149

148-
The command above binds port 8888 in the continer to port 8888 on the host so
149-
we can access the Jupyter notebook server from a web browser, and bind-mounts
150-
the repository to the container's `/mnt` directory so we can read and write
150+
The command above binds port 8888 in the continer to port 8888 on the host so
151+
we can access the Jupyter notebook server from a web browser, and bind-mounts
152+
the repository to the container's `/mnt` directory so we can read and write
151153
files from inside it.
152154

153-
4. The notebook server will launch automatically when the container is run. Copy
154-
and paste the 3rd link that appears (the one starting with
155+
4. The notebook server will launch automatically when the container is run. Copy
156+
and paste the 3rd link that appears (the one starting with
155157
`http://127.0.0.1:8888`) into a web browser to access the notebook app.
156158

157-
5. You can then open any notebook in [`code/notebooks/`](code/notebooks) and
158-
run the code inside it. When finished, return to the terminal and press
159+
5. You can then open any notebook in [`code/notebooks/`](code/notebooks) and
160+
run the code inside it. When finished, return to the terminal and press
159161
**Control+c** to stop the notebook server and exit the container.
160162

161163
6. To launch the container and notebooks any time after this initial setup, run:
@@ -167,38 +169,38 @@ analysis environment following the steps below
167169

168170
### Additional information
169171

170-
- You can launch an interactive `bash` shell inside the container to explore or
171-
modify its contents with `docker exec -it Khan bash`. To exit the container,
172+
- You can launch an interactive `bash` shell inside the container to explore or
173+
modify its contents with `docker exec -it Khan bash`. To exit the container,
172174
either press **Control+d** or type `exit`. **Note** that:
173-
- if the container isn't already running, you must start it first with
175+
- if the container isn't already running, you must start it first with
174176
`docker start Khan`
175-
- When you enter the container this way (rather than with `docker attach` or
176-
the [`launch_notebooks.sh`](launch_notebooks.sh) script), the container
177-
isn't automatically stopped when you exit it. To stop the container after
177+
- When you enter the container this way (rather than with `docker attach` or
178+
the [`launch_notebooks.sh`](launch_notebooks.sh) script), the container
179+
isn't automatically stopped when you exit it. To stop the container after
178180
exiting, use `docker stop Khan`
179-
- You can get the URL of the running notebook server from inside the container
181+
- You can get the URL of the running notebook server from inside the container
180182
with `jupyter notebook list`
181-
- The container pre-installs some nifty
182-
[extensions](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/index.html)
183-
for customizing the Jupyter Notebook interface. If you want to enable any of
183+
- The container pre-installs some nifty
184+
[extensions](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/index.html)
185+
for customizing the Jupyter Notebook interface. If you want to enable any of
184186
them:
185187
- Open the notebook application in a browser and click on the "**Nbextensions**" tab. (To
186188
launch the notebook application, start the notebook server as described above and visit
187189
the server's address in your web browser.)
188-
- Uncheck the "_disable configuration for nbextensions without explicit
189-
compatibility ..._" box (nearly all of them _are_ compatible, we're just
190+
- Uncheck the "_disable configuration for nbextensions without explicit
191+
compatibility ..._" box (nearly all of them _are_ compatible, we're just
190192
using a newer version of Jupyter notebooks).
191-
- Click on any of the listed extensions to see a description and further
193+
- Click on any of the listed extensions to see a description and further
192194
options, and check the box next to its name to enable it.
193195
- Refresh any running notebooks for changes to take effect.
194196

195197

196198
## Running the Experiment
197199

198-
1. After [installing Docker](#installing-docker), launch the desktop app or
200+
1. After [installing Docker](#installing-docker), launch the desktop app or
199201
start the daemon from the command line.
200-
2. _From the repository's root directory_, build the "`khan-exp`" image from the
201-
[Dockerfile-experiment](docker/Dockerfile-experiment) file in the
202+
2. _From the repository's root directory_, build the "`khan-exp`" image from the
203+
[Dockerfile-experiment](docker/Dockerfile-experiment) file in the
202204
[docker](docker) directory:
203205

204206
```sh
@@ -211,26 +213,26 @@ analysis environment following the steps below
211213
docker run -it -p 22363:22363 -v "$PWD/exp:/exp" --name Khan-exp khan-exp
212214
```
213215

214-
The command above bind-mounts the container to the repository's [`exp/`](exp)
215-
directory so the psiTurk server can read and run the experiment code, and
216-
binds port 22363 between the container and host so the server can be accessed
216+
The command above bind-mounts the container to the repository's [`exp/`](exp)
217+
directory so the psiTurk server can read and run the experiment code, and
218+
binds port 22363 between the container and host so the server can be accessed
217219
from a web browser.
218220

219-
**Note**: the port published by the container must match the port listed in
221+
**Note**: the port published by the container must match the port listed in
220222
[`exp/config.txt`](exp/config.txt).
221223

222-
4. Your shell prompt (`$PS1`) should now start with `root@`, indicating that
223-
you're now running a `bash` shell from _inside_ the container. To start the
224+
4. Your shell prompt (`$PS1`) should now start with `root@`, indicating that
225+
you're now running a `bash` shell from _inside_ the container. To start the
224226
psiTurk experiment server, run:
225227

226228
```sh
227229
psiturk server on
228230
```
229231

230-
When you see "_`Now serving on http://0.0.0.0:22363`_," the experiment server
231-
is ready. Starting the server for the first time will also create
232-
`exp/server.log`, a logfile for the experiment server, and
233-
`exp/efficient-learning-khan.db`, a SQLite database to hold raw experiment
232+
When you see "_`Now serving on http://0.0.0.0:22363`_," the experiment server
233+
is ready. Starting the server for the first time will also create
234+
`exp/server.log`, a logfile for the experiment server, and
235+
`exp/efficient-learning-khan.db`, a SQLite database to hold raw experiment
234236
data.
235237

236238
5. Generate a link to the experiment in "debug mode":
@@ -239,18 +241,18 @@ analysis environment following the steps below
239241
psiturk debug -p
240242
```
241243

242-
This will output a URL in the format
243-
`http://0.0.0.0:22363/ad?assignmentId=debug<XXXXXX>&hitId=debug<YYYYYY>&workerId=debug<ZZZZZZ>&mode=debug`,
244-
where `<XXXXXX>` and `<ZZZZZZ>` will form a unique identifier for the run
245-
(i.e., a participant's unique ID). In debug mode, the experiment will behave
246-
normally and data will still be saved properly, but psiTurk will not try to
247-
connect to [Amazon Mechanical Turk](https://www.mturk.com/)'s servers. This
248-
is useful because it enables the experiment to be run locally without the
244+
This will output a URL in the format
245+
`http://0.0.0.0:22363/ad?assignmentId=debug<XXXXXX>&hitId=debug<YYYYYY>&workerId=debug<ZZZZZZ>&mode=debug`,
246+
where `<XXXXXX>` and `<ZZZZZZ>` will form a unique identifier for the run
247+
(i.e., a participant's unique ID). In debug mode, the experiment will behave
248+
normally and data will still be saved properly, but psiTurk will not try to
249+
connect to [Amazon Mechanical Turk](https://www.mturk.com/)'s servers. This
250+
is useful because it enables the experiment to be run locally without the
249251
user having to create AWS & MTurk accounts, supply access keys, etc.
250252

251-
6. Copy and paste the URL into a web browser, and follow the on-screen
252-
instructions to progress through the experiment. **Note**: the experiment
253-
will not work in Google Chrome. Recommended browsers include Safari and
253+
6. Copy and paste the URL into a web browser, and follow the on-screen
254+
instructions to progress through the experiment. **Note**: the experiment
255+
will not work in Google Chrome. Recommended browsers include Safari and
254256
Firefox.
255257

256258
7. When finished, return to the terminal and shut down the experiment server:

code/notebooks/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ analyses are described or figures appear in the paper.
2020
- `2_topic-word-distributions-fig.ipynb` &ndash; code to generate Supplementary Figure 1
2121
- `3_topic-weight-fig.ipynb` &ndash; code to generate Supplementary Figure 2 and compute related stats
2222
- `4_lecture-question-correlation-peaks.ipynb` &ndash; code to generate Supplementary Figures 3 & 4
23-
- `5_model-comparison-word-overlap.ipynb` &ndash; code to generate Supplementary Figure 5
24-
- `6_model-comparison-BERT.ipynb` &ndash; code to generate Supplementary Figure 6
25-
- `7_individual-maps.ipynb` &ndash; code to generate Supplementary Figures 7&ndash;11
23+
- `5_individual-maps.ipynb` &ndash; code to generate Supplementary Figures 5&ndash;9
24+
- `6_model-comparison-BERT.ipynb` &ndash; code to generate Supplementary Figure 10
25+
- `7_model-comparison-word-overlap.ipynb` &ndash; code to generate Supplementary Figure 11

0 commit comments

Comments
 (0)