Advertisement
Guest User

dataset_artificial_12345

a guest
Feb 21st, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. def artificial_dataset(seed=42):
  5. z = np.random.uniform(low=-1, high=1, size=(400,2))
  6. result = np.zeros((400,))
  7. result[np.where(z[:,0]>=0.7)] = 1
  8.  
  9. result[np.where((z[:,1]<=0.3) & (z[:,1] >= -0.2 - z[:,0]) )] = 1
  10.  
  11. return z, result
  12.  
  13.  
  14. if __name__ == "__main__":
  15. x,y = artificial_dataset()
  16. plt.scatter(x[np.where(y==0),1], x[np.where(y==0),0])
  17. plt.scatter(x[np.where(y==1),1], x[np.where(y==1),0])
  18. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement