# Handling Imbalanced Datasets in Orange

I work in the medical domain, so class imbalance is the rule and not the exception. While I know Python has packages for class imbalance, I don't see an option in Orange for e.g. a SMOTE widget. I have read other threads in Stack Exchange regarding this, but I have not found an answer to how to tackle class imbalance in Orange without resorting to Python programming. Thanks

• Good news! Class imbalance is not a problem! stats.stackexchange.com/questions/357466/…
– Dave
Feb 22, 2021 at 1:20
• @Dave I would not recommend the linked answer to any beginner with regards to imbalanced datasets since the author reveals some prejudice against imbalanced data handling techniques in his comments. Accordingly, one should have some background knowledge to put his reasoning into perspective. Feb 22, 2021 at 12:19

## 1 Answer

You can add class_weights with dictionary containing class weights, e.g.:

class_weight = {0: 1., 1: 20.}


While SMOTE can be used to synthesize new examples for the minority class (the process is called oversampling) in order to get equal weights.

For Orange please check this link.

Please, provide more information so that we can help you.

• Using an existing dataset in Orange, when you examine the Wisconsin Breast Cancer dataset, there are about twice as many benign cases as malignant. That is not a severe class imbalance but one worth discussing. When the dataset is small you don't want to undersample. I know that you don't use accuracy in this scenario and I know a precision-recall curve is better than a ROC curve in this scenario but don't see that as an option in Orange. Again, my question is how would you handle this in Orange as opposed to writing Python script? Feb 22, 2021 at 18:27
• I would suggest to use Python and code directly. Feb 22, 2021 at 21:14
• I will be teaching workshops for busy clinicians on basic data science using Orange. They are not going to learn to code in Python for imbalanced datasets and that is why I am simply asking does that option exist in Orange? Similarly, I don't see an option to transform skewed data in Orange using e.g. log transformation. If it doesn't exist I just want to know for educational purposes. Feb 22, 2021 at 21:37