ML Cheat Sheet: Vectors and Related Concepts
1. Vectors: Quantities with both magnitude and direction, used to represent data points in ML.
2. Row & Column Vectors: A row vector is 1 x n, a column vector is n x 1.
3. Distance from Origin: For vector v = [x, y], distance = sqrt(x^2 + y^2).
4. Euclidean Distance: Distance between two points p and q = sqrt(sum of (pi - qi)^2).
5. Scalar Add/Subtract (Shifting): Adding/subtracting a constant to all elements.
6. Scalar Multiply/Divide: Multiplies/divides each element by a constant (scales the vector).
7. Mean Centering: Subtract mean of vector elements from each element.
8. Vector Add/Subtract: Element-wise operation of adding/subtracting vectors of same dimension.
9. Dot Product: a.b = sum(ai * bi); measures similarity; gives scalar.
10. Cross Product: a x b; only in 3D; gives vector orthogonal to both.
11. Uses of Cross Product: Computing normals, torque, 3D geometry.
12. Angle Between Vectors: cos(theta) = (a.b)/(|a||b|); gives angle using dot product.
13. Cosine Similarity: cos(theta) = (a.b)/(|a||b|); used in text similarity.
14. Unit Vector: A vector with magnitude 1; v_hat = v / |v|.
15. Projection of Vector: proj_a(b) = (a.b / |a|^2) * a; component of b on a.
16. Equation of Line in n-D: x = a + t*d; a is a point, d is direction vector, t is real number.
17. Equation of Hyperplane: w.x + b = 0; w is normal vector, b is bias.
18. Vector Norms: Measure of vector magnitude. L1: sum(|xi|), L2: sqrt(sum(xi^2)), L-infinity:
max(|xi|).