-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
307 lines (239 loc) · 6.86 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
SHELL := bash
.ONESHELL:
data:
mkdir $@
# Set up
mappings:
python scripts/dst/collect_jobs.py
python scripts/dst/collect_kraf.py
python scripts/dst/collect_mappings.py
clean_mappings:
rm nsdata/times-mappings/*
rm nsdata/hq-mappings/*
# The new one
nodes:
python -m dstnx.data.school_cohort \
--start 1992 \
--end 1996 \
--suffix _new
# Klasseids
grundskoleklassetable:
python scripts/create_klasseid_table.py
# Depends on grundskoleklassetable
classids:
python -m dstnx.data.school_classids --suffix _new
grades:
python -m dstnx.data.grades --suffix _new
outcomes:
python -m dstnx.outcomes.edu --suffix _new --max-age-edu 25
python -m dstnx.outcomes.edu --suffix _new --max-age-edu 21
jobs:
python -m dstnx.outcomes.job --suffix _new --max-age-job 24
python -m dstnx.outcomes.job --suffix _new --max-age-job 20
kom:
python -m dstnx.features.address --suffix _new
node_addresses:
python scripts/create_address.py --suffix _new
# Table with geodata to be used in next make statement
geoaddresses:
python scripts/create_geotable.py
# Collect kraf for 1985-2020
kraf:
python -m dstnx.data.kraf collect-all
own_kraf:
python -m dstnx.data.kraf construct-kraf-cohort --suffix _new
psyk:
python -m dstnx.data.psyk
# Construct the tables with features on whole pop for each year
neighbors_pop:
python scripts/construct_neighbors.py \
--start 1985 \
--end 2020 \
--force \
--geo-only
## Neighborhood measures for adults & parents
# RADIUS
upbringing_adults_radius:
python -m dstnx.neighborhood.nearest --suffix _new \
--neighbor-type neighbors \
--file-suffix _adults \
--spacing 1 \
--batch-size 20000 \
--parents
upbringing_youth_radius:
python -m dstnx.neighborhood.nearest --suffix _new \
--neighbor-type youth \
--file-suffix _youth \
--spacing 1 \
--batch-size 20000
# K nearest
upbringing_adults_k:
python -m dstnx.neighborhood.nearest --suffix _new \
--neighbor-type neighbors \
--file-suffix _adults \
--spacing 1 \
--batch-size 20000 \
--k-nearest
upbringing_youth_k:
python -m dstnx.neighborhood.nearest \
--start 1999 \
--end 2020 \
--suffix _new \
--neighbor-type youth \
--file-suffix _youth \
--spacing 1 \
--batch-size 20000 \
--k-nearest \
--save-edges
upbringing_adults: upbringing_adults_radius upbringing_adults_k
upbringing_youth: upbringing_youth_radius upbringing_youth_k
# Aggregate measures
agg_features_two:
python -m dstnx.features.agg_features \
--age-period two \
--suffix _new_twoyear
agg_features_radius_default:
python -m dstnx.features.agg_features neighbors \
--age-period default \
--suffix _new
agg_features_k_default:
python -m dstnx.features.agg_features neighbors \
--age-period default \
--suffix _new \
--k-nearest
agg_features_parents_default:
python -m dstnx.features.agg_features parents \
--age-period default \
--suffix _new
agg_features_default: agg_features_radius_default agg_features_k_default agg_features_parents_default
# Depends on aggregated parent features
peer_ses:
python -m dstnx.features.peers_ses --suffix _new
ninthgrade_insts:
python -m dstnx.features.inst --suffix _new
# Merge measures
merge_full_radius:
python -m dstnx.features.merge \
--suffix _new \
--radius 100 \
--force \
--save
merge_full_k:
python -m dstnx.features.merge \
--suffix _new \
--k 30 \
--force \
--save
merge_full_large:
python -m dstnx.features.merge \
--suffix _new \
--radius 600 \
--force \
--save
estimate_linear:
python -m dstnx.models.linear
estimate_k:
python -m dstnx.models.linear --k 30 \
--col-suffix _all
# Set paths for R
paths:
cmd /C scripts\windows\set_paths.bat
agg_features_k:
python -m dstnx.features.agg_features $(AGG_TYPE) \
--age-period $(AGE_PERIOD) \
--suffix $(SUFFIX) \
--k-nearest \
--col-suffix $(COL_SUFFIX)
merge_full_k:
python -m dstnx.features.merge \
--suffix $(SUFFIX) \
--k $(K) \
--force \
--save \
--col-suffix $(COL_SUFFIX) \
--feature-suffix $(FEATURE_SUFFIX)
r_script_k:
python -m dstnx.models.rutils \
--suffix $(SUFFIX) \
--k $(K) \
--col-suffix $(COL_SUFFIX) \
--feature-suffix $(FEATURE_SUFFIX)
echo "Running Rscript and piping output to txt file"
Rscript scripts/R/fe_k$(K)$(COL_SUFFIX)$(FEATURE_SUFFIX)-quintiles.R > ../tables/r-terminal-output/fe_k$(K)$(COL_SUFFIX)$(FEATURE_SUFFIX)-quintiles.txt
r_script_k_deciles:
python -m dstnx.models.rutils \
--suffix $(SUFFIX) \
--k $(K) \
--col-suffix $(COL_SUFFIX) \
--feature-suffix $(FEATURE_SUFFIX) \
--deciles
echo "Running Rscript and piping output to txt file"
Rscript scripts/R/fe_k$(K)$(COL_SUFFIX)$(FEATURE_SUFFIX)-deciles.R > ../tables/r-terminal-output/fe_k$(K)$(COL_SUFFIX)$(FEATURE_SUFFIX)-deciles.txt
agg_features_radius:
python -m dstnx.features.agg_features $(AGG_TYPE) \
--age-period $(AGE_PERIOD) \
--suffix $(SUFFIX) \
--col-suffix $(COL_SUFFIX)
merge_full_radius:
python -m dstnx.features.merge \
--suffix $(SUFFIX) \
--radius $(RADIUS) \
--force \
--save \
--col-suffix $(COL_SUFFIX) \
--feature-suffix $(FEATURE_SUFFIX)
r_script_radius:
python -m dstnx.models.rutils \
--suffix $(SUFFIX) \
--radius $(RADIUS) \
--col-suffix $(COL_SUFFIX) \
--feature-suffix $(FEATURE_SUFFIX)
echo "Running Rscript and piping output to txt file"
Rscript scripts/R/fe_radius$(RADIUS)$(COL_SUFFIX)$(FEATURE_SUFFIX)-quintiles.R > ../tables/r-terminal-output/fe_radius$(RADIUS)$(COL_SUFFIX)$(FEATURE_SUFFIX)-quintiles.txt
r_script_radius_deciles:
python -m dstnx.models.rutils \
--suffix $(SUFFIX) \
--radius $(RADIUS) \
--col-suffix $(COL_SUFFIX) \
--feature-suffix $(FEATURE_SUFFIX) \
--deciles
echo "Running Rscript and piping output to txt file"
Rscript scripts/R/fe_radius$(RADIUS)$(COL_SUFFIX)$(FEATURE_SUFFIX)-deciles.R > ../tables/r-terminal-output/fe_radius$(RADIUS)$(COL_SUFFIX)$(FEATURE_SUFFIX)-deciles.txt
# Tables
tables:
python -m dstnx.tables.interact
python -m dstnx.tables.ml_res
python -m dstnx.tables.descriptive
python -m dstnx.tables.age_periods
python -m dstnx.tables.class_sizes
# PLOTS
# This should be run first if we haven't constructed the neigh measures;
pca_all_year:
python scripts/pca_all_years.py
pca_plot:
python -m dstnx.plots.pca
ses_bins_plot:
python -m dstnx.plots.ses_bins
pca_plots: pca_plot ses_bins_plot
rank_plot:
python -m dstnx.plots.rankplots
plots: pca_plots rank_plot
move:
python -m dstnx.utils.move
make desc: tables plots move
# Utils
# Follow tail of latest log
log:
python scripts/log_tail.py
format:
black src
# Wheels manually downloaded from https://data.pyg.org/whl/torch-2.0.0%2Bcu117.html
pyg:
pip install pyg-lib torch-scatter --no-index -f nsdata/packages
tensorboard:
tensorboard --logdir nsdata/lightning/lightning_logs --bind_all
# Other
time_network:
python scripts/generate_testdata.py --size 1000 --suffix "" --large
time_network_large:
python scripts/generate_testdata.py --size 5000 --suffix "_large" --large