Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. import seaborn as sns
  4. import random as rnd
  5.  
  6. theta = np.array([[3.91973221e-05, 2.59889568e-04], [5.32160367e-06, 4.99763548e-06],[6.65158426e-01, 3.34841574e-01]])
  7.  
  8. n = 100000
  9. number_of_distributions = 2
  10. mu = theta[0]
  11. sigma = theta[1]
  12. weights = theta[2]
  13. samples = []
  14.  
  15. for i in range(n):
  16. population = [rnd.gauss(mu[i], np.sqrt(sigma[i])) for i in range(number_of_distributions)]
  17. samples.append(rnd.choices(population, weights=weights))
  18. sns.distplot(samples)
  19. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement