from sklearn.datasets.samples_generator import make_blobs
centers = [[-2,2],[2,2],[0,4]]
x,y = make_blobs(n_samples=60, centers=centers, cluster_std=0.6)
x
array([[-0.08600408, 4.76782848],
[ 1.3264166 , 2.37070694],
[-1.72062744, 2.02582475],
[ 1.82236685, 2.37271542],
[-0.30905406, 3.33599758],
[-0.82732245, 5.17405475],
[-1.21796898, 2.71879751],
[ 2.56344749, 2.46380225],
[ 0.52656441, 3.7157634 ],
[-1.71565964, 1.58782602],
[-1.99734574, 2.57046735],
[-0.6105748 , 4.32747884],
[-2.47076485, 0.88160997],
[-3.09683627, 1.41810538],
[-0.52244609, 2.88409006],
[ 0.39124443, 3.93395445],
[-1.06694802, 2.32322413],
[ 1.90409727, 2.65346845],
[-1.47557156, 1.61860603],
[-0.04215071, 4.18023282],
[ 1.89614869, 2.19559042],
[ 2.02560988, 1.32335769],
[ 2.91560799, 2.69000016],
[ 1.6580168 , 1.93073504],
[ 2.21438265, 3.15312259],
[ 1.36771487, 2.02817708],
[ 1.47486871, 1.63766953],
[-1.38453032, 2.39746726],
[-2.72504984, 0.29416243],
[ 0.21979213, 4.27991644],
[-1.9511985 , 2.93460142],
[-0.95264873, 3.863339 ],
[ 0.42596559, 4.23156268],
[ 1.14964804, 2.04579981],
[ 2.45720763, 1.15868596],
[ 0.14417972, 3.2681776 ],
[ 1.63766699, 1.79797613],
[-0.46723236, 3.56507274],
[-2.00768023, 2.37756443],
[-0.77164142, 3.07097342],
[-2.656692 , 3.18641188],
[-1.9520929 , 2.09099171],
[ 2.04712466, 1.48390184],
[-2.75281105, 2.12433143],
[ 1.73602442, 1.86827883],
[-1.92312906, 3.43099513],
[ 2.74801908, 2.44293206],
[ 1.78400907, 2.74081806],
[-1.7443908 , 2.54702662],
[ 0.6563619 , 2.89757851],
[-2.33900649, 1.57665199],
[ 0.74381669, 3.35677091],
[-2.98695279, 1.2417663 ],
[ 2.05425203, 1.89126521],
[-0.08953169, 4.82684634],
[ 2.1258002 , 3.38440537],
[-1.61529457, 2.17528076],
[ 0.11167727, 4.1635114 ],
[ 0.31234374, 4.37822912],
[-0.11923692, 4.38824902]])
y
array([2, 1, 0, 1, 2, 2, 0, 1, 2, 0, 0, 2, 0, 0, 2, 2, 0, 1, 0, 2, 1, 1, 1,
1, 1, 1, 1, 0, 0, 2, 0, 2, 2, 1, 1, 2, 1, 2, 0, 2, 0, 0, 1, 0, 1, 0,
1, 1, 0, 2, 0, 2, 0, 1, 2, 1, 0, 2, 2, 2])
len(y)
60
import matplotlib.pyplot as plt
import numpy as np
plt.figure(figsize=(20,10))
c= np.array(centers<