| 83 | |
| 84 | |
| 85 | def get_donut(): |
| 86 | N = 200 |
| 87 | R_inner = 5 |
| 88 | R_outer = 10 |
| 89 | |
| 90 | # distance from origin is radius + random normal |
| 91 | # angle theta is uniformly distributed between (0, 2pi) |
| 92 | R1 = np.random.randn(N//2) + R_inner |
| 93 | theta = 2*np.pi*np.random.random(N//2) |
| 94 | X_inner = np.concatenate([[R1 * np.cos(theta)], [R1 * np.sin(theta)]]).T |
| 95 | |
| 96 | R2 = np.random.randn(N//2) + R_outer |
| 97 | theta = 2*np.pi*np.random.random(N//2) |
| 98 | X_outer = np.concatenate([[R2 * np.cos(theta)], [R2 * np.sin(theta)]]).T |
| 99 | |
| 100 | X = np.concatenate([ X_inner, X_outer ]) |
| 101 | Y = np.array([0]*(N//2) + [1]*(N//2)) |
| 102 | return X, Y |
| 103 | |
| 104 | |
| 105 | def get_clouds(): |