예제 #1
0
 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)
예제 #2
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)
예제 #3
0
 def loss(self, Y, P):
     return pvml.hinge_loss(Y, P - 0.5)