Skip to content

Instantly share code, notes, and snippets.

@curiousily
Created April 1, 2019 20:22
Show Gist options
  • Save curiousily/dda9d88a4a370e8af830cc1733ddd4fd to your computer and use it in GitHub Desktop.
Save curiousily/dda9d88a4a370e8af830cc1733ddd4fd to your computer and use it in GitHub Desktop.
class TestLoss(unittest.TestCase):
def test_zero_h_zero_y(self):
self.assertAlmostEqual(loss(h=np.array([0]), y=np.array([0])), 0)
def test_one_h_zero_y(self):
self.assertAlmostEqual(loss(h=np.array([1]), y=np.array([0])), 0.5)
def test_two_h_zero_y(self):
self.assertAlmostEqual(loss(h=np.array([2]), y=np.array([0])), 2)
def test_zero_h_one_y(self):
self.assertAlmostEqual(loss(h=np.array([0]), y=np.array([1])), 0.5)
def test_zero_h_two_y(self):
self.assertAlmostEqual(loss(h=np.array([0]), y=np.array([2])), 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment