generated from LazerLab/project_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnakefile
More file actions
50 lines (41 loc) · 2.44 KB
/
Snakefile
File metadata and controls
50 lines (41 loc) · 2.44 KB
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
import os
########################################################################################
########################################################################################
# Meta info
DATA_ROOT = "../../data"
PROCESSED_ROOT = os.path.join(DATA_ROOT, "processed")
DERIVED_METRICS_ROOT = os.path.join(PROCESSED_ROOT, "derived_metrics")
EXISTING_LABELS_ROOT = os.path.join(DATA_ROOT, "existing_labels")
OUTPUT_ROOT = os.path.join(PROCESSED_ROOT, "validation")
########################################################################################
########################################################################################
# Workflow
########################################################################################
# Localness
LOCAL_NATIONAL_LABELS = os.path.join(EXISTING_LABELS_ROOT, "news_local_natioanl_classification.csv")
LOCALNESS_SCORE = os.path.join(DERIVED_METRICS_ROOT, "derived_state_kl.csv.gz")
LOCALNESS_SCORE_MERGED = os.path.join(OUTPUT_ROOT, "localness", "localness_merged.csv")
LOCALNESS_SCORE_AUC = os.path.join(OUTPUT_ROOT, "localness", "localness_auc.csv")
LOCALNESS_SCORE_F1 = os.path.join(OUTPUT_ROOT, "localness", "localness_f1.csv")
rule merge_localness_score_with_labels:
input: LOCAL_NATIONAL_LABELS, LOCALNESS_SCORE
output: LOCALNESS_SCORE_MERGED
shell: "uv run merge_localness_score_with_labels.py {input} {output}"
rule validate_localness_auc:
input: LOCALNESS_SCORE_MERGED
output: LOCALNESS_SCORE_AUC
shell: "uv run validate_localness_auc.py {input} {output}"
rule validate_localness_f1:
input: LOCALNESS_SCORE_MERGED
output: LOCALNESS_SCORE_F1
shell: "uv run validate_localness_f1.py {input} {output}"
########################################################################################
# Political leaning
EXISTING_PARTISAN_BIAS_SCORES = os.path.join(EXISTING_LABELS_ROOT, "partisan_bias_scores.csv")
POLITICAL_LEANING_SCORE = os.path.join(DERIVED_METRICS_ROOT, "derived_party_leaning.csv.gz")
POLITICAL_LEANING_SCORE_REG = os.path.join(DERIVED_METRICS_ROOT, "derived_partyreg_leaning.csv.gz")
POLITICAL_LEANING_SCORE_CORRELATION = os.path.join(OUTPUT_ROOT, "political_leaning", "political_leaning_correlation.csv")
rule validate_political_leaning_correlation:
input: EXISTING_PARTISAN_BIAS_SCORES, POLITICAL_LEANING_SCORE, POLITICAL_LEANING_SCORE_REG
output: POLITICAL_LEANING_SCORE_CORRELATION
shell: "uv run validate_political_leaning_correlation.py {input} {output}"