-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_exp_real_mp.sh
113 lines (89 loc) · 4.13 KB
/
run_exp_real_mp.sh
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
#!/bin/bash
############################
# #
# default setting for LTR #
# #
############################
LTR_DATA_DIR=out/ranklib_data
LTR_SRC_DIR=src/ranklib
LTR_RANKER=ListNet
LTR_RANKER_ID=7
LTR_OPT_METRIC=NDCG
LTR_OPT_K=500
LTR_LEARNING_RATE=0.000001
LTR_EPOCHS=10000
#########################
# #
# default setting for R #
# #
#########################
R_DATA_DIR=out
R_SRC_DIR=src/rscripts
#################################
# #
# default setting for python #
# #
#################################
PY_SRC_DIR=src/pyscripts
export PY_SRC_DIR="src/pyscripts"
export PY_DATA_SRC_DIR=data
###########################################################
# #
# INPUT SETTING for experiment, change based on dataset #
# #
###########################################################
DATA_N=15675 # for validation purpose
SRC_DATA="data/MEPS"
COUNT_FILE_NAME="_count"
SPLIT_FLAG=Yes
EVAL_K=50,100,200
LTR_TRIAL_N=10
DATA_TRIAL_N=1
LTR_SETTINGS=("Full")
DATA_FLAG=mp
MODEL_FLAG=m1
#########################################################
# #
# Functions for estimate causal model on the data, #
# causal model is specified in 'rscripts' #
# #
#########################################################
echo "SPECIAL SETTING CONSIDERING SENSITIVE ATTRIBUTES GENDER, RACE, AND AGE GROUPS"
Rscript --vanilla "$R_SRC_DIR/${DATA_FLAG}_${MODEL_FLAG}.R" $R_DATA_DIR $SRC_DATA
############################################################################
# #
# Functions to get counterfactual data from estimated causal model #
# #
############################################################################
python "$PY_SRC_DIR/gen_counter_data.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --src_data $SRC_DATA --val_n $DATA_N --counter_run $DATA_TRIAL_N
##############################################
# #
# Functions to prepare ranklib inputs #
# ONLY SUPPORT MODEL m1 and m2 NOW #
# #
##############################################
if [ $MODEL_FLAG == "m2" ]
then
EVAL_COUNTER_RANKINGS="Y,Y_count,Y_count_resolve"
EVAL_LTR_RANKINGS="Y__Y__full,Y_count__Y__full,Y_count__Y_count__full,Y_count_resolve__Y__full,Y_count_resolve__Y_count_resolve__full"
echo "EVALUATION ON BOTH RESOLVING AND NON-RESOLVING"
else
EVAL_COUNTER_RANKINGS="Y,Y_count"
EVAL_LTR_RANKINGS="Y__Y__full,Y_count__Y__full,Y_count__Y_count__full"
echo "EVALUATION ON NON-RESOLVING"
fi
# evaluation for selection rate
python "$PY_SRC_DIR/eval_rankings.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --eval_ks $EVAL_K --rankings "$EVAL_COUNTER_RANKINGS,Y_quotas_R,Y_quotas_G,Y_quotas_GR" --measure select_rate --file_n $COUNT_FILE_NAME
# evaluation for rKL
python "$PY_SRC_DIR/eval_rankings.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --eval_ks $EVAL_K --rankings $EVAL_COUNTER_RANKINGS --measure rKL --file_n $COUNT_FILE_NAME
# evaluation for ratio
python "$PY_SRC_DIR/eval_rankings.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --eval_ks $EVAL_K --rankings $EVAL_COUNTER_RANKINGS --measure igf --file_n $COUNT_FILE_NAME
# evaluation for score utility
python "$PY_SRC_DIR/eval_rankings.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --eval_ks $EVAL_K --rankings "$EVAL_COUNTER_RANKINGS,Y_quotas_R,Y_quotas_G,Y_quotas_GR" --measure score_utility --file_n $COUNT_FILE_NAME
#################################
# #
# Functions to generate plots #
# #
#################################
python "$PY_SRC_DIR/gen_plots.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --rankings "$EVAL_COUNTER_RANKINGS,Y_quotas_R,Y_quotas_G,Y_quotas_GR" --plot_ks $EVAL_K --y_col select_rate --y_max 2.2 --file_n $COUNT_FILE_NAME
python "$PY_SRC_DIR/gen_plots.py" --data_flag $DATA_FLAG --model_flag $MODEL_FLAG --rankings $EVAL_COUNTER_RANKINGS --plot_ks $EVAL_K --y_col rKL --y_max 2.1