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

DS2 prediction in one class only #5

Closed banivyom closed 5 years ago

banivyom commented 5 years ago

I have tried many tricks but DS2 prediction is done all in one class like below: [ 0 0 44033 0] [ 0 0 2050 0] [ 0 0 3220 0] [ 0 0 388 0] The prediction made on DS1 is great achieving good accuracy, but seems like a problem in DS2. I have tried oversampling also but it did not create any difference. Please help asap, my minor project is pending!

mondejar commented 5 years ago

Are you running the file "run_train_SVM.py" ?

What values of C, gamma for the SVM are you employing? What features do you select?

banivyom commented 5 years ago

Yes I'm running run_train_SVM.py C = {0.001, 0.01, 0.1, 1, 10, 100} for all values of C, I'm getting the above confusion matrix. Gamma value tried : 0.0, 0.5

from train_SVM import *

Call different configurations for train_SVM.py

#################################################################################### winL = 90 winR = 90 do_preprocess = True use_weight_class = True maxRR = True compute_morph = {'wvlt'} # 'wvlt', 'HOS', 'myMorph'

multi_mode = 'ovr' voting_strategy = 'ovo_voting_exp' # 'ovo_voting_exp', 'ovo_voting_both'

use_RR = True norm_RR = True

oversamp_method = '' feature_selection = 'slct_percentile' do_cross_val = '' C_value = 0.001 reduced_DS = False # To select only patients in common with MLII and V1 leads_flag = [1,0] # MLII, V1

pca_k = 0

################

With feature selection

ov_methods = {'SMOTE_regular'}#, 'SMOTE_regular'}

C_values = {0.001, 0.01, 0.1, 1, 10, 100} gamma_values = {0.0} gamma_value = 0.0

for C_value in C_values: pca_k = 0

# Single
use_RR = True
norm_RR = True
compute_morph = {'wvlt'}
main(multi_mode, 90, 90, 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)
banivyom commented 5 years ago

Is there anything I should change, Sir?

mondejar commented 5 years ago

There must be an error to get all the predictions on class 2. I recomend you to debug and carefully analize the output of the SVM in a simple test (without oversampling, feature selection, cross val) .

Change the multi_mode = 'ovr' to multi_mode = 'ovo'. This is refers to one-versus-one or one-versus-rest approach.

banivyom commented 5 years ago

Whenever I use feature selection, it gives above matrix, otherwise the results are normal.