From 179064aaa4f92599eee5651f5b4468d3a022fbfd Mon Sep 17 00:00:00 2001 From: mrava87 Date: Fri, 23 Aug 2024 10:58:21 -0500 Subject: [PATCH] doc: increased iterations in twist tutorial --- tutorials/twist.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tutorials/twist.py b/tutorials/twist.py index a6ce8a0..c83414a 100644 --- a/tutorials/twist.py +++ b/tutorials/twist.py @@ -59,7 +59,7 @@ def callback(x, pf, pg, eps, cost): L = np.abs((Aop.H * Aop).eigs(1)[0]) tau = 0.95 / L eps = 5e-3 -maxit = 100 +maxit = 300 # IHT l0 = pyproximal.proximal.L0Ball(3) @@ -99,6 +99,7 @@ def callback(x, pf, pg, eps, cost): callback=lambda x: callback(x, l2, l1, eps, costa)) nitera = len(costa) + # TWIST (Note that since the smallest eigenvalue is zero, we arbitrarily # choose a small value for the solver to converge stably) l1 = pyproximal.proximal.L1(sigma=eps) @@ -135,11 +136,11 @@ def callback(x, pf, pg, eps, cost): ############################################################################### # Finally, let's compare the converge behaviour of the different algorithms -fig, ax = plt.subplots(1, 1, figsize=(8, 3)) -ax.semilogy(costi, 'r', lw=2, label=r'$x_{ISTA} (niter=%d)$' % niteri) -ax.semilogy(costf, 'g', lw=2, label=r'$x_{FISTA} (niter=%d)$' % niterf) -ax.semilogy(costa, 'm', lw=2, label=r'$x_{AA-ISTA} (niter=%d)$' % nitera) -ax.semilogy(costt, 'b', lw=2, label=r'$x_{TWIST} (niter=%d)$' % maxit) +fig, ax = plt.subplots(1, 1, figsize=(8, 4)) +ax.loglog(costi, 'r', lw=2, label=r'$x_{ISTA} (niter=%d)$' % niteri) +ax.loglog(costf, 'g', lw=2, label=r'$x_{FISTA} (niter=%d)$' % niterf) +ax.loglog(costa, 'm', lw=2, label=r'$x_{AA-ISTA} (niter=%d)$' % nitera) +ax.loglog(costt, 'b', lw=2, label=r'$x_{TWIST} (niter=%d)$' % maxit) ax.set_title('Cost function', size=15, fontweight='bold') ax.set_xlabel('Iteration') ax.legend() @@ -154,4 +155,3 @@ def callback(x, pf, pg, eps, cost): # When this information is not available, IHT may become suboptimal. In this case the # FISTA or AA-ISTA solvers should always be preferred (over ISTA) and TwIST represents # an alternative worth checking. -