Giter VIP home page Giter VIP logo

psycho_ai's Introduction

psycho_ai: analyzing biases in AI models using Psychophysics

Authors

  • Lizhen Liang, Ph.D. student, Syracuse University
  • Daniel E. Acuna, iSchool, Syracuse University

Introduction

Install:

pip install git+https://github.com/sciosci/psycho_ai

Examples

Extract PSE and JND of word embedding models:

from psycho_ai import two_afc

embedding = two_afc.get_glove_100d()
target_occupations = ['accountant', 'supervisor', 'worker', 'clerk', 'instructor', 'inspector',
          'electrician','appraiser', 'administrator', 'receptionist', 'advisor', 'chemist',
          'planner','paralegal', 'veterinarian', 'psychologist',  'baker', 'teacher', 
          'lawyer','nutritionist', 'hairdresser','pathologist', 'surgeon', 'practitioner', 
          'carpenter']
female_male_pairs = [['woman', 'man'],
                     ['female', 'male'],
                     ['she', 'he'],
                     ['her', 'him'],
                     ['hers', 'his'],
                     ['daughter', 'son'],
                     ['girl', 'boy'],
                     ['sister', 'brother']]
                
pse_score = two_afc.pse(embedding, target_occupations, female_male_pairs)
jnd_score = two_afc.jnd([embedding_A,embedding_B],target_occupations, female_male_pairs)

PSE Score

{'advisor': 0.23486328125,
 'architect': 0.24462890625,
 'officer': 0.29150390625,
 ...
 ...
 ...
 'therapist': 0.7587890625,
 'hairdresser': 0.76513671875,
 'hygienist': 0.830078125}

JND Score

{'janitor': 0.0010945320129394534,
'technician': 0.0012115716934204103,
'administrator': 0.0013679265975952148,
...
...
...
'supervisor': 0.021092605590820313,
'architect': 0.022199630737304688,
'plumber': 0.02711360454559326}

Plots

two_afc.plot_pse(pse_score)

pse_demo

Citation

Please refer to

psycho_ai's People

Contributors

jimzijun avatar liamliang avatar daniel-acuna avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

psycho_ai's Issues

Create API for supervised learning task

We need an API to estimate the PSE and JNE of a given attribute for a supervised learning task. This API should interact with sklearn.

from sklearn.linear_model import LogisticRegression

# classification problem: whether to approve a loan or not. Features in X and binary outcomes in y
model = LogisticRegression()
model.fit(X, y)

# import package to examine the model
from psycho_ai import two_afc

# let's assume that attribute 5 is "gender" and "training_X" is the data used for training.
pse = two_afc.pse(model, attribute=5, training_X = X)
# pse will contain the point of subjective equivalence for attribute 5.

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.