Created
October 28, 2019 02:04
-
-
Save JohnDeJesus22/11189c622902619cb418aee530a1219c to your computer and use it in GitHub Desktop.
HgPMF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hypergeom_plot(N, A, n): | |
''' | |
Visualization of Hypergeometric Distribution for given parameters | |
:param N: population size | |
:param A: total number of desired items in N | |
:param n: number of draws made from N | |
:returns: Plot of Hypergeometric Distribution for given parameters | |
''' | |
x = np.arange(0, n+1) | |
y = [hypergeom_pmf(N, A, n, x) for x in range(n+1)] | |
plt.plot(x, y, 'bo') | |
plt.vlines(x, 0, y, lw=2) | |
plt.xlabel('# of desired items in our draw') | |
plt.ylabel('Probablities') | |
plt.title('Hypergeometric Distribution Plot') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment