MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / check_data

Function check_data

mla/metrics/base.py:5–17  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

3
4
5def check_data(a, b):
6 if not isinstance(a, np.ndarray):
7 a = np.array(a)
8
9 if not isinstance(b, np.ndarray):
10 b = np.array(b)
11
12 if type(a) != type(b):
13 raise ValueError("Type mismatch: %s and %s" % (type(a), type(b)))
14
15 if a.size != b.size:
16 raise ValueError("Arrays must be equal in length.")
17 return a, b
18
19
20def validate_input(function):

Callers 2

test_data_validationFunction · 0.90
wrapperFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_data_validationFunction · 0.72