def test_backprop(self): layer = Loss('binary_crossentropy', self.pre_activation) layer.forwardprop(self.X, self.y) got = layer.backprop(self.X, self.y) expected = np.array([[-0.121425], [-0.129134], [0.024423], [-0.141438]]) np.testing.assert_array_almost_equal(got, expected)
def test_backprop(self): layer = Loss('categorical_crossentropy', self.pre_activation) layer.forwardprop(self.X, self.Y) got = layer.backprop(self.X, self.Y) expected = np.array([[-0.16763847, 0.05107491, 0.11656356], [0.01975598, -0.22650574, 0.20674977], [0.00873619, 0.04923977, -0.05797596], [-0.20473984, 0.07537936, 0.12936047]]) np.testing.assert_array_almost_equal(got, expected)
def test_forwardprop(self): layer = Loss('categorical_crossentropy') got = layer.forwardprop(self.X, self.Y) expected = 2.370872 np.testing.assert_almost_equal(got, expected, decimal=6)
def test_forwardprop(self): layer = Loss('binary_crossentropy', self.pre_activation) got = layer.forwardprop(self.X, self.y) expected = 0.582168 np.testing.assert_almost_equal(got, expected, decimal=6)
def test_forwardprop(self): layer = Loss('mse') got = layer.forwardprop(self.X, self.y) expected = 41.889377 np.testing.assert_almost_equal(got, expected, decimal=6)