Checkpoint
Vectors and the dot product
Eleven questions across the whole module: combinations, span and bases, the dot product and projection, length, cosine similarity and Cauchy-Schwarz. The numbers are new, and several questions aim at the classic confusions. Work on paper before answering, and write the code without looking back at the lessons if you can. You need 80% to pass.
- Question 1 of 11.
Do and span all of ?
- Question 2 of 11.
Compute . Enter the three entries top to bottom.
resultOne entry per box, top to bottom. 0.25, -2, 3/4 and sqrt(2) all work. Enter moves to the next empty box.
- Question 3 of 11.
In the basis , , what are the coordinates of the vector ? Enter them top to bottom, the coefficient of first, as decimals or fractions.
coordinates in p, qOne entry per box, top to bottom. 0.25, -2, 3/4 and sqrt(2) all work. Enter moves to the next empty box.
- Question 4 of 11.
Which statement about the vectors , and is true?
- Question 5 of 11.
Two vectors have lengths and , and the angle between them is . What is ? Enter a whole number.
a · bType a number: 0.25, -2, 3/4 and sqrt(2) all work.
- Question 6 of 11.
Find for and . Enter its two entries top to bottom, as decimals or fractions.
projOne entry per box, top to bottom. 0.25, -2, 3/4 and sqrt(2) all work. Enter moves to the next empty box.
- Question 7 of 11.
Find the cosine similarity of and . Enter it as a decimal to 3 decimal places.
cos θType a number: 0.25, -2, 3/4 and sqrt(2) all work.
- Question 8 of 11.
Two embeddings have been normalized to length 1, and their cosine similarity is . How far apart are their tips? Enter the distance as a decimal.
distanceType a number: 0.25, -2, 3/4 and sqrt(2) all work.
- Question 9 of 11.
Vectors and have and . Which of these values could take? Select every possible value.
Choose every option that applies.
- Question 10 of 11.
A search index stores one embedding per document. A bug multiplies one document's vector by 3 and leaves every other vector unchanged. For a fixed query, which rankings could change? Select all that apply.
Choose every option that applies.
- Question 11 of 11.
Run the tests before you submit. This question counts as correct if your latest run passes every check.
Code it Write
angle_degrees(a, b): the angle between two nonzero vectors, in degrees, from 0 to 180. RaiseValueErrorif either vector is the zero vector. It must return a real number for every pair of nonzero vectors, parallel ones included.Write your code where the starter saysraise NotImplementedError, then press Run tests. Each check says what it expects.