psychoinformatics-de / remodnav

Robust Eye Movement Detection for Natural Viewing
Other
59 stars 16 forks source link

SVD did not converge in Linear Least Squares #13

Closed wangxinzhi0 closed 4 years ago

wangxinzhi0 commented 4 years ago

Hello! when I run this programm, there is an error like this. I don't understand how to deal with this, please give me a favor! Thank you!

raise LinAlgError("SVD did not converge in Linear Least Squares") LinAlgError: SVD did not converge in Linear Least Squares

data['x'][mask] = np.nan data[i] = savgol_filter(data[i], savgol_length, savgol_polyord)

adswa commented 4 years ago

Hi @Xinzhi-Wang,

could you try to provide more information on this? It would be helpful to see the full traceback of the error, the data you are using, a short script that we could use to try and reproduce the error, and the versions of the underlying Python modules. If you can, it would be best if you could you post a minimal working script and a data file here that can reproduce the error you are seeing.

wangxinzhi0 commented 4 years ago

Thank you for replying!

I try to run "anderson.py" in the eval, and I used the same dataset. For my using, I just changed the bathpath of load_data and commented "get(fname)" in "test_labeled.py" MODULES: scipy 1.3.1, numpy 1.17.2

def load_data(category, name, basepath='D:\anaconda_python_exercise\dataset\0remodnav\eval\data'): from scipy.io import loadmat

from datalad.api import get

if basepath is None:
    basepath = op.join(
    'remodnav', 'tests', 'data', 'anderson_etal', 'annotated_data',
    'data used in the article')

fname = op.join(
    basepath,
    category, name + ('' if name.endswith('.mat') else '.mat'))

get(fname)

m = loadmat(fname)

The full traceback of the error are as follow:

Traceback (most recent call last):

File "", line 1, in runfile('D:/anaconda_python_exercise/dataset/0remodnav/eval/anderson.py', wdir='D:/anaconda_python_exercise/dataset/0remodnav/eval')

File "D:\Anaconda3\envs\py3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile execfile(filename, namespace)

File "D:\Anaconda3\envs\py3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/anaconda_python_exercise/dataset/0remodnav/eval/anderson.py", line 442, in confusion('MN', 'ALGO')

File "D:/anaconda_python_exercise/dataset/0remodnav/eval/anderson.py", line 354, in confusion p = clf.preproc(data)

File "D:\Anaconda3\envs\py3\lib\site-packages\remodnav\clf.py", line 835, in preproc data[i] = savgol_filter(data[i], savgol_length, savgol_polyord)

File "D:\Anaconda3\envs\py3\lib\site-packages\scipy\signal_savitzky_golay.py", line 348, in savgol_filter _fit_edges_polyfit(x, window_length, polyorder, deriv, delta, axis, y)

File "D:\Anaconda3\envs\py3\lib\site-packages\scipy\signal_savitzky_golay.py", line 224, in _fit_edges_polyfit polyorder, deriv, delta, y)

File "D:\Anaconda3\envs\py3\lib\site-packages\scipy\signal_savitzky_golay.py", line 191, in _fit_edge xx_edge, polyorder)

File "<__array_function__ internals>", line 6, in polyfit

File "D:\Anaconda3\envs\py3\lib\site-packages\numpy\lib\polynomial.py", line 631, in polyfit c, resids, rank, s = lstsq(lhs, rhs, rcond)

File "<__array_function__ internals>", line 6, in lstsq

File "D:\Anaconda3\envs\py3\lib\site-packages\numpy\linalg\linalg.py", line 2268, in lstsq x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)

File "D:\Anaconda3\envs\py3\lib\site-packages\numpy\linalg\linalg.py", line 109, in _raise_linalgerror_lstsq raise LinAlgError("SVD did not converge in Linear Least Squares")

LinAlgError: SVD did not converge in Linear Least Squares

Thanks for your time! eval.zip

adswa commented 4 years ago

Thanks for the script! I am a bit confused about what you are trying to do. If I remember correctly, the script eval/anderson.py was used initially for testing and plotting purposes for the corresponding publication. It doesn't actually get used in this repository at all anymore.

However, I am still a bit confused on why you would compute results of the Anderson data (I'm sorry if I am missing something here). Is your intention maybe to use remodnav on some data of yours? If so, please try to use the command line call in a terminal (given you have installed remodnav, for example with pip install remodnav): remodnav <path/to/a/datafile> <path/to/outputfilename> <pix2deg> <sampling rate>

wangxinzhi0 commented 4 years ago

Thank you for your patience and advice!I made a mistake that I misunderstood the function of anderson.py.

Now, I think I can solve the problem with your instructions.

Thanks again!

At 2020-01-15 18:03:21, "Adina Wagner" notifications@github.com wrote:

Thanks for the script! I am a bit confused about what you are trying to do. If I remember correctly, the script eval/anderson.py was used initially for testing and plotting purposes for the corresponding publication. It doesn't actually get used in this repository at all anymore.

I'm confused about how you ran eval/anderson.py. Did you execute the commented out functions at the end of the script in an interactive python session? As far as I can see, a terminal call such as python eval/anderson.py will not run anything in the script, its just function definitions. I have tried to recreate what you might be doing (using the software versions you specified) and cannot reproduce the error you are seeing. How did you obtain the dataset? Did you try to clone the repository, not comment out the get calls in the script, and run whatever you are running in the cloned repository so that you don't need to change the basepath? If you are interested in computing the remodnav results for the dataset that Anderson et al. provided, I'd recommend checking out https://github.com/psychoinformatics-de/paper-remodnav/. The functions used in eval/anderson.py were used and extended in the code/mk_figuresnstats.py in this repository. You should follow the instructions in the README, and running make in the root of the repository should execute everything.

However, I am still a bit confused on why you would compute results of the Anderson data (I'm sorry if I am missing something here). Is your intention maybe to use remodnav on some data of yours? If so, please try to use the command line call in a terminal (given you have installed remodnav, for example with pip install remodnav): remodnav <path/to/a/datafile> <path/to/outputfilename>

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

adswa commented 4 years ago

I'm glad I could clarify! I will close this issue, but feel free to reopen or open a new issue if you encounter additional problems.