Bayesian Feminist

Sai Krishna Dammalapati
3 min readMay 7, 2024

--

My friend believes that women are bad employees.

To quantify this belief, I first asked him to define a good employee.

We came to a conclusion that a good employee is someone who does a task in 6 hours on average.

import numpy as np
x = np.linspace(0, 10, 1000)
# PDF formula for normal distribution with mean=6 and sd=1
pdf = (1/(1*np.sqrt(2*np.pi))) * np.exp(-0.5*((x - 6)/1)**2)
plt.plot(x, pdf, color='r', label='Good Employees')
# Add labels and legend
plt.title('Normal Distribution: Mean=6, SD=1')
plt.xlabel('Value')
plt.ylabel('Probability Density')
plt.legend()
plt.show()

Now my friend obviously doesn’t think that women employees come from this distribution. He believes they come from another distribution. His PRIOR belief is that women on average take 7 hours to complete a task, with the same standard deviation of 1 hour. As a result of his belief, he pays them less.

I will excuse my friend for having prior beliefs. They are formed based on whatever small experiences we have. My friend would have seen a few women whose performance was not great. But I will not excuse my friend if he doesn’t update his opinion based on new evidence.

I gave him evidence of my women colleagues. I shared the task with them and they took 4,7,6 hours each to complete the task. Now, what will his updated opinion be?

I hope he takes help of Bayes.

POSTERIOR = LIKELIHOOD * PRIOR / EVIDENCE

We already assumed the Prior. That women take 7 hours with 1-hour standard deviation to complete the task.

I will now calculate the likelihood of finding my evidence [4,7,6]. I am assuming that women employees come from a Normal distribution with 1-hour standard deviation. So I have to estimate the mean of this assumed distribution — this will help me construct updated opinions.

def likelihood_normal(data, mu, sigma):
"""
Calculate the likelihood function for observing a dataset (list)
given a normal distribution with mean mu and standard deviation sigma.
"""
likelihood = 1.0
for x in data:
likelihood *= 1/(np.sqrt(2*np.pi)*sigma) * np.exp(-0.5*((x - mu)/sigma)**2)
return likelihood

x = np.linspace(0, 10, 1000)

# PDF formula for normal distribution with mean=7 and sd=1
prior = (1/(1*np.sqrt(2*np.pi))) * np.exp(-0.5*((x - 7)/1)**2)
likelihoods = np.array([likelihood_normal([4,7,6],mu,1) for mu in x])

# Calculate unnormalised posterior
unnormalized_posterior = likelihoods*prior

I have one last step to calculate the posterior — to normalize. Here is an easier way to do it

import scipy as sp
evidence = sp.integrate.trapz(unnormalized_posterior, x) #Evidence

normalized_posterior = unnormalized_posterior/(evidence)

And if I plot this

My friend’s belief system shifted to the left. He now believes that women employees take 6 hours (like a good employee) on average to complete the task. A one-hour reduction (1 SD) based on small evidence that I provided.

Now this Posterior becomes his Prior when he gets new evidence tomorrow. Eventually, when he collects good enough evidence, he will be able to better judge women employees and treat them justly.

--

--

Sai Krishna Dammalapati

Interested in inter-sectoral areas of Technology and Socio-Economic Development.