Skip to content

Instantly share code, notes, and snippets.

@lucdangelis
Last active May 24, 2019 23:26
Show Gist options
  • Save lucdangelis/7e85c7ee99b26b335605c6495cc1355e to your computer and use it in GitHub Desktop.
Save lucdangelis/7e85c7ee99b26b335605c6495cc1355e to your computer and use it in GitHub Desktop.
beta_a = 2
beta_b = 3
for customer in range(0, 10):
p_arr = []
beta = np.random.beta(a=beta_a, b=beta_b)
for transaction in range(1,10):
proba_inactive = beta*(1-beta)**(transaction-1)
p_arr.append(proba_inactive)
p_arr = np.array(p_arr)
plt.plot(p_arr, color='black', linewidth=0.7, zorder=1)
plt.ylabel('Probability Inactive')
plt.xlabel('Number of Transactions')
plt.xticks(range(1, 10))
plt.title('Geometric Probability Mass Function 10 customers')
display(plt.show())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment