Challenge
Bayes Theorem is crucial for a data scientist, so try to consolidate knowledge!
Tarea
Swipe to start coding
Imagine that we decided to conduct medical research. You gathered data about two groups of people: 750
people with heart problems and 800
people with chronic stomachache. You know that 7%
of interviewed from the first group have diabetes; meanwhile, 12%
of respondents from the second group have diabetes too. Calculate the probability that a randomly selected person with diabetes has a chronic stomachache.
- Calculate the probability that a randomly selected person has a heart problem.
- Calculate the probability that the randomly selected person has a stomachache.
- Calculate the probability that you randomly select a person that has diabetes.
- Calculate the probability that a randomly selected person with diabetes has a chronic stomachache (already done).
Solución
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Probability that ramdomly selected person has heart problem
P_heart = 750 / 1550
# Probability that ramdomly selected person has stomachache
P_stomach = 800 / 1550
P_heart_diabetes = 0.07
P_stomach_diabetes = 0.12
# Probability that you randomly select a person that has diabetes
P_random_diabetes = P_heart * P_heart_diabetes + P_stomach * P_stomach_diabetes
# Randomly selected person with diabetes has chronic stomachache
P_diabetes_belong_stomach = (P_stomach * P_stomach_diabetes)/P_random_diabetes
print("The probability is", P_diabetes_belong_stomach)
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 8
single
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Probability that randomly selected person has heart problem
P_heart = ___ / 1550
# Probability that randomly selected person has stomachache
P_stomach = ___
P_heart_diabetes = 0.07
P_stomach_diabetes = 0.12
# Probability that you randomly select a person that has diabetes
P_random_diabetes = ___ * ___ + ___ * ___
# Randomly selected person with diabetes has chronic stomachache
P_diabetes_belong_stomach = (P_stomach * P_stomach_diabetes)/P_random_diabetes
print("The probability is", P_diabetes_belong_stomach)
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla