SchoolWhool
Quizzes and saved progress, freeSign in freeSign in
Maths · Module 2

Vectors

Take each lesson, answer its quiz, then do its practice. After the last lesson come the module quiz, the project and the interview questions.

Lessons

  1. 2.1VectorsSee a row of data as a point and as an arrow, in any number of dimensions.
  2. 2.2Vector Arithmetic and NormsAdd, scale and measure vectors, and know that "length" has more than one definition.
  3. 2.3The Dot Product, Angle and ProjectionCompute a dot product and read it as alignment, and project one vector onto another.
  4. 2.4Lines, Planes and HyperplanesRead `wᵀx + b = 0` as a boundary in any dimension: which side a point is on, and how far away it is.
  5. 2.5Shapes and Distance in d DimensionsWrite the shapes that appear as decision regions and constraints, and see why distance behaves differently as the dimension grows.

Module material

Take these after the last lesson, in this order. Next on each page leads through them.

  1. Module quiz15 questions across the whole module. Take it after the last lesson; your first pick on each question is the one that counts.
  2. PracticeStated as a problem, with no template and no step-by-step instructions. Working out the steps is the point.
  3. NotebooksOpen them in Google Colab. Each answer is checked as you go: correct, wrong with the expected value, or not answered yet.
  4. Cheat sheetOne page of the module’s terms, rules and gotchas, with the output each rule produces.
  5. Interview questions14 questions interviewers ask on this module’s topics, from first principles to the follow-ups. Each comes with a model answer.

Glossary

Every term the module introduces, with the lesson that introduces it.

origin
the point (0, 0) | where the axes cross 2.1
component
one entry of a vector | 3 in (3, 2) 2.1
vector
an ordered list of numbers; drawn as a point or an arrow from the origin | (3, 2) 2.1
dimension
the number of components | (3, 2, 4) is in three 2.1
row vector
one row, 1 × d | u.reshape(1, -1) 2.1
column vector
one column, d × 1 | u.reshape(-1, 1) 2.1
point cloud
a table drawn as one point per row | the ward's 14 patients 2.1
feature space
one axis per feature | white-cell count against temperature 2.1
vector addition
add matching components; head to tail | (3, 1) + (1, 2) = (4, 3) 2.2
scalar multiplication
every component times one number | 2 · (3, 1) = (6, 2) 2.2
mean vector (centroid)
the component-by-component mean of a set of points | (4, 3) 2.2
norm
a length of a vector | 2.2
L2 (Euclidean) norm
√(Σ vᵢ²), the straight-line length | 5 for (3, −4) 2.2
L1 (Manhattan) norm
Σ \ | vᵢ\ | | 7 2.2
L∞ (max) norm
max \ | vᵢ\ | | 4 2.2
distance
the norm of the difference, ‖a − b‖ | 2.2361 from (3, 1) to (1, 2) 2.2
unit ball
every point with norm at most one | circle, diamond, square 2.2
standardising
subtract the mean, divide by the standard deviation | the lot's age and mileage 2.2
z score
a value in standard deviations from the mean | car 25's age, −0.19 2.2
penalty
a norm of the weights added to a model's error | ridge: ‖w‖₂²; lasso: ‖w‖₁ 2.2
dot product
the sum of the products of matching components | (3, 4) · (2, 1) = 10 2.3
orthogonal
perpendicular; dot product zero | (3, 4) and (0.8, −0.6) 2.3
cosine
the horizontal coordinate of the point at angle θ on the unit circle | cos 60° = 0.5 2.3
angle between vectors
cos θ = a · b / (‖a‖ ‖b‖) | 26.57° 2.3
unit vector
a vector of length one, a / ‖a‖ | (0.6, 0.8) 2.3
projection
the part of a vector along a direction, (b · â) â | (1.2, 1.6) 2.3
count vector
one component per vocabulary word | email 12, (2, 0, 1, 1, 1, 0, 0, 0, 0, 0) 2.3
cosine similarity
the cosine of the angle between two vectors | 0.5714 for emails 12 and 13 2.3
score
w · x + b for a point x | 6 for P = (4, 3) 2.4
normal vector
a vector perpendicular to a line or plane; here w | (1, 2) 2.4
offset (bias)
b, which moves the line without turning it | −4 2.4
half-space
all the points on one side of a line or plane | the positive side 2.4
signed distance
(w · x + b) / ‖w‖, positive on the side w points to | 2.6833 2.4
plane
w · x + b = 0 in three dimensions | x + 2y + 2z − 6 = 0 2.4
hyperplane
the points where w · x + b = 0, in any dimension | 2.4
linear classifier
predicts the class from the sign of w · x + b | the ward line, 14 of 14 2.4
hypersphere
every point at distance r from a centre, in d dimensions | ‖x − c‖₂ = r 2.5
ball
every point within distance r of a centre | ‖x − c‖₂ ≤ r 2.5
hypercube
every component inside the same interval | the unit cube [0, 1]ᵈ 2.5
axis-parallel box
one interval per feature; the region a tree's splits describe | 12 of 14 on the ward 2.5
distance concentration (curse of dimensionality)
in high dimensions, the nearest and farthest neighbours are almost equally far away | ratio 1.123 at d = 1000 2.5