We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 2: Compound Event Probability
Day 2: Compound Event Probability
Sort by
recency
|
68 Discussions
|
Please Login in order to post a comment
Can you count probability of success in wedding photography aukland? I need fail and success both probability but it's not valid.
x = {"Red":4/7, "Black":3/7} y = {"Red":5/9, "Black":4/9} z = {"Red":4/8, "Black":4/8}
first_possibility = x["Red"] * y["Red"] * z["Black"] second_possibility = x["Red"] * y["Black"] * z["Red"] third_possibility = x["Black"] * y["Red"] * z["Red"]
Get probability
print(first_possibility + second_possibility + third_possibility)
import itertools from fractions import Fraction from collections import Counter
X = list(Counter({1:4, 0:3}).elements()) Y = list(Counter({1:5, 0:4}).elements()) Z = list(Counter({1:4, 0:4}).elements())
TOTAL_SAMPLES = list(itertools.product(X, Y, Z)) TOTAL_SAMPLES_SIZE = len(TOTAL_SAMPLES)
FAVOURABLE_OUTCOMES_SIZE = sum([sum(i) == 2 for i in list(itertools.product(X, Y, Z))])
Probability as a fraction
print(Fraction(FAVOURABLE_OUTCOMES_SIZE,TOTAL_SAMPLES_SIZE))