Skip to content

Commit

Permalink
Bug fix + parameter changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sidward committed May 14, 2022
1 parent a692176 commit db3b25b
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 66 deletions.
6 changes: 3 additions & 3 deletions demo_brain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
devnum = 0 # Device to run optimization on.
ptol = 0.5 # Percentage tolerance between iterates.
ptol = 0.2 # Percentage tolerance between iterates.
pdeg = 2 # Degree of polynomial to use.
norm = "l_2" # Cost function for polynomial optimization.
l = 0 # Smallest eigenvalue of A.H * A, if known.
Expand Down Expand Up @@ -60,13 +60,13 @@
# Empty run.
optalg.unconstrained(2, 1, A, b, lp_proxg, verbose=False)
# Actual run.
optalg.unconstrained(500, ptol, A, b, lp_proxg, save=loc)
optalg.unconstrained(100, ptol, A, b, lp_proxg, save=loc)

loc = "results/brain/pc"
os.mkdir(loc)
# Empty run.
optalg.unconstrained(2, 1, A, b, pc_proxg, save=loc, l=l, norm=norm,
pdeg=pdeg, verbose=False)
# Actual run.
optalg.unconstrained(500, ptol, A, b, pc_proxg, save=loc, \
optalg.unconstrained(100, ptol, A, b, pc_proxg, save=loc, \
l=l, norm=norm, pdeg=pdeg)
6 changes: 3 additions & 3 deletions demo_cardiac_unconstrained.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
devnum = 0 # Device to run optimization on.
ptol = 0.5 # Percentage tolerance between iterates.
ptol = 0.2 # Percentage tolerance between iterates.
pdeg = 4 # Degree of polynomial to use.
norm = "l_2" # Cost function for polynomial optimization.
l = 0 # Smallest eigenvalue of A.H * A, if known.
Expand Down Expand Up @@ -59,13 +59,13 @@
# Empty run.
optalg.unconstrained(2, 1, A, b, lp_proxg, verbose=False)
# Actual run.
optalg.unconstrained(500, ptol, A, b, lp_proxg, save=loc)
optalg.unconstrained(100, ptol, A, b, lp_proxg, save=loc)

loc = "results/cardiac_unconstrained/pc"
os.mkdir(loc)
# Empty run.
optalg.unconstrained(2, 1, A, b, pc_proxg, l=l, norm=norm, \
pdeg=pdeg, verbose=False)
# Actual run.
optalg.unconstrained(500, ptol, A, b, pc_proxg, save=loc, \
optalg.unconstrained(100, ptol, A, b, pc_proxg, save=loc, \
l=l, norm=norm, pdeg=pdeg)
20 changes: 10 additions & 10 deletions demo_mrf3d.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
devnum = 0 # Device to run optimization on.
ptol = 0.5 # Percentage tolerance between iterates.
pdeg = 9 # Degree of polynomial to use.
norm = "l_2" # Cost function for polynomial optimization.
l = 0 # Smallest eigenvalue of A.H * A, if known.
blk = 8 # Block size for locally low-rank.
lp_lamda = 2.5e-6 # Regularization value for LP.
pc_lamda = 5e-5 # Regularization value for PC.
devnum = 0 # Device to run optimization on.
ptol = 0.2 # Percentage tolerance between iterates.
pdeg = 9 # Degree of polynomial to use.
norm = "l_2" # Cost function for polynomial optimization.
l = 0 # Smallest eigenvalue of A.H * A, if known.
blk = 8 # Block size for locally low-rank.
lp_lamda = 2.5e-6 # Regularization value for LP.
pc_lamda = 8.75e-5 # Regularization value for PC.

ksp_file = "data/mrf3d/ksp.npy"
trj_file = "data/mrf3d/trj.npy"
Expand Down Expand Up @@ -93,13 +93,13 @@

# Actual run.
loc = "results/mrf3d/lp_%s" % repr(lp_lamda)
optalg.unconstrained(500, ptol, A, b, lp_proxg, save=loc, idx=idx)
optalg.unconstrained(100, ptol, A, b, lp_proxg, save=loc, idx=idx)

# Empty run.
optalg.unconstrained(2, 1, A, b, pc_proxg, pdeg=pdeg, idx=idx, \
verbose=False)

# Actual run.
loc = "results/mrf3d/pc_%s" % repr(pc_lamda)
optalg.unconstrained(500, ptol, A, b, pc_proxg, save=loc, \
optalg.unconstrained(100, ptol, A, b, pc_proxg, save=loc, \
pdeg=pdeg, idx=idx)
6 changes: 3 additions & 3 deletions demo_radial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
devnum = 0 # Device to run optimization on.
ptol = 0.5 # Percentage tolerance between iterates.
ptol = 0.2 # Percentage tolerance between iterates.
pdeg = 5 # Degree of polynomial to use.
norm = "l_2" # Cost function for polynomial optimization.
l = 0 # Smallest eigenvalue of A.H * A, if known.
Expand Down Expand Up @@ -59,11 +59,11 @@
# Empty run.
optalg.unconstrained(2, 1, A, b, lp_proxg, verbose=False)
# Actual run.
optalg.unconstrained(500, ptol, A, b, lp_proxg, save=loc)
optalg.unconstrained(100, ptol, A, b, lp_proxg, save=loc)

loc = "results/radial/pc"
os.mkdir(loc)
# Empty run.
optalg.unconstrained(2, 1, A, b, pc_proxg, pdeg=pdeg, verbose=False)
# Actual run.
optalg.unconstrained(500, ptol, A, b, pc_proxg, save=loc, pdeg=pdeg)
optalg.unconstrained(100, ptol, A, b, pc_proxg, save=loc, pdeg=pdeg)
Binary file modified figures/brain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/cardiac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/cardiac_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/cardiac_m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/mrf3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/radial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion optalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def unconstrained(num_iters, ptol, A, b, proxg, pdeg=None,
x = proxg(1, x - P(gr))

if accelerate:
if l == 0:
if l > 0:
# DOI: 10.1007/978-3-319-91578-4_2
step = (1 - l**(0.5))/(1 + l**(0.5))
elif stepfn == None:
Expand Down
12 changes: 6 additions & 6 deletions plot_brain.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plot_cardiac_consensus.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plot_cardiac_constrained.ipynb

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions plot_cardiac_unconstrained.ipynb

Large diffs are not rendered by default.

47 changes: 27 additions & 20 deletions plot_mrf3d.ipynb

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions plot_radial.ipynb

Large diffs are not rendered by default.

0 comments on commit db3b25b

Please sign in to comment.