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

Function test_standardizer

numpy_ml/tests/test_preprocessing.py:56–76  ·  view source on GitHub ↗
(N=15)

Source from the content-addressed store, hash-verified

54
55
56def test_standardizer(N=15):
57 np.random.seed(12345)
58
59 i = 0
60 while i < N:
61 mean = bool(np.random.randint(2))
62 std = bool(np.random.randint(2))
63 N = np.random.randint(2, 100)
64 M = np.random.randint(2, 100)
65 X = np.random.rand(N, M)
66
67 S = Standardizer(with_mean=mean, with_std=std)
68 S.fit(X)
69 mine = S.transform(X)
70
71 theirs = StandardScaler(with_mean=mean, with_std=std)
72 gold = theirs.fit_transform(X)
73
74 np.testing.assert_almost_equal(mine, gold)
75 print("PASSED")
76 i += 1
77
78
79def test_tfidf(N=15):

Callers

nothing calls this directly

Calls 3

fitMethod · 0.95
transformMethod · 0.95
StandardizerClass · 0.90

Tested by

no test coverage detected