Ejemplo n.º 1
0
 def test_11(self):
     N = 8
     M = 16
     D = cp.random.randn(N, M)
     s = cp.random.randn(N, 1)
     lmbda = 1e-1
     mu = 1e-2
     try:
         b = bpdn.ElasticNet(D, s, lmbda, mu)
         b.solve()
     except Exception as e:
         print(e)
         assert 0
Ejemplo n.º 2
0
 def test_13(self):
     N = 8
     M = 16
     D = cp.random.randn(N, M)
     s = cp.random.randn(N, 1)
     dt = cp.float16
     opt = bpdn.ElasticNet.Options({
         'Verbose': False,
         'MaxMainIter': 20,
         'AutoRho': {
             'Enabled': True
         },
         'DataType': dt
     })
     b = bpdn.ElasticNet(D, s, lmbda=1.0, mu=0.1, opt=opt)
     b.solve()
     assert b.X.dtype == dt
     assert b.Y.dtype == dt
     assert b.U.dtype == dt
Ejemplo n.º 3
0
 def test_12(self):
     N = 8
     M = 16
     D = cp.random.randn(N, M)
     s = cp.random.randn(N, 1)
     lmbda = 1e-1
     mu = 1e-2
     try:
         opt = bpdn.ElasticNet.Options({
             'Verbose': False,
             'MaxMainIter': 20,
             'LinSolveCheck': True,
             'AutoRho': {
                 'StdResiduals': True
             }
         })
         b = bpdn.ElasticNet(D, s, lmbda, mu, opt=opt)
         b.solve()
     except Exception as e:
         print(e)
         assert 0
     assert list2array(b.getitstat().XSlvRelRes).max() < 1e-5