'Calculate Imbalance Ratio for a multi-class dataset
How can i calculate Imbalance Ratio for a dataset which is imbalanced? I came across a way in which it defined (it's taken from a paper):
given by the imbalance ratio (IR), defined as the ratio of the number of instances in the majority class to the number of examples in the minority class
Now, is this one of the right ways to calculate?
Thanks
Solution 1:[1]
IR = (negative_class/positive_class)
Where positive_class is the number of minority class samples and negative_class is the number of majority class samples.
Solution 2:[2]
Its simple math, to calculate a ratio. For python as you've mentioned multi class you could try,
target_count = np.array([X:int, Y:int, Z:int])
ratio = target_count/target_count.min()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexandre Miguel de Carvalho |
| Solution 2 | iamawesome |
