Skip to content

Instantly share code, notes, and snippets.

@n0obcoder
Created June 20, 2019 20:06
Show Gist options
  • Save n0obcoder/e774ee019cab978a23d46ac198dcd39e to your computer and use it in GitHub Desktop.
Save n0obcoder/e774ee019cab978a23d46ac198dcd39e to your computer and use it in GitHub Desktop.
results_dir= 'results'
if not os.path.exists(results_dir):
os.mkdir(results_dir)
x_data = np.array((),dtype=np.int32)
y_data = np.array((),dtype=np.int32)
#...................................
x, y = gen_data(100,[5,5]) # generating 100 data points around the center [5,5]
plt.scatter(x, y)
x_data = np.hstack((x_data, x))
y_data = np.hstack((y_data, y))
#...................................
x, y = gen_data(50,[-2,4]) # generating 50 data points around the center [-2,4]
plt.scatter(x, y)
x_data = np.hstack((x_data, x))
y_data = np.hstack((y_data, y))
#...................................
x, y = gen_data(300,[2,3]) # generating 300 data points around the center [2,3]
plt.scatter(x, y)
x_data = np.hstack((x_data, x))
y_data = np.hstack((y_data, y))
#...................................
#plt.scatter(x_data,y_data)
plt.title('k-Means Clustering')
plt.xlabel('Some Feature x')
plt.ylabel('Some Feature y')
plt.grid()
plt.savefig(results_dir + '/generated_data.jpg')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment