MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_donut

Function get_donut

svm_class/util.py:85–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84
85def 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
105def get_clouds():

Callers 2

donutFunction · 0.90
donutFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected