MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / test_hamming

Function test_hamming

numpy_ml/tests/test_utils.py:119–130  ·  view source on GitHub ↗
(N=1)

Source from the content-addressed store, hash-verified

117
118
119def test_hamming(N=1):
120 np.random.seed(12345)
121 i = 0
122 while i < N:
123 N = np.random.randint(1, 100)
124 x = (np.random.rand(N) * 100).round().astype(int)
125 y = (np.random.rand(N) * 100).round().astype(int)
126 mine = hamming(x, y)
127 theirs = scipy.spatial.distance.hamming(x, y)
128 np.testing.assert_almost_equal(mine, theirs)
129 print("PASSED")
130 i += 1
131
132
133def test_minkowski(N=1):

Callers

nothing calls this directly

Calls 1

hammingFunction · 0.90

Tested by

no test coverage detected