Thanks for your clear explanation. Do you have reason why using micro averaging rather than macro or weighted averaging?

]]>for example, a credit card fraud dataset with 900 “no fraud” and 100 “fraud”, if the prediction model only detect all the majority of 900 “no fraud” data and detecting 0 “fraud” data, using micro, the precision would be 90%.

It is not good because what we want to know is whether there would be a fraud or not and it means that both classes have to be equally measured to show that the model could predict fraud and no fraud cases correctly. ]]>

Thanks for this post. I was just wondering: isn’t this issue regarding the same amount of FP and FN in micro averaging true for binary classification as well? You always have to wrongly reject one class if you falsely accept another. In other words, you directly compare two classes regardless of how many other classes potentially exist.

Best,

Robin

do you mean a paper? No, there is just this blog article. I found most information on Wikipedia, you probably find more sources there

Best,

Simon ]]>

first you have to understand what 1 << k means. “<<” is the bit-shift operator (to the left). This means that if k = 1, 1 is moved 1 position to the left.

k = 1 (decimal) => 0001 (binary) << 1 = 0010 (binary) = 2 (decimal)

k = 2 (decimal) => 0001 (binary) << 2 = 0100 (binary) = 4 (decimal)

and so on…

“&” is the bit-wise and operator. It takes two integers, looks at their binary representation and returns an integer that has 1 in the binary representation at every position where the two input integers both have a 1.

Example:

a = 5 (decimal) = 0101 (binary)

b = 3 (decimal) = 0011 (binary)

=> a & b = 0101 & 0011 = 0001 (binary) = 1 (decimal)

a = 2d = 0010b

b = 6d = 0110b

=> a & b = 0010b & 0110b = 0010b = 2

In this algorithm, the right side of the bit-wise and is always a power of 2. This means that the binary representation has exactly one 1 in it and every other position is 0.

In general: 1 << k = 2^k

So i & 1 << k basically checks if the number i has a 1 at position k in its binary representation. If yes, element k is included in subset i.

I hope this helps you

]]>BTW, may I ask what does “i&1 << k" mean? ]]>