Example #1
0
 def solve(self, x, y):
     self.x = x
     self.y = y
     m = len(x)
     fista.set_fista_param(tol=self.tol, Li0=1, eta=2.0)
     res, steps = fista.fista_solve(self._objective, self._derivative,
                                    np.ones(m+1), 
                                    with_L1_reg=(self.reg != 'L2'))
     print 'Iterate numers:', steps
     return res
Example #2
0
def test_fista_pd_L1():
    fista.set_fista_param(tol=1e-4, eta=2)
    res, opt_v, step = fista.fista_solve(pd_with_L1, der_pd, np.array([0.0971, 0.8235]), with_L1_reg=True)
    assert_almost_equal(res[0], 0)
    assert_almost_equal(res[1], 1.70009, 4)