Question: Write a function in Python, without using any special packages or libraries, that performs the following: Calculate P ( A | B ) given P

Write a function in Python, without using any special packages or libraries, that performs the following:
Calculate P(A|B) given P(A), P(B|A), and P(B|~A).
Parameters:
p_a (float): Probability of A happening.
p_b_given_a (float): Probability of B given A.
p_b_given_not_a (float): Probability of B given not A.
Returns: Probability of A given B (float).
Test your formula by providing the following values for your parameters:
p_a (float): 0.20
p_b_given_a (float): 0.30
p_b_given_not_a (float): 0.10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!