Code Monkey home page Code Monkey logo

gender_bias_lipstick's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gender_bias_lipstick's Issues

Incorrect computation of correlation between bias-by-projection and bias-by-neighbors

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.

change of random state can change the clustering accuracy

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.