Machine learning

Stage 2 · Lesson 1 of 9

Vectors, matrices and the dot product

The maths you need

In ML, one data point is a , which is just a list of numbers. A house with area 120, 3 bedrooms and age 15 becomes [120, 3, 15]. A whole dataset is a matrix: one row per example and one column per .

The dot product multiplies two vectors item by item and adds up the results, so [1, 2, 3] · [4, 5, 6] = 4 + 10 + 18 = 32. It is the most important operation in this roadmap. A linear model's prediction is the dot product of its and the features.

, used to compare (lists of numbers that stand for words or items), is a dot product after scaling both vectors to length 1. Learn the picture too: a large positive dot product means the vectors point the same way, and zero means they are at right angles.

Common traplearning this on paper only; work every example in NumPy with @ as you go.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Keep handy

Also worth your time

Mark this stage as not done?