Log inStart free
LESSON 5.11 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Ranking losses

Watch three ranking losses push the scores of one search query into order.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 5.11 · RANKING BAYW = (0.90, −0.40) · 4 OF 13 PAIRS WRONG
01
Stage 1 of 5 · Score the list
A linear model scores 6 documents for one query. 4 of 13 label pairs are in the wrong order.
Explain it simply

A search query brings back a few documents. The model gives each one a score from two features, word match and clicks. The list puts the highest score on top. Right now the model likes word match but dislikes clicks, so d4 sits above d1, the best document.

A list of 6 documents, ranked by score. From the top, the labels read 2, 3, 0, 2, 0, 1.

features x, labels y, target P_yweights wscores s, model P_slosses, pusha missing label step
−101234#docx₁x₂matchclickslabel yscore s = w·xw = (0.90, −0.40)2d11.62.40.486d20.31.5−0.333d30.60.20.461d42.20.61.745d50.20.5−0.024d61.11.80.27one query, ranked by scores = 0.90·x₁ − 0.40·x₂ · 4 of 13 pairs in the wrong order−101234#docx₁x₂matchclickslabel yscore s = w·xw = (0.90, −0.40)2d11.62.40.486d20.31.5−0.333d30.60.20.461d42.20.61.745d50.20.5−0.024d61.11.80.27one query, ranked by scores = 0.90·x₁ − 0.40·x₂ · 4 of 13 pairs in the wrong order
Toy: 1 query, 4 to 8 documents, 2 features; 25 steps, η = 0.2
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
si=w⋅xi\sy{s}{out}{s_i} = \sy{w}{param}{w}\cdot\sy{x}{data}{x_i}
w=(0.90, −0.40)\sy{w}{param}{w} = (0.90,\ -0.40)

Each score is the weights times the features of the document.

Common mix-ups

MYTHOnce every pair is in order, the loss is zero.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With hinge pairs, what is the loss after 25 steps of training?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.