Back to Blog

Mathematical Formulas in Machine Learning

Kevin
Kevin Toh

Activation Functions

Sigmoid(x)=exex+1=11+ex\text{Sigmoid(x)} = \frac{e^x}{e^x + 1} = \frac{1}{1 + e^{-x}} Tanh(x)=exexex+ex\text{Tanh(x)} = \frac{e^x - e^{-x}}{e^x + e^{-x}} ReLU(x)=max(0,x)\text{ReLU(x)} = \text{max}(0, x)

Loss Functions

1. Mean Absolute Error

MAE=1ni=1nyiyi^\text{MAE} = \frac{1}{n} \sum_{i = 1}^{n} \vert y_i - \hat{y_{i}} \vert

2. Mean Squared Error

MSE=1ni=1n(yiyi^)2\text{MSE} = \frac{1}{n} \sum_{i = 1}^{n} (y_i - \hat{y_{i}})^{2}

3. KL Divergence

Measures the distance between two distributions P(x)P(x) and Q(x)Q(x).

DKL(PQ)=xP(x)log(P(x)Q(x))D_{\text{KL}}(P \Vert Q) = \sum_{x} P(x) \cdot \log{(\frac{P(x)}{Q(x)})}