Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- import seaborn as sns
- import random as rnd
- theta = np.array([[3.91973221e-05, 2.59889568e-04], [5.32160367e-06, 4.99763548e-06],[6.65158426e-01, 3.34841574e-01]])
- n = 100000
- number_of_distributions = 2
- mu = theta[0]
- sigma = theta[1]
- weights = theta[2]
- samples = []
- for i in range(n):
- population = [rnd.gauss(mu[i], np.sqrt(sigma[i])) for i in range(number_of_distributions)]
- samples.append(rnd.choices(population, weights=weights))
- sns.distplot(samples)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement