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

Function is_binary

numpy_ml/utils/testing.py:51–55  ·  view source on GitHub ↗

Return True if array `x` consists only of binary values

(x)

Source from the content-addressed store, hash-verified

49
50
51def is_binary(x):
52 """Return True if array `x` consists only of binary values"""
53 msg = "Matrix must be binary"
54 assert np.array_equal(x, x.astype(bool)), msg
55 return True
56
57
58#######################################################################

Callers 2

lossMethod · 0.85
gradMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected