Log inStart free
LESSON 22.06 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

BM25

Watch BM25 score 12 help pages for a query, one word at a time.


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

Go Pro · $8.25/mo
EXPLAINER · 22.06 · SEARCH BAY3 WORDS · 6 OF 12 DOCUMENTS MATCH
01
Stage 1 of 6 · Find the words
An inverted index lists the documents that hold each query word. A cell shows tf, the count there.
Explain it simply

Keyword search starts from a list for every word, like the index at the back of a book. Each list names the documents that hold the word. 6 of the 12 documents hold a word of “battery drains fast”. The small number in a cell counts the word in that document.

The query “battery drains fast” has 3 words. “battery” is in 5 documents. “drains” is in 1 document. “fast” is in 2 documents.

query words, tf, weightsidf, k1, bscore, top 3, relevantwrong in top 3, missedno match
find the wordsquery: “battery drains fast”documentbatteryin 5drainsin 1fastin 2D1Batterydrainsfast? Lowerthescreenbrightness.D2Batterytips: acoolbatteryisabatterythatlasts.D3ThelaptopchargesfastwiththeUSB-Ccharger.D4…with30percentbatteryleft, evenafterafull…D5ErrorE42meansthelaptopcannotfindthebattery.D6FixerrorE42: openthelaptop, reseatthebattery…D7Fannoiseandoverheating: cleantheairvents.D8Ifthelaptopfeelswarm, keepitonadesk, nota…D9Screenflickers? Restartthecomputerafteranupdate.D10PrintererrorE42: thepapertrayisempty.D11Hotkeys: pressFnandF2todimthescreen.D12Keysstick? Cleanthekeyboardwithdryair.11131111index: “battery” → D1, D2 ×3, D4, D5, D6find the wordsquery: “battery drains fast”documentbatteryin 5drainsin 1fastin 2D1Batterydrainsfast? Lowerthescreenbrightness.D2Batterytips: acoolbatteryisabatterythatlasts.D3ThelaptopchargesfastwiththeUSB-Ccharger.D4…with30percentbatteryleft, evenafterafull…D5ErrorE42meansthelaptopcannotfindthebattery.D6FixerrorE42: openthelaptop, reseatthebattery…D7Fannoiseandoverheating: cleantheairvents.D8Ifthelaptopfeelswarm, keepitonadesk, nota…D9Screenflickers? Restartthecomputerafteranupdate.D10PrintererrorE42: thepapertrayisempty.D11Hotkeys: pressFnandF2todimthescreen.D12Keysstick? Cleanthekeyboardwithdryair.11131111index: “battery” → D1, D2 ×3, D4, D5, D6
Toy: 12 help-centre documents and 3 queries, shared with 22.C1
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
tf(t,d)=count of word t in document d\sy{tf}{data}{\mathrm{tf}(t, d)} = \text{count of word } t \text{ in document } d
tf(battery,D2)=3\mathrm{tf}(\text{battery}, \text{D2}) = 3

tf counts how often the word occurs in the document.

Common mix-ups

MYTHA word that occurs 3 times counts 3 times as much.

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

Predict, then reveal
3 CHECKS · PRO
Q01For “battery drains fast” with k1 1.2, does the long post D4 rise or fall when b is 0?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 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.