Comments (8)
Hey @hcp4715 !
have you imported sklearn in your env ?
it should look like this :
from sklearn.externals import joblib
bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"], add=df["Photosensor"], sampling_rate=100)
# plot the processed dataframe, normalizing all variables
nk.z_score(bio["df"]).plot()
of course, you have to import Neurokit as nk and pandas as pd, as well, to use the functions and play around with the data. I've ran into this error and multiple times, untill i realized I just hadn't import the sklearn dependency.
Tell me if it works out for you
from neurokit.py.
For an easy way to fix this is to reverse to an earlier version of scikit-learn
pip install scikit-learn==0.20.0
A more definite would be to remove references to externals.joblib here
NeuroKit.py/neurokit/bio/bio_ecg.py
Line 357 in c958934
and use joblib directly
if quality_model == "default":
quality_model = Path.materials() + 'heartbeat_classification.model'
model = joblib.load(quality_model)
from neurokit.py.
I am super sorry about all this, as I currently don't have time to fix the module as much as I'd like it! Thanks a lot for all the people finding the workarounds 😍 💪
In fact, as I already mentioned somewhere, I plan on starting a massive overhaul, i.e., reimplementing some of the best stuff from neurokit almost from scratch, soon. As the package's scope has become quite fuzzy over the years, the goal of the refactoring is to make it safer, more flexible, more powerful, more documented, and overall better. This will probably be happening in a separated repo first (NeuroKit2?), with the aim of one day replacing the current version.
If you're by any chances interested in being somehow involved in this, please do let me know (e.g. via email [email protected]). I could set up the repo in which we could start discussing ideas, design, roadmap, bugs, priorities and so on
from neurokit.py.
For an easy way to fix this is to reverse to an earlier version of scikit-learn
pip install scikit-learn==0.20.0
A more definite would be to remove references to externals.joblib here
NeuroKit.py/neurokit/bio/bio_ecg.py
Line 357 in c958934
and use joblib directly
if quality_model == "default": quality_model = Path.materials() + 'heartbeat_classification.model' model = joblib.load(quality_model)
Thanks, Louis. I think maybe install an early version will solve this.
from neurokit.py.
Hey @hcp4715 !
have you imported sklearn in your env ?
it should look like this :from sklearn.externals import joblib bio = nk.bio_process(ecg=df["ECG"], rsp=df["RSP"], eda=df["EDA"], add=df["Photosensor"], sampling_rate=100) # plot the processed dataframe, normalizing all variables nk.z_score(bio["df"]).plot()
of course, you have to import Neurokit as nk and pandas as pd, as well, to use the functions and play around with the data. I've ran into this error and multiple times, untill i realized I just hadn't import the sklearn dependency.
Tell me if it works out for you
Dear François,
Thanks for your response, I tried, but I guess the problem is the version of sklearn ;-).
Because my data is mainly skin conductance, so I directly used eda process function, without testing bio_process further. BTW, the EDA data are processed very well.
from neurokit.py.
Some changes suggested there: 06890a4
from neurokit.py.
For an easy way to fix this is to reverse to an earlier version of scikit-learn
pip install scikit-learn==0.20.0
A more definite would be to remove references to externals.joblib here
NeuroKit.py/neurokit/bio/bio_ecg.py
Line 357 in c958934
and use joblib directly
if quality_model == "default": quality_model = Path.materials() + 'heartbeat_classification.model' model = joblib.load(quality_model)
I have tried this, and the following error appears:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-a95faca0bef5> in <module>
1 # ECG analysis - neurokit
----> 2 result_org_2 = nk.ecg_process(X_train[100,:][~np.isnan(X_train[100,:])],
3 sampling_rate=300)
~/opt/anaconda3/envs/ML/lib/python3.8/site-packages/neurokit/bio/bio_ecg.py in ecg_process(ecg, rsp, sampling_rate, filter_type, filter_band, filter_frequency, segmenter, quality_model, hrv_features, age, sex, position)
118 # ===============
119 if quality_model is not None:
--> 120 quality = ecg_signal_quality(processed_ecg["ECG"]["Cardiac_Cycles"], sampling_rate, quality_model=quality_model)
121 processed_ecg["ECG"].update(quality)
122
~/opt/anaconda3/envs/ML/lib/python3.8/site-packages/neurokit/bio/bio_ecg.py in ecg_signal_quality(cardiac_cycles, sampling_rate, quality_model)
353 if quality_model == "default":
354 quality_model = Path.materials() + 'heartbeat_classification.model'
--> 355 model = joblib.load(quality_model)
356
357 # Initialize empty dict
~/opt/anaconda3/envs/ML/lib/python3.8/site-packages/joblib/numpy_pickle.py in load(filename, mmap_mode)
583 return load_compatibility(fobj)
584
--> 585 obj = _unpickle(fobj, filename, mmap_mode)
586 return obj
~/opt/anaconda3/envs/ML/lib/python3.8/site-packages/joblib/numpy_pickle.py in _unpickle(fobj, filename, mmap_mode)
502 obj = None
503 try:
--> 504 obj = unpickler.load()
505 if unpickler.compat_mode:
506 warnings.warn("The file '%s' has been generated with a "
~/opt/anaconda3/envs/ML/lib/python3.8/pickle.py in load(self)
1208 raise EOFError
1209 assert isinstance(key, bytes_types)
-> 1210 dispatch[key[0]](self)
1211 except _Stop as stopinst:
1212 return stopinst.value
~/opt/anaconda3/envs/ML/lib/python3.8/pickle.py in load_global(self)
1524 module = self.readline()[:-1].decode("utf-8")
1525 name = self.readline()[:-1].decode("utf-8")
-> 1526 klass = self.find_class(module, name)
1527 self.append(klass)
1528 dispatch[GLOBAL[0]] = load_global
~/opt/anaconda3/envs/ML/lib/python3.8/pickle.py in find_class(self, module, name)
1575 elif module in _compat_pickle.IMPORT_MAPPING:
1576 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1577 __import__(module, level=0)
1578 if self.proto >= 4:
1579 return _getattribute(sys.modules[module], name)[0]
ModuleNotFoundError: No module named 'sklearn.externals.joblib'
from neurokit.py.
@anniezhi please consider using NeuroKit2 (https://github.com/neuropsychology/NeuroKit) which should work
from neurokit.py.
Related Issues (20)
- preprocessing ecg recorded in fMRI setting
- Not understanding ecg_wave_detector and plot_events_in_signal?
- Neurokit tutorial producing dissimilar results HOT 1
- Bio_process error with sampling rate of 2000 HOT 3
- How to compute QRS duration interval?? HOT 1
- How to solve this error?? HOT 1
- Computing HRV indices with missing data HOT 1
- Issue put on other part, since this is not currently active one..!_read_xdf error with Shimmer3 recording data HOT 1
- ecg_process(): Sequence too short to compute heart rate - optimising for short signal HOT 1
- python 2 compatibility: make bio_eda compatible HOT 2
- Allow custom markers in nk.plot_events_in_signal function HOT 5
- Strange filter order expected by ecg_preprocess HOT 6
- Bug in eda_scr using slow method
- Peaks information in cardiac cycles HOT 2
- Python 2.7: TypeError: unbound method materials() must be called with Path instance as first argument (got nothing instead) HOT 2
- PPG compatibility HOT 1
- TypeError: 'str' object is not callable HOT 3
- I can't see my trigger channel on Neurokit HOT 5
- eda_process: band, order, and frequency are hardcoded
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neurokit.py.