Yes, the notation in the ML/DL world is different than in the math world, which looks confusing at first. In math, log
means log base 10 and they use ln
for natural log. But in the ML/DL world, log
always means natural logarithm. The reason that natural log is preferred is clear once you get into the algorithms: we’re using logs for the loss function and the key point is we need to take the derivatives of the loss functions to implement back propagation, which is the fundamental technique on which learning is built. The beauty of using base e is that the derivatives are nice and clean. If you use log_{10}, then you’d get an extra constant factor every time you take the derivative. And the fundamental mathematical properties are the same, meaning that you would get no advantage from using base 10 logs and it would just make a mess with all the extra constant factors flying around.
I’m not sure historically where this notational difference arose, but one theory would be that 10 or 15 years ago, a lot of the ML work was done using MATLAB and in MATLAB the function names are log
for natural log and log10
for base 10 logs. E.g. Prof Ng’s original Stanford Machine Learning course, which I think was first published in 2011 or maybe 2012, used MATLAB as the implementation language, so it would have been natural (pun intended ) to use the same function name that MATLAB used. Of course these days we’re using python and it’s the same there:
np.log
is natural log and np.log10
is base 10 log.