You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Using Sequences of Life-events to Predict Human Lives
2
+
3
+
This repository contains code for the [Using Sequences of Life-events to Predict Human Lives](https://doi.org/10.21203/rs.3.rs-2975478/v1)
2
4
3
-
This repository contains scripts and several notebooks for the data processing, life2vec training, statistical analysis, and visualization. The model weights, experiment logs, and associated model outputs can be obtained in accordance with the rules of [Statistics Denmark's Research Scheme](https://www.dst.dk/en/TilSalg/Forskningsservice/Dataadgang).
5
+
### Source Code
4
6
5
-
Paths (e.g. to data, or model weights) were **redacted** before submitting scripts to the CodeOcean platform.
7
+
This repository contains scripts and several notebooks for data processing, life2vec training, statistical analysis, and visualization. The model weights, experiment logs, and associated model outputs can be obtained in accordance with the rules of [Statistics Denmark's Research Scheme](https://www.dst.dk/en/TilSalg/Forskningsservice/Dataadgang).
6
8
9
+
Paths (e.g., to data, or model weights) were **redacted** before submitting scripts to GitHub.
7
10
8
11
### Overall Structure
9
12
10
-
We use [Hydra](https://hydra.cc/docs/intro/) to run the experiments. The `/conf` folder contain configs for the experiments:
13
+
We use [Hydra](https://hydra.cc/docs/intro/) to run the experiments. The `/conf` folder contains configs for the experiments:
11
14
1.`/experiment` contains configuration `yaml` for pretraining and finetuning,
12
-
2.`/tasks` contain the specification for data augmentation in MLM, SOP, CLS etc.,
15
+
2.`/tasks` contain the specification for data augmentation in MLM, SOP, etc.,
13
16
3.`/trainer` contains configuration for logging (not used) and multithread training (not used),
14
17
4.`/data_new` contains configs for data loading and processing,
15
18
5.`/datamodule` contains configs that specify how data should be loaded to PyTorch and PyTorch Lightning
16
-
6.`callbacks.yaml` specifies configuration for the PyTorch Lightning Callbacks ,
19
+
6.`callbacks.yaml` specifies the configuration for the PyTorch Lightning Callbacks ,
17
20
7.`prepare_data.yaml` can be used to run data preprocessing.
18
21
19
22
The `/analysis` folder contains `ipynb` notebooks for post-hoc evaluation:
20
23
1.`/embedding` contains the analysis of the embedding spaces,
21
-
2.`/metric`containt notebooks for the model evaluation
24
+
2.`/metric`contains notebooks for the model evaluation
22
25
3.`/visualisation` contains notebooks for the visualisation of spaces.
23
26
24
-
The source folder, `/src`, contains the codes related to the data loading and model training. Due to specifics of the `hydra` package, this folder includes have TCAV implementation (in `/src/analysis/tcav`) and hyperparameter tuning (in `/src/analysis/hyperparameter`). Here is the overview of the `/src` folder:
27
+
The source folder, `/src`, contains the data loading and model training codes. Due to the specifics of the `hydra` package, this folder includes TCAV implementation (in `/src/analysis/tcav`) and hyperparameter tuning (in `/src/analysis/hyperparameter`). Here is the overview of the `/src` folder:
25
28
1. The `/src/data_new` contains scripts to preprocess data as well as prepare data to load into the PyTorch or PyTorch Lightning,
26
29
2. The `/src/models` contains the implementation of baseline models,
27
-
3. The `/src/tasks` include code specific to the particular task, aka MLM, SOP, Mortality Prediction, Emigration Prediction etc.
30
+
3. The `/src/tasks` include code specific to the particular task, aka MLM, SOP, Mortality Prediction, Emigration Prediction, etc.
28
31
4.`/src/tranformer` contains the implementation of the life2vec model:
29
32
1. In `performer.py`, we overwrite the functionality of the `performer-pytorch` package,
30
-
2. In `cls_model.py`, we have implementation of the finetuning stage (aka life2vec for personality, mortality, emigration),
33
+
2. In `cls_model.py`, we have an implementation of the finetuning stage (aka life2vec for personality, mortality, emigration),
31
34
3.`models.py` contains the code for the life2vec pretraining (aka the base life2vec model),
32
-
4. The `transformer_utils.py` contains the implementation of custom modules, like losses, ac tivation functions etc.
35
+
4. The `transformer_utils.py` contains the implementation of custom modules, like losses, activation functions, etc.
33
36
5. The `metrics.py` contains code for the custom metric,
34
-
6. The `modules.py`, `attention.py`, `att_utils.py`, `embeddings.py` contain the implementation of modules used in the transformer-network (aka life2vec encoders).
37
+
6. The `modules.py`, `attention.py`, `att_utils.py`, and `embeddings.py` contain the implementation of modules used in the transformernetwork (aka life2vec encoders).
35
38
36
-
Scripts such as `train.py`, `test.py`, `tune.py`, `val.py` used to run a particular stage of the training; while `prepare_data.py` used to run the data processing (see below the example).
39
+
Scripts such as `train.py`, `test.py`, `tune.py`, and `val.py` used to run a particular stage of the training, while `prepare_data.py` was used to run the data processing (see below the example).
37
40
38
41
39
42
### Run the script
40
-
To run the code you would use the following commands:
43
+
To run the code, you would use the following commands:
title={Using Sequences of Life-events to Predict Human Lives},
68
72
author={Savcisens, Germans and Eliassi-Rad, Tina and Hansen, Lars Kai and Mortensen, Laust and Lilleholt, Lau and Rogers, Anna and Zettler, Ingo and Lehmann, Sune},
0 commit comments