La ML
La ML
Equations
1. Linear Algebra
Vectors and Matrices
• Dot Product: n
X
a·b= ai b i
i=1
• Matrix Multiplication: X
(AB)ij = Aik Bkj
k
• Transpose:
(AT )ij = Aji
• Inverse:
AA−1 = I
Key Properties
• Determinant: det(A)
• Eigenvalues and Eigenvectors: Av = λv
• Expected Value: Z
E[X] = xp(x)dx
P
(continuous) or i xi p(xi ) (discrete)
• Variance:
Var(X) = E[(X − E[X])2 ]
1
Bayes’ Theorem
P (B|A)P (A)
P (A|B) =
P (B)
KL Divergence
X P (xi )
DKL (P ||Q) = P (xi ) log
i
Q(xi )
3. Calculus
Derivatives
• Gradient (Vector of Partial Derivatives):
∂f ∂f
∇f (x) = , ,...
∂x1 ∂x2
• Chain Rule:
∂f ∂f ∂u
= ·
∂x ∂u ∂x
Optimization
w = w − η∇f (w)
4. Linear Regression
• Hypothesis:
ŷ = Xw + b
• Cost Function (Mean Squared Error):
m
1 X
J(w, b) = (ŷi − yi )2
2m i=1
5. Logistic Regression
• Hypothesis (Sigmoid Function):
1
ŷ = σ(Xw) =
1 + e−Xw
• Cost Function (Binary Cross-Entropy):
m
1 X
J(w) = − [yi log(ŷi ) + (1 − yi ) log(1 − ŷi )]
m i=1
2
6. Neural Networks
• Forward Propagation:
z = wT x + b, a = σ(z)
• Backpropagation: Gradient of the loss with respect to weights using the chain
rule.
w = w − η∇J(w; x, y)