-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathregression_experimets_regularization_effect.py
75 lines (62 loc) · 2.21 KB
/
regression_experimets_regularization_effect.py
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
# Code to reproduce the regression experiments in the paper
import numpy as np
from fair_dummies.cf_regression import run_experiment
# parameters are tuned on training set
# choose test=True to evaluate training performance
# test seed
random_state_train_test = 123
# repeat the experiments for num_experiments times
num_experiments = 20
test_methods = []
dataset_names = []
batch_size = []
lr = []
steps = []
mu_val = []
second_scale = []
epochs = []
model_type = []
reg_type = []
################################################################################
## Fairness-unaware baseline methods
################################################################################
test_methods += ['FairDummies']
dataset_names += ['meps']
batch_size += [10000]
lr += [0.01]
steps += [50]
mu_val += list(np.linspace(0,0.99,100))
second_scale += [20]
epochs += [20]
model_type += ["linear_model"]
reg_type += ["mreg"]
for exp_id in range(1):
for mu_val_id in range(100):
cur_test_method = test_methods[exp_id]
cur_dataset_name = dataset_names[exp_id]
cur_batch_size = batch_size[exp_id]
cur_lr_loss = lr[exp_id]
cur_lr_dis = lr[exp_id]
cur_loss_steps = steps[exp_id]
cur_dis_steps = steps[exp_id]
cur_mu_val = mu_val[mu_val_id]
cur_epochs = epochs[exp_id]
cur_random_state = random_state_train_test
cur_model_type = model_type[exp_id]
cur_regression_type = reg_type[exp_id]
cur_second_scale = second_scale[exp_id]
# run an experiment and save average results to CSV file
run_experiment(cur_test_method,
cur_dataset_name,
cur_batch_size,
cur_lr_loss,
cur_lr_dis,
cur_loss_steps,
cur_dis_steps,
cur_mu_val,
cur_epochs,
cur_model_type,
cur_regression_type,
random_state_train_test,
cur_second_scale,
num_experiments)