Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from sklearn.datasets import make_blobs
# import pandas as pd
import numpy as np
centers=[
[.1,.1],
[.2,.1],
[.3,.1],
[.4,.1],
[.5,.1],
[.6,.1],
[.7,.1],
[.8,.1],
[.9,.1]
]
dataset=None
for chunk_time in range(20):
l=chunk_time//4
u=5+chunk_time//4
print("total,actual=",len(centers[:u]),len(centers[l:u]))
chunk,_=make_blobs(
n_samples=4000,
n_features=2,
centers=centers[l:u],
cluster_std=0.001,
center_box=(0,0),
random_state=42,
shuffle=True
)
dataset=chunk if dataset is None else np.concatenate((dataset,chunk))
np.savetxt("synthetic.csv",dataset,delimiter=",",fmt="%f")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment