Foundations of Probability in Python - Part 4
Foundations of Probability in Python - Part 4
to population mean
F O U N D AT I O N S O F P R O B A B I L I T Y I N P Y T H O N
Alexander A. Ramírez M.
CEO @ Synergy Vision
Sample mean review
[0 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 0 1 0 0 1 1 1 0
0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1
1 1 1 0 0 0 1 1 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 0 0]
0.6
# Add legend
plt.legend(("Population mean","Sample mean"), loc='upper right')
plt.show()
Alexander A. Ramírez M.
CEO @ Synergy Vision
The central limit theorem (CLT)
The sum of random variables tends to a normal distribution as the number of them grows to
in nity.
Conditions:
Alexander A. Ramírez M.
CEO @ Synergy Vision
Linear functions
y = slope ∗ x + intercept
# Get parameters
slope = model.coef_[0]
intercept = model.intercept_
# Print parameters
print(slope, intercept)
(1.496703900384545, 52.44845266434719)
[74.89901117]
plt.scatter(hours_of_study, scores)
plt.plot(hours_of_study_values, model.predict(hours_of_study_values))
plt.show()
Alexander A. Ramírez M.
CEO @ Synergy Vision
Original data
# Get parameters
beta1 = model.coef_[0][0]
beta0 = model.intercept_[0]
# Print parameters
print(beta1, beta0)
(1.3406531235010786, -15.05906237996095)
outcome = model.predict(hours_of_study_test)
print(outcome)
array([False])
array([0.04773474])
Alexander A. Ramírez M.
CEO @ Synergy Vision
Fundamental concepts