Skip to content

Commit

Permalink
Merge pull request #187 from mrava87/doc-twisttutorial
Browse files Browse the repository at this point in the history
doc: increased iterations in twist tutorial
  • Loading branch information
mrava87 authored Aug 23, 2024
2 parents 9bec836 + 179064a commit 7140c96
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tutorials/twist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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.

0 comments on commit 7140c96

Please sign in to comment.