def test_1(self): l2svm.run() raiseException() expected = np.repeat(2/3, self.n) diff = np.linalg.norm(self.weight - expected) self.assertLessEqual(diff, 1e-12, '|w* - w|') self.assertAlmostEqual(l2svm.gradnorm(), 0, delta=1e-12, msg='|grad|')
def gradnorm(self): try: return l2svm.gradnorm() finally: check_error()
def assertNorm(self): gnorm = l2svm.gradnorm() raiseException() self.assertAlmostEqual(self.expected(), gnorm, delta=1e-12)