1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np from sklearn.cluster import KMeans
np.random.seed(1234) mean1 = [0.5, 0.5] cov1 = [[0.3, 0],[0, 0.3]] x1, y1 = np.random.multivariate_normal(mean1, cov1, 1000).T
mean2 = [0, 8] cov2 = [[1.5, 0], [0, 1]] x2, y2 = np.random.multivariate_normal(mean2, cov2, 1000).T
mean3 = [8, 4] cov3 = [[1.5, 0], [0, 1]] x3, y3 = np.random.multivariate_normal(mean3, cov3, 1000).T
plt.scatter(x1, y1) plt.scatter(x2, y2) plt.scatter(x3, y3)
|