Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- def artificial_dataset(seed=42):
- z = np.random.uniform(low=-1, high=1, size=(400,2))
- result = np.zeros((400,))
- result[np.where(z[:,0]>=0.7)] = 1
- result[np.where((z[:,1]<=0.3) & (z[:,1] >= -0.2 - z[:,0]) )] = 1
- return z, result
- if __name__ == "__main__":
- x,y = artificial_dataset()
- plt.scatter(x[np.where(y==0),1], x[np.where(y==0),0])
- plt.scatter(x[np.where(y==1),1], x[np.where(y==1),0])
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement