def test_design_matrix(self): x_train = TEST_DATA['design_matrix']['x_train'] M = TEST_DATA['design_matrix']['M'] dm_expected = TEST_DATA['design_matrix']['dm'] dm = design_matrix(x_train, M) self.assertEqual(np.shape(dm), (20, 8)) np.testing.assert_almost_equal(dm, dm_expected)
def test_design_matrix(self): x_train = TEST_DATA['design_matrix']['x_train'] M = TEST_DATA['design_matrix']['M'] dm = TEST_DATA['design_matrix']['dm'] dm_computed = design_matrix(x_train, M) max_diff = np.max(np.abs(dm - dm_computed)) self.assertAlmostEqual(max_diff, 0, 8)