mondejar / ecg-classification

Code for training and test machine learning classifiers on MIT-BIH Arrhyhtmia database
GNU General Public License v3.0
520 stars 193 forks source link

ValueError: Found array with 0 sample(s) (shape=(0, 59)) while a minimum of 1 is required by StandardScaler. #13

Open sohan-ranjan opened 4 years ago

sohan-ranjan commented 4 years ago

While running the run_train_SVM.py, the feature values do get computed, but not sure if they are getting added . train_SVM.py in main(multi_mode, winL, winR, do_preprocess, use_weight_class, maxRR, use_RR, norm_RR, compute_morph, oversamp_method, pca_k, feature_selection, do_cross_val, C_value, gamma_value, reduced_DS, leads_flag) 195 # scaled: zero mean unit variance ( z-score ) 196 scaler = StandardScaler() --> 197 scaler.fit(tr_features) 198 tr_features_scaled = scaler.transform(tr_features)

NasimSulaiman commented 4 years ago

I am having the same error , How to solve this issue? please help

guidogagl commented 4 years ago

same issue for me, anyone solved it ?

sohan-ranjan commented 4 years ago

I made changes and it's running for me now. Could have been the python 2.7 vs. python 3.7 issue. I don't recollect what all I had changed. It had many hard-coded paths too.

On Thu, Dec 12, 2019 at 11:16 PM guidogagl notifications@github.com wrote:

same issue for me, anyone solved it ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mondejar/ecg-classification/issues/13?email_source=notifications&email_token=ACX7WT52ML3LWQ7WTV7FCZTQYJ2I5A5CNFSM4JSBAN22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGXO2DA#issuecomment-565112076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACX7WTYQGEUBSTHF5AFCPMDQYJ2I5ANCNFSM4JSBAN2Q .

NasimSulaiman commented 4 years ago

In which python version did you run the code?

sohan-ranjan commented 4 years ago

python 3.5 I suppose.

On Fri, Dec 13, 2019 at 10:35 AM NasimSulaiman notifications@github.com wrote:

In which python version did you run the code?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mondejar/ecg-classification/issues/13?email_source=notifications&email_token=ACX7WT5OPOVC5OARD3DDNC3QYMJZRA5CNFSM4JSBAN22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGY5FWI#issuecomment-565301977, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACX7WT4ZXJB4OXZYIM5JQJDQYMJZRANCNFSM4JSBAN2Q .

NasimSulaiman commented 4 years ago

I am using python 3.8 and this is the error i am getting File "C:\Program Files\Python36\lib\site-packages\sklearn\utils\validation.py", line 570, in check_array context)) ValueError: Found array with 0 sample(s) (shape=(0, 59)) while a minimum of 1 is required by StandardScaler.

banivyom commented 4 years ago

(a, b) denotes the shape of data where a is number of rows and, b is the number of columns. (0,59) means there's no data being read.

Kindly check the lines where data is being read in LOAD_MITBIH.py and debug. You can might need to change the way it has been done. Finally delete all pickle files and run codes again.

sameherajili commented 2 years ago

I am having the same error , How to solve this issue? please help

mondejar commented 2 years ago

This error means that your dataset is not loaded. You should check _db_path_ variable from train_SVM.py, and update wherever you have downloaded the dataset.