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

Function get_data

supervised_class/knn_fail.py:14–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12from knn import KNN
13
14def get_data():
15 width = 8
16 height = 8
17 N = width * height
18 X = np.zeros((N, 2))
19 Y = np.zeros(N)
20 n = 0
21 start_t = 0
22 for i in range(width):
23 t = start_t
24 for j in range(height):
25 X[n] = [i, j]
26 Y[n] = t
27 n += 1
28 t = (t + 1) % 2 # alternate between 0 and 1
29 start_t = (start_t + 1) % 2
30 return X, Y
31
32
33if __name__ == '__main__':

Callers 1

knn_fail.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected