Resolved: Missclassification
in
Machine Learning with Support Vector Machines
/
Non-linearly separable classes - soft margin problem
I am still confused by missclassification issues in ML models, using your example it's very dangerous to missclassify a fraud transaction for being safe. is there a way to make a model missclassify more specific class than the other
2 answers ( 1 marked as helpful)
Hey Doaa,
Thank you for reaching out!
When dealing with misclassification issues in SVMs or any other ML models, it's indeed crucial to account for the different risks associated with misclassifying certain classes. You can apply several techniques to make the model less likely to misclassify this specific class, the most widely used being:
- When using the SVC class from the scikit-learn library, you can assign different weights to classes using the class_weight parameter. By giving a higher weight to the fraud class, the model will treat misclassifications of this class as more significant.
- After training the SVM, you can adjust the threshold for predicting a class. For instance, you might decide to classify a transaction as fraud if the decision function value is close to zero, making the model more likely to flag borderline cases as fraud.
- Since SVMs are sensitive to the distribution of the training data, you can over-sample the fraud class (which is usally less present in the training data) to make it more balanced with the safe class (typically more abundand). Techniques like SMOTE (Synthetic Minority Over-sampling Technique) can be used to generate synthetic examples of the minority class (fraud).
Of course, there are other more advanced methods that can be employed to handle misclassification issues. Examples of such are anomaly detection, feature engineering, or ensemble methods like boosting. Feel free to explore these methods and others at your own pace.
Kind regards,
365 Hristina
Thank you for the very informative response