def test_hinge_loss1(self): Y = np.array([0, 1]) Z = np.array([-1, 1]) loss = pvml.hinge_loss(Y, Z) self.assertEqual(loss, 0)
def test_hinge_loss3(self): Y = np.array([0, 1]) Z = np.array([1, -1]) loss = pvml.hinge_loss(Y, Z) self.assertEqual(loss, 2)
def loss(self, Y, P): return pvml.hinge_loss(Y, P - 0.5)