Skip to content
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

Error numpy.linalg.LinAlgError: Eigenvalues did not converge during model uncertainty propagation #310

Closed
andreaegg opened this issue Apr 12, 2022 · 0 comments · Fixed by #311
Labels
bug Something isn't working

Comments

@andreaegg
Copy link

When fitting data with my own custom models, I get the following error:

Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\andre\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\Users\andre\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
    run()
  File "c:\Users\andre\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "y:\projects\mqr_nitroxides\analysis\debug.py", line 133, in <module>
    resultlocal = dl.fit(currmodel,currsig,bootstrap=100)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\model.py", line 1010, in fit
    param_uq = bootstrap_analysis(bootstrap_fcn,ysplit,fitresults.model,samples=bootstrap)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\bootstrap_analysis.py", line 151, in bootstrap_analysis
    out = _ProgressParallel(n_jobs=cores,total=nSamples,use_tqdm=verbose)(delayed(bootsample)() for _ in range(nSamples))     
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\bootstrap_analysis.py", line 193, in __call__
    return Parallel.__call__(self, *args, **kwargs)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 1044, in __call__   
    while self.dispatch_one_batch(iterator):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 859, in dispatch_one_batch
    self._dispatch(tasks)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 777, in _dispatch   
    job = self._backend.apply_async(batch, callback=cb)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\_parallel_backends.py", line 208, in apply_async
    result = ImmediateResult(func)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\_parallel_backends.py", line 572, in __init__
    self.results = batch()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 263, in __call__    
    for func, args, kwargs in self.items]
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 263, in <listcomp>  
    for func, args, kwargs in self.items]
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\bootstrap_analysis.py", line 146, in bootsample
    out = fcn(Vsample)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\model.py", line 1006, in bootstrap_fcn
    fit = fitfcn(np.concatenate(ysim))
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\model.py", line 757, in <lambda>      
    fitfcn_ = lambda y: fitfcn(y,[None])
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\deerlab\model.py", line 994, in <lambda>      
    extrapenalty=extrapenalties(penweights), **kwargs)
psd
    eigval, eigvec = np.linalg.eigh(Asym)
  File "<__array_function__ internals>", line 6, in eigh  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\linalg\linalg.py", line 1470, in eigh   
    w, vt = gufunc(a, signature=signature, extobj=extobj)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\linalg\linalg.py", line 94, in _raise_linalgerror_eigenvalues_nonconvergence
    raise LinAlgError("Eigenvalues did not converge")numpy.linalg.LinAlgError: Eigenvalues did not converge

The error seems to appear during the call to numpy.linalg.eigh but not when using scipy.linalg.eigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant