lifejacket 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lifejacket-0.1.0/PKG-INFO +100 -0
- lifejacket-0.1.0/README.md +81 -0
- lifejacket-0.1.0/lifejacket/__init__.py +0 -0
- lifejacket-0.1.0/lifejacket/after_study_analysis.py +1845 -0
- lifejacket-0.1.0/lifejacket/arg_threading_helpers.py +354 -0
- lifejacket-0.1.0/lifejacket/calculate_derivatives.py +965 -0
- lifejacket-0.1.0/lifejacket/constants.py +28 -0
- lifejacket-0.1.0/lifejacket/form_adaptive_meat_adjustments_directly.py +333 -0
- lifejacket-0.1.0/lifejacket/get_datum_for_blowup_supervised_learning.py +1312 -0
- lifejacket-0.1.0/lifejacket/helper_functions.py +587 -0
- lifejacket-0.1.0/lifejacket/input_checks.py +1145 -0
- lifejacket-0.1.0/lifejacket/small_sample_corrections.py +125 -0
- lifejacket-0.1.0/lifejacket/trial_conditioning_monitor.py +870 -0
- lifejacket-0.1.0/lifejacket/vmap_helpers.py +71 -0
- lifejacket-0.1.0/lifejacket.egg-info/PKG-INFO +100 -0
- lifejacket-0.1.0/lifejacket.egg-info/SOURCES.txt +20 -0
- lifejacket-0.1.0/lifejacket.egg-info/dependency_links.txt +1 -0
- lifejacket-0.1.0/lifejacket.egg-info/entry_points.txt +2 -0
- lifejacket-0.1.0/lifejacket.egg-info/requires.txt +12 -0
- lifejacket-0.1.0/lifejacket.egg-info/top_level.txt +1 -0
- lifejacket-0.1.0/pyproject.toml +37 -0
- lifejacket-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lifejacket
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A package for after-study analysis of adaptive experiments in which data is pooled across users.
|
|
5
|
+
Author-email: Nowell Closser <nowellclosser@gmail.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: click>=8.0
|
|
9
|
+
Requires-Dist: jax>=0.4.0
|
|
10
|
+
Requires-Dist: jaxlib>=0.4.0
|
|
11
|
+
Requires-Dist: numpy>=1.20.0
|
|
12
|
+
Requires-Dist: pandas>=1.3.0
|
|
13
|
+
Requires-Dist: scipy>=1.7.0
|
|
14
|
+
Requires-Dist: plotext>=5.0.0
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
17
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
18
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
_ _ __ _ _ _
|
|
22
|
+
| (_)/ _| (_) | | | |
|
|
23
|
+
| |_| |_ ___ _ __ _ ___| | _____| |_
|
|
24
|
+
| | | _/ _ \ |/ _` |/ __| |/ / _ \ __|
|
|
25
|
+
| | | || __/ | (_| | (__| < __/ |_
|
|
26
|
+
|_|_|_| \___| |\__,_|\___|_|\_\___|\__|
|
|
27
|
+
_/ |
|
|
28
|
+
|__/
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Save your standard errors from pooling in adaptive experiments.
|
|
32
|
+
|
|
33
|
+
## Setup (if not using conda)
|
|
34
|
+
### Create and activate a virtual environment
|
|
35
|
+
- `python3 -m venv .venv; source /.venv/bin/activate`
|
|
36
|
+
|
|
37
|
+
### Adding a package
|
|
38
|
+
- Add to `requirements.txt` with a specific version or no version if you want the latest stable
|
|
39
|
+
- Run `pip freeze > requirements.txt` to lock the versions of your package and all its subpackages
|
|
40
|
+
|
|
41
|
+
## Running the code
|
|
42
|
+
- `export PYTHONPATH to the absolute path of this repository on your computer
|
|
43
|
+
- `./run_local_synthetic.sh`, which outputs to `simulated_data/` by default. See all the possible flags to be toggled in the script code.
|
|
44
|
+
|
|
45
|
+
## Linting/Formatting
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
python -m pytest
|
|
49
|
+
python -m pytest tests/unit_tests
|
|
50
|
+
python -m pytest tests/integration_tests
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Talk about gitignored cluster simulation scripts
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Important Large-Scale Simulations
|
|
61
|
+
|
|
62
|
+
#### No adaptivity
|
|
63
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=0.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
64
|
+
|
|
65
|
+
#### No adaptivity, 5 batches incremental recruitment
|
|
66
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=10000 --steepness=0.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
67
|
+
|
|
68
|
+
#### Some adaptivity, no action_centering
|
|
69
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
70
|
+
|
|
71
|
+
#### Some adaptivity, no action_centering, 5 batches incremental recruitment
|
|
72
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=10000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
73
|
+
|
|
74
|
+
#### More adaptivity, no action_centering
|
|
75
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=5.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
76
|
+
|
|
77
|
+
#### Even more adaptivity, no action_centering
|
|
78
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=10.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
79
|
+
|
|
80
|
+
#### Some adaptivity, RL action_centering, no inference action centering
|
|
81
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
82
|
+
|
|
83
|
+
#### Some adaptivity, inference action_centering, no RL action centering
|
|
84
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_action_centering.py"
|
|
85
|
+
|
|
86
|
+
#### Some adaptivity, inference and RL action_centering
|
|
87
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_action_centering.py"
|
|
88
|
+
|
|
89
|
+
#### Some adaptivity, inference and RL action_centering, even more T
|
|
90
|
+
sbatch --array=[0-999] -t 1-00:00 --mem=50G run_and_analysis_parallel_synthetic --T=25 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
91
|
+
|
|
92
|
+
#### Some adaptivity, inference and RL action_centering, even more T, 5 batches incremental recruitment
|
|
93
|
+
sbatch --array=[0-999] -t 1-00:00 --mem=50G run_and_analysis_parallel_synthetic --T=25 --n=50000 --recruit_n=10000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## TODO
|
|
98
|
+
1. Add precommit hooks (pip freeze, linting, formatting)
|
|
99
|
+
2. Run tests on PRs
|
|
100
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
```python
|
|
2
|
+
_ _ __ _ _ _
|
|
3
|
+
| (_)/ _| (_) | | | |
|
|
4
|
+
| |_| |_ ___ _ __ _ ___| | _____| |_
|
|
5
|
+
| | | _/ _ \ |/ _` |/ __| |/ / _ \ __|
|
|
6
|
+
| | | || __/ | (_| | (__| < __/ |_
|
|
7
|
+
|_|_|_| \___| |\__,_|\___|_|\_\___|\__|
|
|
8
|
+
_/ |
|
|
9
|
+
|__/
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Save your standard errors from pooling in adaptive experiments.
|
|
13
|
+
|
|
14
|
+
## Setup (if not using conda)
|
|
15
|
+
### Create and activate a virtual environment
|
|
16
|
+
- `python3 -m venv .venv; source /.venv/bin/activate`
|
|
17
|
+
|
|
18
|
+
### Adding a package
|
|
19
|
+
- Add to `requirements.txt` with a specific version or no version if you want the latest stable
|
|
20
|
+
- Run `pip freeze > requirements.txt` to lock the versions of your package and all its subpackages
|
|
21
|
+
|
|
22
|
+
## Running the code
|
|
23
|
+
- `export PYTHONPATH to the absolute path of this repository on your computer
|
|
24
|
+
- `./run_local_synthetic.sh`, which outputs to `simulated_data/` by default. See all the possible flags to be toggled in the script code.
|
|
25
|
+
|
|
26
|
+
## Linting/Formatting
|
|
27
|
+
|
|
28
|
+
## Testing
|
|
29
|
+
python -m pytest
|
|
30
|
+
python -m pytest tests/unit_tests
|
|
31
|
+
python -m pytest tests/integration_tests
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# Talk about gitignored cluster simulation scripts
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Important Large-Scale Simulations
|
|
42
|
+
|
|
43
|
+
#### No adaptivity
|
|
44
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=0.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
45
|
+
|
|
46
|
+
#### No adaptivity, 5 batches incremental recruitment
|
|
47
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=10000 --steepness=0.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
48
|
+
|
|
49
|
+
#### Some adaptivity, no action_centering
|
|
50
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
51
|
+
|
|
52
|
+
#### Some adaptivity, no action_centering, 5 batches incremental recruitment
|
|
53
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=10000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
54
|
+
|
|
55
|
+
#### More adaptivity, no action_centering
|
|
56
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=5.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
57
|
+
|
|
58
|
+
#### Even more adaptivity, no action_centering
|
|
59
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=10.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
60
|
+
|
|
61
|
+
#### Some adaptivity, RL action_centering, no inference action centering
|
|
62
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
63
|
+
|
|
64
|
+
#### Some adaptivity, inference action_centering, no RL action centering
|
|
65
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=0 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_action_centering.py"
|
|
66
|
+
|
|
67
|
+
#### Some adaptivity, inference and RL action_centering
|
|
68
|
+
sbatch --array=[0-999] -t 0-5:00 --mem=50G run_and_analysis_parallel_synthetic --T=10 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_action_centering.py"
|
|
69
|
+
|
|
70
|
+
#### Some adaptivity, inference and RL action_centering, even more T
|
|
71
|
+
sbatch --array=[0-999] -t 1-00:00 --mem=50G run_and_analysis_parallel_synthetic --T=25 --n=50000 --recruit_n=50000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
72
|
+
|
|
73
|
+
#### Some adaptivity, inference and RL action_centering, even more T, 5 batches incremental recruitment
|
|
74
|
+
sbatch --array=[0-999] -t 1-00:00 --mem=50G run_and_analysis_parallel_synthetic --T=25 --n=50000 --recruit_n=10000 --steepness=3.0 --alg_state_feats=intercept,past_reward --action_centering_RL=1 --inference_loss_func_filename="functions_to_pass_to_analysis/get_least_squares_loss_inference_no_action_centering.py" --theta_calculation_func_filename="functions_to_pass_to_analysis/estimate_theta_least_squares_no_action_centering.py"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## TODO
|
|
79
|
+
1. Add precommit hooks (pip freeze, linting, formatting)
|
|
80
|
+
2. Run tests on PRs
|
|
81
|
+
|
|
File without changes
|