CSchoel / nolds

Nonlinear measures for dynamical systems (based on one-dimensional time series)
MIT License
255 stars 57 forks source link

Running Error #6

Closed lizhiyuan81 closed 6 years ago

lizhiyuan81 commented 6 years ago

I test my installation by running some sample code with: python -m nolds.examples all. However, I met some wrong problems. How to solve this problem. /home/.local/lib/python2.7/site-packages/nolds/measures.py:45: RuntimeWarning: fitting mode 'RANSAC' requires the package sklearn, using'poly' instead RuntimeWarning) Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/.local/lib/python2.7/site-packages/nolds/examples.py", line 75, in plot_lyap() File "/home/.local/lib/python2.7/site-packages/nolds/examples.py", line 40, in plot_lyap trajectory_len=20) File "/home/.local/lib/python2.7/site-packages/nolds/measures.py", line 349, in lyap_r poly = poly_fit(ks[fit_offset:], div_traj[fit_offset:], 1, fit=fit) File "/home/.local/lib/python2.7/site-packages/nolds/measures.py", line 51, in poly_fit model = sklin.RANSACRegressor(sklin.LinearRegression(fit_intercept=False)) UnboundLocalError: local variable 'sklin' referenced before assignment

CSchoel commented 6 years ago

It seems you fixed the problem yourself by using 'poly' or installing sklearn. However, your point is still valid. This should only have been a warning and not an actual error that crashes your code.

Actually, I forgot to rename a variable that would have done the switch to the 'poly' fitting method. Thank you for pointing out that mistake! :smile: