Skip to content

Commit 7140c96

Browse files
authored
Merge pull request #187 from mrava87/doc-twisttutorial
doc: increased iterations in twist tutorial
2 parents 9bec836 + 179064a commit 7140c96

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tutorials/twist.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def callback(x, pf, pg, eps, cost):
5959
L = np.abs((Aop.H * Aop).eigs(1)[0])
6060
tau = 0.95 / L
6161
eps = 5e-3
62-
maxit = 100
62+
maxit = 300
6363

6464
# IHT
6565
l0 = pyproximal.proximal.L0Ball(3)
@@ -99,6 +99,7 @@ def callback(x, pf, pg, eps, cost):
9999
callback=lambda x: callback(x, l2, l1, eps, costa))
100100
nitera = len(costa)
101101

102+
102103
# TWIST (Note that since the smallest eigenvalue is zero, we arbitrarily
103104
# choose a small value for the solver to converge stably)
104105
l1 = pyproximal.proximal.L1(sigma=eps)
@@ -135,11 +136,11 @@ def callback(x, pf, pg, eps, cost):
135136
###############################################################################
136137
# Finally, let's compare the converge behaviour of the different algorithms
137138

138-
fig, ax = plt.subplots(1, 1, figsize=(8, 3))
139-
ax.semilogy(costi, 'r', lw=2, label=r'$x_{ISTA} (niter=%d)$' % niteri)
140-
ax.semilogy(costf, 'g', lw=2, label=r'$x_{FISTA} (niter=%d)$' % niterf)
141-
ax.semilogy(costa, 'm', lw=2, label=r'$x_{AA-ISTA} (niter=%d)$' % nitera)
142-
ax.semilogy(costt, 'b', lw=2, label=r'$x_{TWIST} (niter=%d)$' % maxit)
139+
fig, ax = plt.subplots(1, 1, figsize=(8, 4))
140+
ax.loglog(costi, 'r', lw=2, label=r'$x_{ISTA} (niter=%d)$' % niteri)
141+
ax.loglog(costf, 'g', lw=2, label=r'$x_{FISTA} (niter=%d)$' % niterf)
142+
ax.loglog(costa, 'm', lw=2, label=r'$x_{AA-ISTA} (niter=%d)$' % nitera)
143+
ax.loglog(costt, 'b', lw=2, label=r'$x_{TWIST} (niter=%d)$' % maxit)
143144
ax.set_title('Cost function', size=15, fontweight='bold')
144145
ax.set_xlabel('Iteration')
145146
ax.legend()
@@ -154,4 +155,3 @@ def callback(x, pf, pg, eps, cost):
154155
# When this information is not available, IHT may become suboptimal. In this case the
155156
# FISTA or AA-ISTA solvers should always be preferred (over ISTA) and TwIST represents
156157
# an alternative worth checking.
157-

0 commit comments

Comments
 (0)