Hai I am working with blood transfusion data set using SVM classifier.I applied SVC with C=17 and kernel rbf. It is highly imbalanced data set and I balanced it using SMOTE. But class 1 is performing very bad and no prediction in that class. How can I improve this?

from sklearn.svm import SVC
rbf_svc = SVC(C=17)
y_predict = rbf_svc.predict(X_test)
print('Model accuracy score with rbf kernel and C=17 : {0:0.4f}'. format(accuracy_score(y_test, y_predict)))

Result is:

Model accuracy score with rbf kernel and C=17 : 0.7361


       0       0.74      1.00      0.85       106
       1       0.00      0.00      0.00        38
accuracy                           0.74       144 
macro avg       0.37      0.50      0.42       144
weighted avg       0.54      0.74      0.62       144

  • 1
    $\begingroup$ Misconceptions abound when it comes to class imbalance. It might help if you explain why you find the class imbalance so problematic that you’ve applied the SMOTE technique that is statistically iffy at best. (That author, Frank Harrell is one of the top statisticians in the world.) $\endgroup$
    – Dave
    Aug 12, 2022 at 6:35
  • $\begingroup$ Ideally it would be good if the features could be improved. Currently the model cannot distinguish the classes. this is why it always says class 0. $\endgroup$
    – Erwan
    Aug 13, 2022 at 16:16

1 Answer 1


In class imbalance, the cost of miss classification of dominant class suppresses the cost of miss classification for minority class.

To increase cost of instances of minority class, add class weight in SVC

Class weight can be inversely proportional to count of instances. For eg : if class instances are in 1:10 ratio, class weight will be 10:1

You should relax decision boundary by preventing over fit . Thus lower C will reduce overfitting . Keep it 1 or low.


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.