Skip to content

Instantly share code, notes, and snippets.

@paulegradie
Created August 4, 2019 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulegradie/a4c41e763822d73f1c2a1eb46f6712f9 to your computer and use it in GitHub Desktop.
Save paulegradie/a4c41e763822d73f1c2a1eb46f6712f9 to your computer and use it in GitHub Desktop.
TestGist
import numpy as np
def make_blob_part(mean, cov, num_points=500):
x, y = np.random.multivariate_normal(mean, cov, num_points).T
return np.hstack((x.reshape(-1, 1), y.reshape(-1, 1)))
mean1 = [-10, 10]
mean2 = [-15, 5]
mean3 = [-9, 3]
cov1 = [[4, 0], [0, 3]] # diagonal covariance
cov2 = [[2, 0], [0, 3]] # diagonal covariance
cov3 = [[2, 0], [0, 3]] # diagonal covariance
params = zip([mean1, mean2, mean3], [cov1, cov2, cov3])
blob = np.vstack([make_blob(x, y) for x, y in params])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment