-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regparamrange crashes due to gsvd #42
Comments
luisfabib
changed the title
gsvd crashes under certain situations
regparamrange crashes due to gsvd
Oct 20, 2020
Here is a MWE to reproduce the first error described above: import numpy as np
import deerlab as dl
t = np.linspace(0,5,100)
r = np.linspace(2,6,150)
P = dl.dd_gauss(r,[4.5, 0.2])
K = dl.dipolarkernel(t,r)
V = K@P
fit = dl.fitsignal(V,t,r,'P',None,None,uqanalysis=False) resulting in
|
After a short benchmark to get a statistical sense of these errors, it seems to happen too frequently: import numpy as np
import deerlab as dl
import matplotlib.pyplot as plt
alphamin = []
alphamax = []
Npass = 0
Nfails = 0
N = 500
for _ in range(N):
tmax = np.random.uniform(2,8)
rmax = np.random.uniform(2,8)
nt = np.random.randint(80,900)
nr = np.random.randint(80,900)
t = np.linspace(-0.3,tmax,nt)
r = np.linspace(1,rmax,nr)
try:
K = dl.dipolarkernel(t,r)
L = dl.regoperator(r,2)
alphas = dl.regparamrange(K,L)
Npass += 1
except:
Nfails += 1 |
luisfabib
added a commit
that referenced
this issue
Nov 6, 2020
luisfabib
added a commit
that referenced
this issue
Nov 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
regparamrange
employs thedeerlab.utils.gsvd
function which under certain circumstances leads to a crash. Until now crashes have been caused:Thus far these errors seem to depend on the OS, the precision of the hardware and the BLAS linked to Numpy.
Since neither
numpy
norscipy
have a workinggsvd
algorithm (that I could find), there are two options:deerlab.utils.gsvd
regparamrange
. The function has lost some utility now that the regularization parameter is optimized via Golden-search algorithms rather than grid searches.For now the best approach is to just patch
regparamrange
and catch the exception when runninggsvd(K,L)
. Once caught we can just runsvd(K)
as an approximating alternative.The text was updated successfully, but these errors were encountered: