09 Independent events example - test taking
09 Independent events example - test taking#
%%html
<iframe width="700" height="400" src="https://www.youtube.com/embed/VWAfEbgf1Po/" frameborder="0" allowfullscreen></iframe>
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
prob_1 = ['i1', 'i2', 'i3', 'c']
prob_2 = ['i1', 'i2', 'c']
def P(cond, total_lst):
cond_lst = list(filter(cond, total_lst))
return len(cond_lst) / len(total_lst), cond_lst
# P(Correct on #1)
p_correct_1, _ = P(lambda x:x == 'c', prob_1)
print(p_correct_1)
0.25
# P(Correct on #2)
p_correct_2, _ = P(lambda x:x == 'c', prob_2)
print(p_correct_2)
0.3333333333333333
# P(Correct on #1 and #2) = P(Correct on #1) . P(Correct on #2)
p_correct_1 * p_correct_2
0.08333333333333333
# visualize it using table