Member-only story

Why do we see so many logarithms in machine learning (log)

Renee LIN
2 min readJul 9, 2022

--

If you jump into the loss functions in machine learning algorithms, you might encounter many logarithms. Why?

  1. What is a logarithm
  2. The traits of the logarithm
  3. Why do we use it in machine learning

1. What is a logarithm

A logarithm is the inverse of an exponential.

a^x = y
log_a(y) = x

x means how many times a multiplied by itself. A common one is a =10.

10^2 = 100
log_10(100) = 2

2. The traits of the logarithm

(1) It turns multiplication into addition

One rule of logs is that log(A*B*C) = log(A) + log(B) + log(C)
log{(2%)*(3%)*(4%)}= log(2%) + log(3%) + log(4%)

The output of (2%)*(3%)*(4%) is really small 0.000024, on the other hand, log(2%) + log(3%) + log(4%) is (-1.699) + (-1.523) +(-1.398) = -4.62

(2) It makes the exponential relationships easier to interpret

Raw data and Base-10 log of total U.S. COVID-19 case count [1]

--

--

Renee LIN
Renee LIN

Written by Renee LIN

Passionate about web dev and data analysis. Huge FFXIV fan. Interested in health data now.

No responses yet