Comments (8)
Hello @santoshbs
A few moments ago I made a deploy of a new version of the library.
It includes the calculation of the p-value in WEAT, based on the code you proposed.
Thank you very much!
It is implemented in the WEAT.py file in case you need to see its implementation.
Here is the API documentation.
By default, it takes the original statistical test of weat: right one sided. However, it also includes the option for left sided and two sided, which gives more control over the test.
It remains as a future job to implement it with joblib to parallelize this operation.
Best regards,
Pablo.
from wefe.
Hello @santoshbs
At this time the option to perform the One-sided p-value of WEAT is not currently available.
However, this feature is currently under development and will be implemented in the next software release.
Best regards,
Pablo.
from wefe.
Hello,
Thank you very much!
I will integrate this code in the next version of the library (hopefully this week).
Best regards,
Pablo.
from wefe.
I almost forgot,
With respect to :
By the way, I noticed that the use of the terms 'target' and 'attribute' is different in WEFE as compared to that in the above paper.
We decided to restrict what the target and attribute set can include in the design of the framework.
While we kept the names defined in the WEAT paper, we tried to validate the definitions of other metrics such as social group words and neutral words, etc..
Regards,
Pablo.
from wefe.
Thanks, @pabloBad
from wefe.
Hello @pabloBad , I attempted to create the p-value calculation function based on some code here.
def calc_p_value(model, target, attribute, iterations= 100000):
'''
Reference: https://wefe.readthedocs.io/en/latest/about.html#motivation-and-objectives
target: he, she, etc.
attribute: doctor, nurse, etc.
'''
u= attribute[0] + attribute[1]
n= int(len(u)/2)
runs= np.min((iterations, math.factorial(len(u))))
seen= set()
q= Query(target, attribute)
w= weat.run_query(q, model)
r_original= w['result']
count_greater= 0
for _ in range(runs):
permutation= tuple(random.sample(u, len(u)))
if permutation not in seen:
a1= list(permutation[0:n])
a2= list(permutation[n:])
attribute_hat= [a1, a2]
q_hat= Query(target, attribute_hat)
w_hat= weat.run_query(q_hat, model)
r_hat= w_hat['result']
if r_hat > r_original:
count_greater += 1
seen.add(permutation)
p_value= count_greater/runs
return p_value
Hope this is the correct implementation of the methodology outlined in the paper:
Caliskan, A., Bryson, J. J., & Narayanan, A. (2017). Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334), 183-186.
By the way, I noticed that the use of the terms 'target' and 'attribute' is different in WEFE as compared to that in the above paper.
from wefe.
No (bare, at most) experience in developing software packages, but social scientists really need this function. Thank you all! Looking forward to the improvements!
from wefe.
Hello @santoshbs
A few moments ago I made a deploy of a new version of the library.
It includes the calculation of the p-value in WEAT, based on the code you proposed.
Thank you very much!It is implemented in the WEAT.py file in case you need to see its implementation.
Here is the API documentation.By default, it takes the original statistical test of weat: right one sided. However, it also includes the option for left sided and two sided, which gives more control over the test.
It remains as a future job to implement it with joblib to parallelize this operation.
Best regards,
Pablo.
Thank you!
from wefe.
Related Issues (20)
- WEAT effect size: Different values HOT 4
- Problem with the library typing HOT 2
- ECT score HOT 3
- Metrics not discussed in the paper HOT 1
- WEAT p-value is nan HOT 4
- RNSB Deprecation Warning HOT 1
- RNSB Error HOT 1
- word_embedding not found under wefe HOT 10
- ImportError: cannot import name 'Literal' from 'typing' in Python 3.7 HOT 1
- WEAT returns nothing HOT 4
- WEFE documentation is inconsistent with the literature HOT 2
- How to reproduce table 1 as in the paper? HOT 5
- Information about the pre-loaded wordsets (Dataloaders) HOT 3
- Error on import in Google Colab (v0.3.2) with PL HOT 2
- Issue with RIPA metric HOT 3
- Missing WEAT words HOT 3
- Availability for embeddings created with transformer models
- Import error: cannot import name 'BaseKeyedVectors' from 'gensim.models.keyedvectors' HOT 2
- Support gensim 4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wefe.