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

Function get_xor

supervised_class/util.py:23–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 return X, Y
22
23def get_xor():
24 X = np.zeros((200, 2))
25 X[:50] = np.random.random((50, 2)) / 2 + 0.5 # (0.5-1, 0.5-1)
26 X[50:100] = np.random.random((50, 2)) / 2 # (0-0.5, 0-0.5)
27 X[100:150] = np.random.random((50, 2)) / 2 + np.array([[0, 0.5]]) # (0-0.5, 0.5-1)
28 X[150:] = np.random.random((50, 2)) / 2 + np.array([[0.5, 0]]) # (0.5-1, 0-0.5)
29 Y = np.array([0]*100 + [1]*100)
30 return X, Y
31
32def get_donut():
33 N = 200

Callers 1

knn_xor.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected