dimanche 5 avril 2020

In python, generate two columns A and B of random values of 0 and 1's from given prior and conditional probablities

I want to write a function in python to create two columns A and B of n rows of random 0's and 1's based on input probablities of P(A), P(B), P(B given A) and P(A given B). Conditional probablities based on both A and B for that row is 1.

Input example:

def set(p_A, p_B, B_A, A_B, n):

return colA, colB

output example:

A = [1,0,1,1,1,0...n]
B = [1,1,0,1,1,...n]

based on values of P(A), P(B), P(B|A), P(A|B).




Aucun commentaire:

Enregistrer un commentaire