repo
stringlengths
3
91
file
stringlengths
16
152
code
stringlengths
0
3.77M
file_length
int64
0
3.77M
avg_line_length
float64
0
16k
max_line_length
int64
0
273k
extension_type
stringclasses
1 value
Beholder-GAN
Beholder-GAN-master/metrics/sliced_wasserstein.py
#Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # #Attribution-NonCommercial 4.0 International # #======================================================================= # #Creative Commons Corporation ("Creative Commons") is not a law firm and #does not provide legal services or legal advice. Distribut...
25,263
45.698706
135
py
Beholder-GAN
Beholder-GAN-master/metrics/frechet_inception_distance.py
#!/usr/bin/env python3 # # Copyright 2017 Martin Heusel # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
11,441
39.574468
110
py
Beholder-GAN
Beholder-GAN-master/metrics/ms_ssim.py
#!/usr/bin/python # # Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
8,160
39.60199
128
py
Beholder-GAN
Beholder-GAN-master/metrics/inception_score.py
# Copyright 2016 Wojciech Zaremba # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
5,305
34.851351
110
py
Beholder-GAN
Beholder-GAN-master/metrics/__init__.py
# empty
8
3.5
7
py
Beholder-GAN
Beholder-GAN-master/utils/plot_beauty_distribution.py
import os import csv import numpy as np import argparse import matplotlib.pyplot as plt # initialize parser arguments parser = argparse.ArgumentParser() parser.add_argument('--csv', '-csv', help='path to csv file', default='../All_Ratings.csv', type=str) parser.add_argument('--density', '-density', help='configure plo...
1,767
30.017544
101
py
Beholder-GAN
Beholder-GAN-master/utils/transform_images.py
import os from PIL import Image # select dataset folder to check and destination folder to put output images in path = '../datasets/beauty_dataset/img/beauty_dataset' dest_path = '../datasets/beauty_dataset/img/beauty_dataset_scaled' # destination resolution dest_res = 2 ** 8 for i, file in enumerate(os.listdir(path...
1,274
35.428571
86
py
Themis
Themis-master/Themis1.0/main.py
import math import random import sys import xml.etree.ElementTree as ET import Themis def load_soft_from_settings(): names=[] types=[] values=[] num_values=[] tree = ET.parse('settings.xml') root = tree.getroot() software_name = root.find("name").text command = root.find("command").te...
1,506
27.433962
83
py
Themis
Themis-master/Themis1.0/Themis.py
import sys import itertools import commands import random import math import copy class soft: conf_zValue = {80:1.28,90:1.645,95:1.96, 98:2.33, 99:2.58} MaxSamples=50 SamplingThreshold = 10 cache = {} def __init__(self, names, values, num, command, type): self.attr_names = copy.deepcopy(n...
8,590
27.44702
100
py
Themis
Themis-master/Themis1.0/software.py
import sys sex = sys.argv[1] race = sys.argv[3] if(sex=="Male" and race=="Red"): print "1" else: print "0"
116
12
32
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/wrapper.py
''' Wrapper script to call each of the subject system depending on the input arguments ''' import sys import commands ''' Usage : argv[1] : Name of the subjecct system argv[2] : The dataset to train the classifier argv[3] : Type of discrimination (Group/Causal) argv[4] : The sensitive argument to train the classfier ...
5,896
23.26749
82
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for race 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
1,106
17.762712
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/Table1GroupScore.py
''' This script calculates the Group discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
1,077
17.912281
107
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/Atestcredit.py
''' Test the Subject System A on Credit dataset to generate the output for the input given as argv arguments. All the inputs are assumed to be space separated. ''' from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import...
1,801
20.97561
128
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/ACausalGender.py
''' Causal discrimination testing for Subject System A Inputs : argv[1] : Train file argv[2] : Sensitive argument 8 means race and 9 means gender ''' from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklear...
6,388
25.620833
127
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/ACausalRace.py
''' Group discrimination testing for Subject System A Inputs : argv[1] : Train file argv[2] : Sensitive argument argv[3] : Argument to test discriminationa gainst For argv[2] and argv[3] : 8 means race and 9 means gender ''' from __future__ import division from random import seed, shuffle import random ...
6,473
25.752066
127
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/ACausalCredit.py
''' Causal discrimination testing for Subject System A on Credit dataset Inputs : argv[1] : Train file ''' from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import svm import os,sys import urllib2 sys.path.insert(0, ...
6,127
25.643478
127
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/AGroupCredit.py
''' Group discrimination testing for Subject System A for Credit dataset Inputs : argv[1] : Train file ''' from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import svm import os,sys import urllib2 sys.path.insert(0, ...
5,298
23.307339
128
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/Atestcensus.py
''' Test the Subject System A on Census dataset to generate the output for the input given as argv arguments. All the inputs are assumed to be space separated. ''' from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import...
1,768
21.679487
128
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/AGroup.py
''' Group discrimination testing for Subject System A Inputs : argv[1] : Train file argv[2] : Sensitive argument argv[3] : Argument to test discriminationa gainst For argv[2] and argv[3] : 8 means race and 9 means gender ''' from __future__ import division from random import seed, shuffle import random ...
6,049
24.854701
128
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/fair_classification/loss_funcs.py
import sys import os import numpy as np import scipy.special from collections import defaultdict import traceback from copy import deepcopy def _hinge_loss(w, X, y): yz = y * np.dot(X,w) # y * (x.w) yz = np.maximum(np.zeros_like(yz), (1-yz)) # hinge function return sum(yz) def _logistic_loss(...
2,268
22.884211
82
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/A/fair_classification/utils.py
import numpy as np from random import seed, shuffle import loss_funcs as lf # our implementation of loss funcs from scipy.optimize import minimize # for loss func minimization from multiprocessing import Pool, Process, Queue from collections import defaultdict from copy import deepcopy import matplotlib.pyplot as plt #...
27,188
41.350467
357
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/H/Htest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB from sklearn import svm import itertools import sys random.seed(1) num_test=0 X=[] Y=[] i=0 with open(sys.argv[1],...
747
14.914894
54
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/H/Hcreditgroup.py
''' Group discrimination testing for Subject System H for credit dataset Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from ...
5,206
25.840206
94
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/H/Hcreditcausal.py
''' Causal discrimination testing for Subject System H for credit dataset Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from...
6,103
25.889868
102
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/H/Hcredittest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB from sklearn import svm import itertools import sys random.seed(1) num_test=0 X=[] Y=[] i=0 with open(sys.argv[1],...
747
14.914894
54
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/H/Hgroup.py
''' Group discrimination testing for Subject System H Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
5,202
25.545918
104
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/H/Hcausal.py
''' Causal discrimination testing for Subject System H Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
6,006
26.180995
112
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Cgender/Cgroup.py
''' Group discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
5,039
25.526316
104
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Cgender/Ctest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys random.seed(1991) trainfile = sys.argv[1] num_test=0 X=[] Y=[] i=0 with o...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Cgender/Ccausal.py
''' Causal discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
5,925
25.936364
112
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Ccredit/Ccreditcausal.py
''' Causal discrimination testing for Subject System C(Credit dataset) Inputs : argv[1] : Train file argv[2] : Sensitive argument argv[3] : Argument to test discriminationa gainst For argv[2] and argv[3] : 8 means race and 9 means gender ''' from __future__ import division import random import math impo...
5,841
26.556604
102
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Ccredit/Ctestcredit.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys max_inp = 50000 printsuite = 1 minInp = 50000 random.seed(1991) trainfile =...
821
16.869565
54
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Ccredit/Ccreditgroup.py
''' Group discrimination testing for Subject System C(Credit dataset) Inputs : argv[1] : Train file argv[2] : Sensitive argument argv[3] : Argument to test discriminationa gainst For argv[2] and argv[3] : 8 means race and 9 means gender ''' from __future__ import division import random import math impor...
5,005
25.209424
94
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Crace/Cgroup.py
''' Group discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
5,027
25.1875
104
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Crace/Ctest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys random.seed(1991) trainfile = sys.argv[1] num_test=0 X=[] Y=[] i=0 with o...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/C/Crace/Ccausal.py
''' Causal discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
5,991
25.990991
112
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/E/Ecreditgroup.py
''' Group discrimination testing for Subject System E for credit dataset Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from ...
4,915
25.717391
94
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/E/Ecausal.py
''' Causal discrimination testing for Subject System E Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
5,919
25.428571
112
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/E/Ecreditcausal.py
''' Causal discrimination testing for Subject System E for causla dataset Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from...
5,911
25.995434
102
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/E/Etestcredit.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import sys max_inp = 50000 printsuite=0 minInp =5 random.seed(2) X=[] Y=[] i=0 with open(sys.argv[1...
692
15.902439
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/E/Egroup.py
''' Group discrimination testing for Subject System E Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
4,900
25.491892
104
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/E/Etest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import sys max_inp = 50000 printsuite=0 minInp =5 random.seed(2) sens_arg = int(sys.argv[2]) X=[] Y...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/G/Gtest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np import itertools import sys max_inp = 30000 printout = 0 minInp=30000 random.seed(1997) X=[] Y=[] i=0 with open(sys.argv[1], "r") as ins: for line in ins: ...
703
16.170732
37
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/G/Gcreditcausal.py
''' Causal discrimination testing for Subject System G for credit dataset Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from...
6,129
26.244444
102
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/G/Gcausal.py
''' Causal discrimination testing for Subject System G Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
6,227
25.615385
112
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/G/Gcreditgroup.py
''' Group discrimination testing for Subject System G for Credit dataset Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from ...
5,476
25.980296
89
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/G/Gcredittest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np import itertools import sys max_inp = 30000 printout = 0 minInp=3 random.seed(1997) X=[] Y=[] i=0 with open(sys.argv[1], "r") as ins: for line in ins: ...
701
15.714286
37
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure1/G/Ggroup.py
''' Group discrimination testing for Subject System G Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
5,525
25.825243
99
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
1,111
17.533333
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/D/Dgenderm/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/D/Dgenderc/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/D/Dracemr/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/D/Dracem/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/A/ACausal.py
''' Group discrimination testing for Subject System A Inputs : argv[1] : Train file argv[2] : Sensitive argument argv[3] : Argument to test discriminationa gainst For argv[2] and argv[3] : 8 means race and 9 means gender ''' from __future__ import division from random import seed, shuffle import random ...
6,556
25.872951
127
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/A/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/A/Atestcensus.py
''' Test the Subject System A on Census dataset to generate the output for the input given as argv arguments. All the inputs are assumed to be space separated. ''' from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import...
1,768
21.679487
128
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/A/fair_classification/loss_funcs.py
import sys import os import numpy as np import scipy.special from collections import defaultdict import traceback from copy import deepcopy def _hinge_loss(w, X, y): yz = y * np.dot(X,w) # y * (x.w) yz = np.maximum(np.zeros_like(yz), (1-yz)) # hinge function return sum(yz) def _logistic_loss(...
2,268
22.884211
82
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/A/fair_classification/utils.py
import numpy as np from random import seed, shuffle import loss_funcs as lf # our implementation of loss funcs from scipy.optimize import minimize # for loss func minimization from multiprocessing import Pool, Process, Queue from collections import defaultdict from copy import deepcopy import matplotlib.pyplot as plt #...
27,188
41.350467
357
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Cgender/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Cgender/Ctest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys random.seed(1991) trainfile = sys.argv[1] num_test=0 X=[] Y=[] i=0 with o...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Cgender/Ccausalm.py
''' Causal discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import line...
5,883
25.86758
100
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Ccredit/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Ccredit/Ccreditcausal.py
''' Causal discrimination testing for Subject System C(Credit dataset) Inputs : argv[1] : Train file argv[2] : Sensitive argument argv[3] : Argument to test discriminationa gainst For argv[2] and argv[3] : 8 means race and 9 means gender ''' from __future__ import division import random import math impo...
5,838
26.542453
104
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Ccredit/Ctestcredit.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys max_inp = 50000 printsuite = 1 minInp = 50000 random.seed(1991) trainfile =...
821
16.869565
54
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Cracerg/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Cracerg/Ctest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys random.seed(1991) trainfile = sys.argv[1] num_test=0 X=[] Y=[] i=0 with o...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Cracerg/Ccausal.py
''' Causal discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
6,061
25.823009
100
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Crace/Ccausala.py
''' Causal discrimination testing for Subject System C Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
5,932
25.846154
100
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Crace/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/C/Crace/Ctest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import commands import sys random.seed(1991) trainfile = sys.argv[1] num_test=0 X=[] Y=[] i=0 with o...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/F/Fcountryrace/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
936
16.679245
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/F/Frelationrace/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/B/Bracecausal/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/B/Bgendercausalm/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/B/Bgendercausalmrg/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/B/Bgendercausalrg/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
935
16.660377
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/E/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/E/Ecausalmarital.py
''' Causal discrimination testing for Subject System E Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
5,866
25.191964
99
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/E/Etest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import sys max_inp = 50000 printsuite=0 minInp =5 random.seed(2) sens_arg = int(sys.argv[2]) X=[] Y...
720
16.166667
42
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/G/Gtest.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np import itertools import sys max_inp = 30000 printout = 0 minInp=30000 random.seed(1997) X=[] Y=[] i=0 with open(sys.argv[1], "r") as ins: for line in ins: ...
703
16.170732
37
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/G/Gcausale.py
''' Causal discrimination testing for Subject System G Inputs : argv[1] : Train file argv[2] : Argument to test discriminationa gainst 8 means race and 9 means gender ''' from __future__ import division import random import math import os from collections import defaultdict from sklearn import lin...
6,268
25.563559
99
py
Themis
Themis-master/ESEC.FSE.2017.Experimental.Replication/Figure2/G/Table1CausalScore.py
''' This script calculates the Causal discrimination score for the particular input file towards race or gender. USAGE : argv[1] : Input test suite argv[2] : 0/1 0 for tace 1 for gender ''' import sys f = open(sys.argv[1],"r") type = int(sys.argv[2]) #type = 0 means race #type ...
934
16.641509
108
py
Themis
Themis-master/subjectSystems/A/svm.py
from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import svm import os,sys import urllib2 sys.path.insert(0, './fair_classification/') # the code for fair classification is in this directory import utils as ut import num...
3,863
32.894737
127
py
Themis
Themis-master/subjectSystems/A/A_causal.py
from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import svm import os,sys import urllib2 sys.path.insert(0, './fair_classification/') # the code for fair classification is in this directory import utils as ut import num...
11,777
45.007813
133
py
Themis
Themis-master/subjectSystems/A/A_group.py
from __future__ import division from random import seed, shuffle import random import math import os from collections import defaultdict from sklearn import svm import os,sys import urllib2 sys.path.insert(0, './fair_classification/') # the code for fair classification is in this directory import utils as ut import num...
10,117
42.055319
127
py
Themis
Themis-master/subjectSystems/A/fair_classification/loss_funcs.py
import sys import os import numpy as np import scipy.special from collections import defaultdict import traceback from copy import deepcopy def _hinge_loss(w, X, y): yz = y * np.dot(X,w) # y * (x.w) yz = np.maximum(np.zeros_like(yz), (1-yz)) # hinge function return sum(yz) def _logistic_loss(...
2,268
22.884211
82
py
Themis
Themis-master/subjectSystems/A/fair_classification/utils.py
import numpy as np from random import seed, shuffle import loss_funcs as lf # our implementation of loss funcs from scipy.optimize import minimize # for loss func minimization from multiprocessing import Pool, Process, Queue from collections import defaultdict from copy import deepcopy import matplotlib.pyplot as plt #...
27,528
41.352308
357
py
Themis
Themis-master/subjectSystems/fairness_unaware/nb_group.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import sys max_inp = 1000 random.seed() X=[] Y=[] i=0 with open("cleaned_train", "r") as ins: f...
9,066
47.228723
95
py
Themis
Themis-master/subjectSystems/fairness_unaware/nb_causal.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB import itertools import sys max_inp = 1000 random.seed() num_test=0 X=[] Y=[] i=0 with open("cleaned_train", "r") a...
10,452
47.845794
133
py
Themis
Themis-master/subjectSystems/fairness_unaware/svm_group.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB from sklearn import svm import itertools import sys max_inp = 1000 random.seed() X=[] Y=[] i=0 with open("cleaned_tr...
9,067
46.726316
95
py
Themis
Themis-master/subjectSystems/fairness_unaware/lr_group.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np import itertools import sys max_inp = 1000 random.seed() X=[] Y=[] i=0 with open("cleaned_train", "r") as ins: for line in ins: line = line.strip() ...
3,976
25.691275
81
py
Themis
Themis-master/subjectSystems/fairness_unaware/lr_causal.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np import itertools import sys max_inp = 1000 random.seed() num_test=0 X=[] Y=[] i=0 with open("cleaned_train", "r") as ins: for line in ins: line = l...
4,436
24.796512
85
py
Themis
Themis-master/subjectSystems/fairness_unaware/svm_causal.py
from __future__ import division import random import math import os from collections import defaultdict from sklearn import linear_model import numpy as np from sklearn.naive_bayes import GaussianNB from sklearn import svm import itertools import sys max_inp = 1000 random.seed() num_test=0 X=[] Y=[] i=0 with open...
10,548
47.837963
133
py
Themis
Themis-master/Themis2.0/themis2.py
# Themis 2.0 # # By: Rico Angell from __future__ import division import argparse import subprocess from itertools import chain, combinations, product import math import random import scipy.stats as st import xml.etree.ElementTree as ET import copy class Input: """ Class to define an input characteristic to ...
23,477
34.626707
139
py
Themis
Themis-master/Themis2.0/software.py
import sys sex = sys.argv[1] race = sys.argv[3] if(sex=="Male" and race=="Red"): print "1" else: print "0"
116
12
32
py
Themis
Themis-master/Themis2.0/grid2.py
import sys from PyQt5.QtWidgets import * import PyQt5.QtGui as QtGui from PyQt5.QtGui import * from PyQt5.QtCore import * import xml.etree.ElementTree as ET import themis2 tree = None class App(QDialog): def __init__(self): super().__init__() self.title = 'Themis 2.0' self.left = 500 ...
31,234
35.617819
164
py
Themis
Themis-master/Themis2.0/loan.py
import sys sex = sys.argv[1] race = sys.argv[2] income = sys.argv[3] # first case if sex == "male": print ("1") elif race != "green": if income == "0...50000": print ("0") else: print ("1") else: if income == "0...50000" or income == "50001...100000": print ("0") else: print ("1")
299
12.636364
56
py
Themis
Themis-master/Themis2.0/loan_2.py
import sys sex = sys.argv[1] race = sys.argv[2] income = sys.argv[3] # second case if race == "green" or race == "orange": if income == "0...50000": print ("0") else: print ("1") else: if income == "50001...100000": print ("0") else: print ("1")
260
13.5
39
py
Themis
Themis-master/Themis2.0/grid.py
import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import xml.etree.ElementTree as ET import themis2 class App(QDialog): def __init__(self): super().__init__() self.title = 'Themis 2.0' self.left = 100 self.top = 100 self.width ...
10,797
28.746556
97
py