ML Notes
Collection of essential mathematical formulas used in machine learning algorithms and evaluation.
Quick reference for key mathematical formulas in machine learning.
Linear Regression
Hypothesis Function:
Cost Function (MSE):
Gradient Descent Update:
Logistic Regression
Sigmoid Function:
σ(z) = 1 / (1 + e^(-z))
Maps output to [0, 1] for probability
Hypothesis:
hθ(x) = σ(θᵀx) = 1 / (1 + e^(-θᵀx))
Cost Function (Log Loss):
Gradient:
Regularization
L1 Regularization (Lasso):
L2 Regularization (Ridge):
Elastic Net:
Evaluation Metrics
Accuracy:
Precision:
Recall (Sensitivity):
F1-Score:
Specificity:
ROC-AUC:
Regression Metrics
Mean Squared Error (MSE):
Root Mean Squared Error (RMSE):
Mean Absolute Error (MAE):
R² Score:
Clustering Metrics
Silhouette Score:
Davies-Bouldin Index:
DB = (1/k) Σᵢ₌₁ᵏ max(dᵢⱼ)
dᵢⱼ = (σᵢ + σⱼ) / dₙ(cᵢ, cⱼ)
σ = avg distance to cluster center
Lower is better
Inertia (K-Means):
Probability & Statistics
Bayes' Theorem:
Normal Distribution (Gaussian):
f(x) = (1 / (σ√(2π))) * exp(-(x - μ)² / (2σ²))
μ = mean, σ = standard deviation
Binomial Distribution:
Conditional Probability:
P(A|B) = P(A ∩ B) / P(B)
Total Probability:
Linear Algebra
Matrix Multiplication:
Transpose:
Inverse:
Determinant (2x2):
Eigenvalues/Eigenvectors:
Norm (L2 / Euclidean):
Norm (L1 / Manhattan):
Neural Networks
Activation Functions:
| ReLU | f(x) = max(0, x) |
| Sigmoid | f(x) = 1 / (1 + e^(-x)) |
| Tanh | f(x) = (e^x - e^(-x)) / (e^x + e^(-x)) |
| Softmax | fᵢ(x) = e^(xᵢ) / Σⱼ e^(xⱼ) |
Forward Pass:
z = Wx + b (linear transformation)
a = σ(z) (activation)
Backpropagation (Chain Rule):
Weight Update:
Batch Normalization:
x̂ᵢ = (xᵢ - μ_batch) / √(σ²_batch + ε)
Normalize batch, scale with γ, shift with β
Decision Trees & Ensemble
Information Gain (ID3):
Entropy:
Entropy(S) = -Σᵢ pᵢ * log₂(pᵢ)
pᵢ = proportion of class iGini Impurity:
Summary
Print this and refer back during:
- Implementing algorithms
- Debugging models
- Understanding research papers
- Interview preparation
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Important ML Formulas.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Machine Learning topic.
Search Terms
machine-learning, machine learning, machine, learning, resources, important, formulas, important ml formulas
Related Machine Learning Topics