def test_mean_squared_error(self): x = TEST_DATA['mean_error']['x'] y = TEST_DATA['mean_error']['y'] w = TEST_DATA['mean_error']['w'] err = TEST_DATA['mean_error']['err'] err_computed = mean_squared_error(x, y, w) self.assertAlmostEqual(err, err_computed, 8)
def test_mean_squared_error(self): x = TEST_DATA['mean_error']['x'] y = TEST_DATA['mean_error']['y'] w = TEST_DATA['mean_error']['w'] err_expected = TEST_DATA['mean_error']['err'] err = mean_squared_error(x, y, w) self.assertEqual(np.size(err), 1) self.assertEqual(np.array(err).shape, ()) # err must be a single number self.assertAlmostEqual(err, err_expected)
def test_mean_squared_error(self): x = TEST_DATA['mean_error']['x'] y = TEST_DATA['mean_error']['y'] w = TEST_DATA['mean_error']['w'] err_expected = TEST_DATA['mean_error']['err'] err = mean_squared_error(x, y, w) self.assertEqual(np.size(err), 1) self.assertAlmostEqual(err, err_expected)