gonenhila / gender_bias_lipstick Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
In both remaining_bias_2016.ipynb and remaining_bias_2018.ipynb notebooks:
compute_corr(tuples_bef, 1, 3)
compute_corr(tuples_aft, 1, 3)
Should be changed to:
compute_corr(tuples_bef, 1, 3)
compute_corr(tuples_aft, 2, 3)
because tupple stores the following: (w, gender_bias_bef[w], gender_bias_aft[w], m, f)
while computing the correlation for the debiased embeddings, gender_bias_aft[w]
which is at index 2 and not 1 should be used.
Also
def bias_by_neighbors(space, neighbours_num = 100):
tuples = []
for w in tqdm(vocab[space]):
top = topK(w, space, k=neighbours_num+5)[:neighbours_num]
m = 0
f = 0
for t in top:
if gender_bias_bef[t] > 0:
m+=1
else:
f+=1
tuples.append((w, gender_bias_bef[w], gender_bias_aft[w], m, f))
return tuples
while checking for tuples_aft it should be changed to:
def bias_by_neighbors(space, neighbours_num = 100):
tuples = []
for w in tqdm(vocab[space]):
top = topK(w, space, k=neighbours_num+5)[:neighbours_num]
m = 0
f = 0
for t in top:
if gender_bias_aft[t] > 0: #This should be gender_bias_aft since we are calculating correlation in embedding after debiasing
m+=1
else:
f+=1
tuples.append((w, gender_bias_bef[w], gender_bias_aft[w], m, f))
return tuples
Similar changes need to be made in the get_tuples_prof
function under the title - Professions experiment.
Also,
For the Professions Expirements, I believe the following code:
tuples_bef_prof = get_tuples_prof('limit_bef', professions, gender_bias_bef)
tuples_aft_prof = get_tuples_prof('limit_aft', professions, gender_bias_bef)
should be changed to:
tuples_bef_prof = get_tuples_prof('limit_bef', professions, gender_bias_bef)
tuples_aft_prof = get_tuples_prof('limit_aft', professions, gender_bias_aft)
I find that in most of the experiments, the gender bias by projection is mostly taken only for the original embeddings and almost never for the new ones.
Please let me know if I misunderstood.
EDIT - I misunderstood things. There is no problem with the code.
Dear authors,
I run your "remaining_bias_2016" notebook to check the clustering results. I notice that with your default random state setting, the clustering accuracy is 0.999 and 0.922 on my machine, which aligns with your paper report. But if I change to any other number, this result can significantly change.
For example, I can get original w2v with random state 0, resulting in clustering "precision" (accuracy) 0.001, which means it is not biased at all.
Or, I can get hard de-biased word embedding with clustering accuracy 0.075 with random state 2023, which means bias does not exist any more after hard debiasing.
Do you think this can significantly change some of your paper conclusions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.