Why MATLAB uses log base 2 instead of natural log to calculate entropy and what is the difference?

294 Views Asked by At

0

I write my thesis on the topic of texture analysis and with the help of MATLAB I made some calculations, including on entropy. In the explanation of the formulas, I used the entropy formula used by the MATLAB and I was asked by the judges why I use a logarithm base 2 instead of natural logarithm.

Based on my previous searches, I got the answer that MATLAB uses the logarithm base 2 because information was thought in terms of bits, hence the magical number, 2.

So, my question is, why MATLAB use the base 2 log over natural log? What is the is the advantage of log 2 over log e in this case?

2

There are 2 best solutions below

0
On

I think this can answer your question. https://youtu.be/2s3aJfRr9gE?t=284 Claude Shannon was using bits (log base 2) because he was using the uncertainty of a fair coin flip

0
On

I would wager for the exact same reason we use base 10 for common log, the nonfractional part tells you the length in bits (for base 10 it tells you the number of digits). Not to mention the fact that computers generally do math more native in binary. As is mentioned in the comments, all logarithms are just a constant multiple of each other, so it is really up to taste.