Example #1
0
 def test_01(self):
     N = 64
     L = 20
     x = np.cos(np.linspace(0, np.pi, N))[np.newaxis, :]
     y = np.cos(np.linspace(0, np.pi, N))[:, np.newaxis]
     U = x * y
     V = np.random.randn(N, N)
     t = np.sort(np.abs(V).ravel())[V.size - L]
     V[np.abs(V) < t] = 0
     D = U + V
     lmbda = 0.1
     opt = spline.SplineL1.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250,
         'RelStopTol': 5e-4,
         'DFidWeight': V == 0,
         'AutoRho': {
             'Enabled': True
         }
     })
     b = spline.SplineL1(D, lmbda, opt)
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 0.333606246) < 1e-6)
     assert (sl.mse(U, X) < 1e-6)
Example #2
0
 def test_01(self):
     N = 64
     K = 5
     L = 10
     u = np.random.randn(N, K)
     U = np.dot(u, u.T)
     V = np.random.randn(N, N)
     t = np.sort(np.abs(V).ravel())[V.size-L]
     V[np.abs(V) < t] = 0
     D = U + V
     opt = rpca.RobustPCA.Options({'Verbose' : False, 'gEvalY' : False,
                           'MaxMainIter' : 250,
                           'AutoRho' : {'Enabled' : True}})
     b = rpca.RobustPCA(D, None, opt)
     X, Y = b.solve()
     assert(np.abs(b.itstat[-1].ObjFun - 321.493968419) < 1e-6)
     assert(sl.mse(U,X) < 5e-6)
     assert(sl.mse(V,Y) < 1e-8)
Example #3
0
 def test_01(self):
     lmbda = 3
     opt = tvl1.TVL1Denoise.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250
     })
     b = tvl1.TVL1Denoise(self.D, lmbda, opt, axes=(0, 1, 2))
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 6219.6209699337605) < 1e-6)
     assert (sl.mse(self.U, X) < 1e-6)
Example #4
0
 def test_01(self):
     lmbda = 3
     opt = tvl1.TVL1Denoise.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250
     })
     b = tvl1.TVL1Denoise(self.D, lmbda, opt)
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 447.78101756451662) < 1e-6)
     assert (sl.mse(self.U, X) < 1e-6)
Example #5
0
 def test_02(self):
     lmbda = 1e-1
     opt = tvl2.TVL2Deconv.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250
     })
     b = tvl2.TVL2Deconv(np.ones((1)), self.D, lmbda, opt, axes=(0, 1, 2))
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 567.72425227) < 1e-3)
     assert (sl.mse(self.U, X) < 1e-3)
Example #6
0
 def test_02(self):
     lmbda = 1e-1
     opt = tvl2.TVL2Deconv.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250
     })
     b = tvl2.TVL2Deconv(np.ones((1)), self.D, lmbda, opt)
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 45.45958573088) < 1e-3)
     assert (sl.mse(self.U, X) < 1e-3)
Example #7
0
 def test_02(self):
     lmbda = 3
     opt = tvl1.TVL1Deconv.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250,
         'rho': 10.0
     })
     b = tvl1.TVL1Deconv(np.ones((1, 1)), self.D, lmbda, opt, axes=(0, 1))
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 12364.029061174046) < 1e-5)
     assert (sl.mse(self.U, X) < 1e-4)
Example #8
0
 def test_02(self):
     lmbda = 3
     opt = tvl1.TVL1Deconv.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250,
         'rho': 10.0
     })
     b = tvl1.TVL1Deconv(np.ones((1, 1)), self.D, lmbda, opt)
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 831.88219947939172) < 1e-5)
     assert (sl.mse(self.U, X) < 1e-4)
Example #9
0
 def test_01(self):
     lmbda = 1e-1
     opt = tvl2.TVL2Denoise.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 250,
         'rho': 10 * lmbda
     })
     b = tvl2.TVL2Denoise(self.D, lmbda, opt, axes=(0, 1, 2))
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 366.04267554965134) < 1e-3)
     assert (sl.mse(self.U, X) < 1e-3)
Example #10
0
 def test_01(self):
     lmbda = 1e-1
     opt = tvl2.TVL2Denoise.Options({
         'Verbose': False,
         'gEvalY': False,
         'MaxMainIter': 300,
         'rho': 75 * lmbda
     })
     b = tvl2.TVL2Denoise(self.D, lmbda, opt)
     X = b.solve()
     assert (np.abs(b.itstat[-1].ObjFun - 32.875710674129564) < 1e-3)
     assert (sl.mse(self.U, X) < 1e-3)