예제 #1
0
파일: test.py 프로젝트: lgmsantos/l2svm
 def test_1(self):
     (f, g, i) = steepest(self.rows, self.cols, self.vals, self.labels,
             self.weight, self.penalty, 10000, 0)
     expected = np.repeat(2/3, self.n)
     diff = np.linalg.norm(self.weight - expected)
     self.assertLessEqual(diff, 1e-6, '|w* - w|')
     self.assertAlmostEqual(g, 0, delta=1e-6, msg='|grad|')
예제 #2
0
파일: util.py 프로젝트: lgmsantos/l2svm
 def steepest(self, penalty, maxiter=100000, gnormopt=0.01):
     watch = StopWatch()
     with watch:
         (f, g, i) = steepest(self.rows, self.cols, self.vals, self.labels, self.weight, penalty, maxiter, gnormopt)
     return RunResult('reference sd', i, watch.total_seconds, penalty, f, g)