In [ ]:
%matplotlib inline
In [ ]:
# Code source: Andrew Heusser
# License: MIT
# import
import hypertools as hyp
import numpy as np
from scipy.stats import multivariate_normal
# simulate clusters
cluster1 = np.random.multivariate_normal(np.zeros(3), np.eye(3), size=100)
cluster2 = np.random.multivariate_normal(np.zeros(3)+3, np.eye(3), size=100)
data = np.vstack([cluster1, cluster2])
# get cluster labels
cluster_labels = hyp.cluster(data, n_clusters=2)
# plot
hyp.plot(data, '.', hue=cluster_labels)