I'm trying to classify words based on EMG signals using a support vector machine as my model. My dataset includes 15 classes (words) with 230 repetitions and 1000 features each. I already merged all files together to make it easier. The preprocessing steps I used are standard scaler and Principal Component Analysis. However, the accuracy I got was only 56%. I found online that using wavelet transform will help improve this but it made it worse instead. I only got around 6% accuracy! If you know what I'm doing wrong, can you please explain it to me? I attached my code below. I'm a beginner in machine learning as well so if you have the time, it would really help if you give detailed answers. Thank you so much!!

cf = pd.read_csv('EMG-TrainTestDataset.csv')

# Define input and output
X = cf.drop(axis=0, columns=['WORD'])
Y = cf.WORD

# Split into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.1,random_state=82)

#Apply CWT for feature extraction
coeff, freqs = pywt.cwt(X_train,100,'gaus8')
X_train = np.array(coeff).transpose(2,0,1).reshape(-1,X_train.shape[1])

coeff, freqs = pywt.cwt(X_test,100,'gaus8')
X_test = np.array(coeff).transpose(2,0,1).reshape(-1,X_test.shape[1])

# Standardizing the features
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = scaler.transform(X_test)

#Apply Dimensionalitty reduction
pca = PCA()
X_train =pca.fit_transform(X_train)
X_test = pca.transform(X_test)

#Create Model
model = SVC(kernel="linear",gamma=1,C=1)
model.fit(X_train, y_train)

#Test using 10% testing dataset
y_pred = model.predict(X_test)
print("Accuracy:",metrics.accuracy_score(y_test, y_pred)*100)
  • $\begingroup$ C is a critical hyperparameter for SVM, and there is no indication that you have tuned it. $\endgroup$
    – Jon Nordby
    Commented Nov 25, 2023 at 20:43

1 Answer 1


Welcome to datascience.stackexchange.

In my experience using the coeff returned from the wavelet transformation directly - indeed doesn't work well for ml-pipelines.

My practice usually includes extracting different statistics out of them, like: percentiles, entropy, zero / mean crossings, etc.. Be creative and try them at random or at grid-search like pattern. Whenever in doubt - use less then more :)

This would also have the nice side-effect of reducing your relatively high dimentionality.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.