Skip to main content

13.2 Three Filters Before the Frontier

13.2.1 Content seen test with shingles and fingerprints

Why does a crawler throw away a freshly fetched page it just paid to download? Because the web holds copies of copies, and indexing the same article twice buys nothing.

The web holds copies of copies, so each freshly fetched page must pass a content-seen test. The rule is direct: if the page content already sits in the index, stop and process it no further. Comparison runs through document fingerprinting with shingles, which are short overlapping word chunks hashed into a compact fingerprint. A shingle (a run of several adjacent words, for example five words sliding one word at a time across the text) gives a local snapshot, and a fingerprint (a short hash built from those shingles) gives the whole page one compact signature. Two pages with matching fingerprints count as the same content.

A small picture helps. Imagine tearing a long receipt into overlapping strips five lines long, stamping a number on each strip, then keeping only a handful of stamp numbers as the receipt's signature. Two receipts with the same handful of stamps are treated as the same receipt. Where the picture breaks: tiny edits change a few strips but may leave the kept stamps untouched, so near-copies can still match, which is exactly what a crawler wants for mirror detection.

The motive is practical. Dropping known content saves indexing work and saves storage, and both savings lift overall performance. Because the test keys on content rather than address, it still catches copies that arrive under a fully different URL or with hidden changes such as tracking parameters, session identifiers, or mirrored hosts. A checksum of raw bytes would miss pages that differ by one footer line, while shingles tolerate small local changes and still flag the pair as copies.

Scope: The content-seen test assumes the fingerprint store covers what is already indexed and that fingerprints of changed pages can be refreshed. It works best for static or slowly changing text. It does not judge quality or freshness by itself; those decisions belong to priority assignment later.

Visualize a funnel. Fetched pages pour in at the top, the fingerprint check is the first gate, and copies fall out sideways while fresh content flows down. The horizontal axis is arrival order and the vertical drop is pages kept. The takeaway: most of the web's apparent size is repetition, so this first gate does heavy lifting.

Do not equate same address with same content. Two different addresses can hold identical text, and one address can serve different text over time. Test the words, not the address.

The content-seen test compares shingle fingerprints and drops known content before any indexing or queuing work, saving work and space. Survivors still face address-level checks next.

13.2.2 URL filters and robots rules

A URL filter (a simple regular expression test that accepts or rejects a candidate address based on its pattern) decides whether an address belongs to the crawl at all, and the robots check decides whether the site owner permits the visit.

Surviving pages face URL filters, which are simple regular expressions tuned to the task at hand. A focused crawl might accept only academic sites or only one domain, and each candidate URL must match the allowed pattern before it returns to the frontier. An inclusive rule keeps only addresses matching the wanted pattern, while an exclusive rule drops addresses matching an unwanted pattern such as a file type or a spam domain. For example, a pattern that keeps only addresses ending in an academic suffix admits lecture pages and drops store pages.

Alongside these sits the robots check: only pages the site's robots file permits are considered, and only after the duplicate checks pass. The robots exclusion file (a small text file named robots.txt placed at the root of a site that names which crawler agents may fetch which path prefixes) must be fetched and honored before the crawler touches the target page. A cached copy of that file is reused across many addresses from the same host so the crawler does not re-fetch it per URL. Honoring those permissions is an act of politeness, and it also trims wasted fetches, which adds efficiency. Compliance here is voluntary but enforced in practice: servers that see rude behavior block the crawler by address.

The order matters. Filtering by pattern is cheap and local, while robots handling needs host-level care, so both sit after the content test and before re-queuing. A URL that fails either test never re-enters the frontier.

13.2.3 Duplicate URL elimination and priority

Duplicate URL elimination removes addresses already waiting in the frontier or already crawled and parsed. Nothing already seen goes back into the queue. The check runs on normalized addresses with a fast lookup table, so an address already queued or already fetched is dropped in constant time. This is an address test, unlike the earlier content test: the same words under a new address pass this gate but were already stopped by fingerprints, while the same address seen twice is stopped here even when the words changed.

Each admitted URL draws a priority. The frontier still drains first-in first-out within its lanes, but politeness, quality, freshness, and related factors shape which URL leaves next. Quality (an estimate of how useful a page is likely to be, often from link evidence) pushes the most useful and most key pages forward. Freshness (an estimate of how fast a page changes, often from past fetch history) pushes fast-changing pages such as news items forward. Only a fresh URL, never indexed or crawled before, earns a slot, and among fresh URLs the high-quality and fast-changing ones leave first.

Picture two lanes at a toll gate. One lane holds careful, rarely changing reference pages and the other holds fast news pages. The gate lets the urgent lane through more often while still serving both. The one-sentence read is that priority decides order while elimination decides membership.

Duplicate elimination keeps the frontier free of repeats and priority decides who leaves first, with quality pulling useful pages forward and freshness pulling changing pages forward. Together with fingerprints and filters, these three gates answer what earns a second visit.

13.2.4 Student questions and answers

Q: A fresh page just arrived. How do we test whether its content already sits in the index? A: Compare documents with shingles and document fingerprinting. Hash each page into a fingerprint from its overlapping word chunks and match fingerprints against the store of seen content. A match means the content is already seen, so stop processing that page and do not index or re-queue it. This works even when the copy arrives under a fully different URL.

Several students asked the same doubt in different words, so one canonical answer covers the group.

Q: Why throw away known or duplicate content at all? A: Two savings drive the choice. First, it saves indexing work, because no postings are built for words already stored. Second, it saves storage, because no second copy of the text or postings is kept. Both savings lift performance. The content-based form of the test is strong because it catches copies that carry a fully different URL, which an address-only check would miss.

13.3 Normalization Distributed Crawling and DNS

13.3.1 Relative URLs become absolute URLs

A page says "click here" with a sideways pointer. Which exact address should the frontier store so every worker fetches the same target?

A page may carry a relative URL, which points sideways from the current location, such as a short path that only makes sense next to its parent page, while the frontier wants the absolute URL, which names the full parent address including host and path. A relative URL (an incomplete address resolved against the page that holds it) is cheap for authors but ambiguous for a queue. An absolute URL (the complete address that names the true target page on its own) is unambiguous and safe to share across workers.

During parsing the crawler must normalize each relative link into its absolute form and queue only the absolute form. URL normalization (the step that turns each extracted relative link into its full absolute address and tidies equivalent spellings into one canonical form) runs right after filtering and before duplicate elimination, because only canonical absolute forms can be compared for duplicates. Relative forms can sprout confusing side paths, where the same target looks like many different queue entries, while the absolute form names the true target page.

A page at address holds a relative link such as a bare sub-path. The parser joins that sub-path to the parent address to form the full absolute URL . Only is tested for duplicates and queued. If two different pages link to the same target with different relative spellings, both normalize to the same and the second one is dropped as a duplicate.

Exam note: Expect questions that ask which form enters the frontier, and answer with the absolute form. Relative links are resolved at parse time and never queued as-is.

13.3.2 Host splitter and its duplicate side effect

One thread cannot crawl the web fast enough, so parallel crawling spreads fetch threads across many nodes. A host splitter routes URLs to nodes and assigns which crawler handles which host. In practice the splitter hashes or maps each host name to one worker node, so all addresses from one host go to the same worker. This new stage sits between URL filtering and duplicate deletion: each node filters locally, the splitter forwards each surviving URL to its owner node, and only then does the owner run duplicate elimination against its local frontier.

This carries one cost: duplicate deletion can no longer rest on a local fingerprint cache. Copies need not share a domain, and pages change over time, so some potential duplicates slip through and return to the frontier. The reason is structural. Fingerprints cannot be split by host the way addresses can, because the same article can live on two unrelated hosts. A lookup for a fingerprint then needs a call to another node or a partitioned store keyed by fingerprint value rather than host, and there is little repeat traffic to cache since popular fingerprints do not exist the way popular hosts do. Add change over time, which forces old fingerprints to be deleted and re-stored with the address, and the content-seen check in a distributed fleet stays weaker than in a single-process crawler.

Scope: Host-based splitting assumes hosts far outnumber worker nodes, so each node holds many hosts and stays busy. It buys fetch speed and nearby-host locality at the price of weaker copy detection. When exact copy removal matters more than speed, fingerprints must be partitioned by fingerprint value with remote lookups, and requests should be batched.

Picture one post office sorting letters by city before delivery. Sorting by city is fast and each carrier learns local streets, but two identical letters mailed in different cities are never compared side by side. The takeaway matches the lecture warning: distribution buys speed and weakens duplicate removal, and that trade-off is worth naming outright.

Do not place duplicate elimination before the splitter and expect it to stay correct. Each node would then deduplicate only what it has seen locally, and cross-node copies would still pass. The splitter must come first so each host has one owner, with the known cost that content-level copies across hosts can leak through.

The host splitter assigns each host to one crawler node for speed and locality, placed after filtering and before per-node duplicate elimination, with the accepted side effect that some cross-host duplicates return to the frontier.

13.3.3 DNS resolution bottleneck and the five attempt rule

DNS resolution (the step that turns a host name such as a readable site name into the numeric IP address a fetcher dials) looks trivial but sets the speed limit for the whole crawl.

Names that humans read must turn into IP addresses that machines fetch, and that turn is DNS resolution. The lookup is recursive and synchronous: a thread sends a request to the DNS server and waits for the reply, blocked until the right address arrives. In practice the first server contacted may call further servers, so one lookup can mean several round trips across the network lasting seconds. That wait can jam the whole head of the pipeline and add latency plus sync strain, because standard library lookups block every thread at that node until the first request completes, which threatens a fetch rate of hundreds of pages per second.

The working fix has two parts. First, cache recent host-to-address answers so repeat hosts skip the network. Politeness limits how well this works, since the crawler deliberately spaces visits to one host. Second, replace blocking waits with a custom resolver: a worker sends its request, performs a timed wait, and lets other threads run, while one dedicated listener thread watches the DNS port and wakes the right worker when its answer arrives. Give each lookup a waiting threshold, and if the server stays slow while other threads wait, stop that attempt and hand resources to another thread, then resume later.

The widely followed rule grants five attempts with a growing wait each round. Past the fifth miss, terminate that lookup and take up a new request. Concretely, the wait starts near one second and grows exponentially toward tens of seconds across the five tries, in respect of host names that genuinely take that long. Real-world: every large crawler fleet hits this same DNS wait, so the retry budget is standard operating practice rather than a corner case. It keeps one slow host from freezing a whole node while still giving slow but valid hosts a fair chance.

Visualize a phone book desk with one clerk. Callers who insist on waiting at the desk block the line. The fix is numbered tokens: take a token, step aside, and return when called, with only five calls per name before the desk moves on. The one-sentence lesson is that the crawler treats DNS as a scarce shared service with timeouts and retries, not as an instant local call.

DNS is a synchronous, sometimes multi-second bottleneck, handled with caching plus a non-blocking resolver that retries about five times with growing waits before dropping the host. That rule bridges fetching to the frontier design that follows.

13.4 Frontier Design and Index Partitioning

13.4.1 Polite against fresh

How can one queue both leave a server alone and keep visiting it often? That tension is the whole frontier problem.

The frontier must serve two masters that pull in opposite directions. Politeness says do not hit one server again and again, meaning at most one open connection per host and a gap of seconds between successive visits. Freshness says revisit fast-changing pages again and again, meaning news and rapidly edited pages should be re-fetched often or their index entries go stale. A naive priority queue breaks here: it can point back at the same worn site repeatedly and burst against it, because many links on one page point to siblings on the same host, so the highest-scoring addresses cluster on one server.

The fix must hold both goals at once instead of picking one. Priority alone starves politeness, and politeness alone starves freshness. The lecture frames this as opposite masters on purpose: any design that optimizes only one side fails the other in production.

13.4.2 Mercator two tier frontier

The Mercator frontier (a two-tier queue design with prioritizing front queues feeding polite back queues) separates what to fetch soon from when a host may be touched again.

The Mercator design splits the frontier into a front queue and a back queue. URLs flow in from the top. The front queue manages prioritization through a prioritizer and a biased selector. The back queue manages politeness, and a back queue selector hands the chosen URL to the crawler. In short, the front queue guards priority and freshness while the back queue guards politeness, and their pairing resolves the clash from the prior section.

Concretely, a prioritizer assigns each incoming URL an integer priority between and from its fetch history and change rate, with news-style fast changers scoring high, and appends it to the -th of first-in first-out front queues. Each of back queues holds only addresses from a single host and stays non-empty during the crawl, with a table mapping hosts to queues. A heap entry per back queue stores the earliest time its host may be contacted again, often set to the current time plus a multiple of the last fetch time. A worker takes the heap root, waits until its time entry if needed, fetches the head URL of that back queue, then refills the drained queue from a front queue picked by a biased random choice favoring high priority. The bias is what lets urgent pages flow faster without ever bursting one host, since each back queue still releases only when its host is due.

Exam note: The inner selector math is marked for self-study only, with no exam question drawn from it. What matters for the exam is the split itself and which queue guards which goal: front guards priority and freshness, back guards politeness.

Picture arrivals falling into stacked priority trays at the top and draining through single-host checkout lanes at the bottom, with a dispatcher that favors urgent trays but never opens two registers for the same shop at once. The axes of that sketch are priority level versus host readiness, and the takeaway is that ordering and timing live in different tiers.

A frequent mix-up is to call the back queue the priority stage. It is not. Priority lives in the front queues. The back queue only enforces one-host-at-a-time with spaced visits, which is why adding more back queues than workers (roughly three times as many in the reference design) keeps threads busy without breaking politeness.

Two tiers solve two goals: biased front selection moves urgent URLs faster while per-host back queues with earliest-ready times keep fetching polite. That pairing is the point to carry into the exam.

13.4.3 Term partitioning and document partitioning

Crawlers and indexers work as close partners, and the index spreads over a large cluster so lookups stay fast. Two split plans dominate. Term partitioning splits by vocabulary terms and suits multi-word queries in principle, because each vocabulary slice with its postings lives on one node and a query goes only to nodes holding its terms. Document partitioning splits by documents and leans on inverse document frequency choices, because each node holds a full local index for its own document slice and every query visits all nodes with results merged at the end.

Trade-offs decide the pick. Term splits promise concurrency across different query terms but force long postings lists to travel between nodes for multi-word merging, suffer when query bursts skew load, and complicate growing indexes. Document splits trade more local disk reads for far less traffic between nodes and now dominate in practice. Their one extra chore is global statistics: a score that needs collection-wide counts such as inverse document frequency must be refreshed across nodes by background processes, since no single node sees the full collection.

A useful placement rule from the lecture pairs the two halves of the system: pages from one host may be crawled together for politeness, yet a uniform hash of addresses across index nodes spreads query work more evenly than keeping one host on one index node. High-scoring and low-scoring document slices can even be searched in tiers, consulting the weaker tier only when the strong tier returns too few matches.

13.4.4 End to end life of one page

The full path now reads as one story. A seed URL leaves the frontier and its host name resolves to an IP address, with slow lookups cut off by the retry rule. Fetch returns text plus tags plus links. Fingerprinting drops already-seen content, regular expressions plus robots rules admit only wanted URLs, and duplicate deletion drops already-queued addresses. Survivors normalize to absolute form and re-enter the frontier while page text and anchor data move to the indexer, which spreads across its cluster by term or document splits. That loop answers the opening question of how a search engine finds pages: never by blind fetching, always by polite, fresh, filtered, prioritized fetching.

Trace one address end to end. Dequeue from its per-host back queue when its earliest-ready time arrives. Resolve its host, fetch the page, parse text and links, forward text with tags plus anchor records to the indexer, run fingerprinting then pattern and robots tests then duplicate elimination on each extracted link, normalize survivors to absolute form with fresh priorities, and re-queue them. If itself was already seen by content or address, it leaves the loop at the matching gate with no re-queue.

Sense-check the loop against the two masters: a fast-changing news address earns high front priority yet still waits for its host's back-queue timer, so freshness advances without rudeness.

The crawler-indexer loop is fetch, parse, forward, filter, normalize, deduplicate, and re-queue under politeness timers, with the index split for fast lookup. That closes the crawling half and hands over to recommendation.

13.5 Recommender Systems and the Utility Matrix

13.5.1 Utility function definition

A store with a million items can only show a handful. How does it decide which handful a particular person most wants?

A recommender system estimates a utility function that predicts how much a given user will like a given item. A utility function (a scoring rule written for user and item that returns the expected liking) is the single idea behind the whole loop: find the right scoring function, rank items by score, and show the top ranks. Daily questions such as which camera to buy, which movie to watch, which book to read, or which university to consider all resolve through this machinery. Real-world: shopping sites, ticket booking apps, travel planners, and streaming services such as MakeMyTrip, BookMyShow, Amazon, and Prime Video run recommenders on each user every day.

Think of the utility function as a personal shopper who has watched every past purchase and now scores every shelf item for one client. The mapping breaks where taste needs stated constraints rather than past behavior, which is why later paradigms add peer, content, and need signals. For now the contract is fixed: learn , sort by , recommend the argmax items the user has not yet seen.

13.5.2 Utility matrix and its sparsity

The utility matrix (a table with users on rows, items on columns, and each cell holding the rating that user gave that item) makes the data problem visible at a glance.

The utility matrix lays users on rows and items on columns, with each cell holding the rating that user gave that item. Movie columns might read Harry Potter 1, 2, 3, Twilight, and Star Wars 1, 2, 3. The striking trait is sparsity: almost every cell sits empty. Sparsity (the condition where the fraction of filled cells is near zero because no person touches more than a tiny slice of the catalog) is not a bug in collection but the nature of choice at scale.

Scale makes the point concrete.

A store holds items and a shopper bought at most to of them. That shopper's row holds about filled cells out of , so the filled fraction is , about six thousandths of one percent. Nearly every cell in that row sits blank. The same arithmetic repeats for every row, which is why the whole matrix stays sparse by nature.

No team can force users to rate everything they touch, so the matrix stays sparse by nature. Sparsity is also skewed: a few heavy raters fill hundreds of cells while most users fill a handful, and a few blockbusters collect thousands of ratings while most items collect almost none. Any method that needs dense rows fails here, which motivates neighborhood and factor methods that borrow strength across rows and columns.

Scope: The matrix view assumes one score per user-item pair, often on a 1 to 5 star scale, with at most one rating kept per pair. It fits scalar liking well and fits binary or purchase-only signals only after they are mapped into scores, since a purchase without a rating still hides whether the buyer loved or merely tried the item.

Picture the matrix as a vast dark cinema with a few lit seats per row. The lit seats are known ratings and the dark seats are predictions to make. The takeaway: the dark seats dominate, so every method in this lecture is a strategy for guessing them.

Users on rows, items on columns, almost all cells blank: sparsity near 99 percent or more is the normal state, and the rest of the lecture fills those blanks without ever asking users to rate everything.

13.5.3 Explicit ratings against implicit signals

Ratings arrive two ways. Explicit ratings ask people outright for stars, meaning recorded scores on a stated scale such as 1 to 5. Implicit ratings learn from actions instead, such as purchases, watches, or clicks, without asking for stars, meaning behavior mapped into a liking score. Behavior skews explicit scores: users rate mostly when they love or hate an item, and the quiet middle never gets scored, so the observed stars overstate extremes. The catch with implicit signals is that they capture likes far better than dislikes. Buying similar goods shows taste directly, while walking away leaves no clean low score, since a non-purchase may mean unawareness, price resistance, or dislike with no way to tell.

Both paths land in the same trap: the low end of taste stays hard to observe. Ratings are also not missing at random. People choose what to rate and what to touch, so the filled cells over-represent strong feelings and familiar items. Methods that ignore this choice process treat blanks as neutral and drift toward popular items.

13.5.4 Cold start and extrapolating the unknowns

The core hardship is filling blanks in a nearly empty matrix. The cold start problem names its sharpest form: a brand-new item has no ratings column at all, and a brand-new user, such as a first-time grocery app subscriber, brings no history at all. A cold start (the state where a new row or column has too few entries for peer or content matching to work) forces generic behavior at first. Until patterns build up, sparsity bites hardest. Real-world: a new subscriber with zero orders gets generic lists first, and only later earns tuned picks as actions accrue.

Extrapolation then means borrowing from elsewhere: popular lists and item knowledge for new users, content traits for new items, and peer neighborhoods once a few ratings land. Pure peer methods suffer most here, content methods suffer less for new items with rich descriptions, and need-based methods sidestep history entirely. That ordering previews why hybrids win.

Do not confuse a blank with a zero. A blank means unknown, while a zero or low star means disliked. Filling blanks with zeros invents dislike where none was observed and pollutes every similarity that follows.

Cold start is sparsity at its worst: new rows and columns start blank, get generic treatment first, and only earn tuned predictions as evidence accrues. The next section names the five families that fill the rest of the blanks.

13.6 Five Paradigms of Recommendation

13.6.1 Personalized recommendation

Personalized recommendation draws only on one person's profile and context: age, gender, zip code, country, past buys, and past ratings. The model scores all available items against that single profile and recommends the best fits to that same person. No peer data enters the picture. This is the narrowest family: one row of the matrix plus side information about that user, scored against the catalog, with no community input.

Use it when privacy or data limits rule out peer data, or when the profile alone is strongly predictive. Its limit is isolation: it can never surface a title that everyone like the user loves but the user has never touched in any form.

13.6.2 Collaborative recommendation

What if the best clue to your taste is not your own history but the history of people who taste like you?

Collaborative recommendation asks what is most popular among peers. Peers here are not real-life friends but like-minded buyers found through network methods over community data. Picture a viewer who always watches crime thrillers while a new thriller takes off among three or four close-taste neighbors. The component then suggests that new title to the viewer even though the genre history alone would not surface it. The data fuses the person's history with the peer group's history inside the recommendation component.

A viewer rated only crime thrillers highly. Three neighbors with the same thriller footprint all rate a newly released thriller at 5 stars. The viewer's own row has a blank for that title, but the peer average is near 5, so the predicted score lands near the top and the title is recommended. Without peer data the title would stay buried, since the viewer's row alone gives no reason to rank it.

The mapping is social without being friendship-based: similarity over rating rows defines the neighborhood, and the neighborhood's taste completes the target row. The analogy breaks where taste is rare: with too few like-minded raters, the peer signal thins out.

13.6.3 Content based recommendation

Content-based recommendation shows more of the same kind the user already liked. It studies item features rather than peer opinion: title, genre, cast, crew, year, and similar content traits. The model then scores fresh items by resemblance to past likes and their scores. In vector terms, liked items define a taste direction and new items are ranked by closeness to that direction, with no peer rows consulted.

This family shines for rare taste and new items with rich descriptions, and it explains itself through the winning traits. Its limit is sameness: it rarely surprises, since it stays inside the content neighborhood of past likes.

Comparison across the first three families keeps them straight. Personalized uses one profile only. Collaborative uses peer rows plus the target row. Content-based uses item traits plus the target row. When the lecture asks which family can surface an unseen genre through peer buzz, the answer is collaborative; when it asks which family needs no peer data at all, the answer is content-based.

13.6.4 Knowledge based recommendation

Knowledge-based recommendation fits items to stated needs. It draws on direct knowledge of both the requirement and the item, which suits big rare buys where past behavior says little. The egg pan story makes it concrete: a shopper hunting an omelette pan gets shown an egg boiler that cooks six or seven eggs in about fifteen minutes with one switch. The match rests on need plus item knowledge, not on peer history.

Think of a hardware clerk who asks what meal is planned and then picks the tool that fits the job, rather than asking what neighbors bought. The clerk needs a catalog of item capabilities plus a short interview about the job. Where the picture breaks: without a good needs interview or a rich item knowledge base, the clerk guesses, and so does the model.

13.6.5 Hybrid recommendation

Hybrid recommendation blends paradigms, most often collaborative plus content-based signals. Blends can score each side apart and merge the scores, or unify both signals inside one model with shared training. That blend explains the familiar shopping shock: an added pan surfaces an egg boiler that feels so fitting that the buyer wonders how life worked without it. Real-world: large stores run blended ensembles whose combined output drives those uncanny bundles, and the same blending pulls extra Lego sets into carts at prices around 3000 to 4000.

The lecture's running shock stories carry one lesson: no single signal explains the bundle. Peer history says cooks like this also bought that, content traits say the two tools share a breakfast task, and the blend outscores either side alone. Hybrids also soften cold start, since content or need signals cover rows and columns where peer data is missing.

Scope: Hybrids assume the fused signals share the same user-item pairs and compatible scales. Blending helps only when the side models approach the problem differently; stacking near-identical models adds cost without new information.

Five families, one choice of evidence: single profile, peer rows, item traits, stated needs, or a blend. The course goes deep on the middle two, with hybrids as the payoff.

13.6.6 Course scope and student questions and answers

This course covers the collaborative and content-based paradigms in depth. The remaining paradigms stay in view as context for hybrid designs. Personalized, knowledge-based, and hybrid ideas return as motivating cases and evaluation context, but the derivations and graded practice center on neighborhood and content methods.

Q: Where does community data come from, and does it merge into the recommendation component? A: Community data comes from all users of the app, such as fellow shoppers on a large store. Network methods group like-minded buyers into a peer group, and the recommendation component merges that group taste with personal history. That merge lets a newly popular title reach a viewer through peer taste even when personal history alone would miss it.

Q: Are recommendation engines machine learning models, and does one model serve every paradigm? A: Yes, they are machine learning models, and in practice they run as ensembles. Each input source carries a different signature, so one model with one tuning cannot fit them all. Separate models learn their own signals and their outputs merge into the final prediction. That is why the familiar bundles feel tuned from several directions at once.

The two answers above address distinct confusions, so both are kept: the first about where peer data comes from, the second about why one model cannot serve all inputs.

Q: Please repeat the knowledge-based model once more. A: Its rule is to tell what fits based on stated needs. It studies the person's requirement alongside item knowledge, beyond profile and peer history. The egg pan leading to an egg boiler is the running example: need plus item facts drive the suggestion, such as capacity for six or seven eggs and a fifteen-minute single-switch cook.

13.7 User Based Collaborative Filtering

13.7.1 Hypothesis and four step procedure

If two people agreed on five movies, would you trust one of them to pick the sixth for the other? That bet is the whole method.

User-based filtering starts from one hypothesis: people who agreed in the past are likely to agree again. Tastes can shift overnight for some, but agreement on kinds of movies, books, or buys mostly holds. The assumption is stationarity of taste over the prediction window: near-term likes follow past agreement closely enough to rank unseen items.

The working loop has four steps. First, filter down to a neighborhood by listing items the target user rated, then marking other users who rated at least one of those items. Second, rank those candidates by a similarity score and keep the top K neighbors. Third, predict ratings for the target user's unrated items from neighbor ratings. Fourth, recommend the top scoring items. In the toy walkthrough the target user rated only two movies, three fellow users share at least one of them, and the weakest overlap gets dropped so two close neighbors remain.

Think of it as asking a small jury of taste twins to score what you have not seen, then weighting each juror by how often they agreed with you before. The picture breaks when the jury is thin: with one shared movie the agreement evidence is weak, and the method must say so by picking a larger overlap or more neighbors.

Agreement in the past predicts agreement next: filter to overlapping users, keep the most similar K, predict by weighted neighbor votes, and recommend the top predictions.

13.7.2 Jaccard similarity and why it fails here

Jaccard similarity (the size of the shared rated-item set divided by the size of the combined rated-item set) counts overlap while ignoring the stars themselves.

Jaccard similarity counts shared occurrences while ignoring the values. Heard in class as intersection over union, it reconciles to the standard set form:

where and are the item sets two users rated, counts set size, marks shared items, and marks items rated by either user. Every symbol is a count: the numerator counts movies both users rated, the denominator counts movies at least one of them rated, and the ratio lies in with for identical sets.

In the toy matrix, pair A and B share one movie and pair A and C share one movie, so both pairs score the heard value of one by seven:

Yet the values disagree sharply: A and B both rate Harry Potter highly with 4 and 5, which signals agreement, while Twilight draws 5 from one side and 2 from the other, which signals disagreement. Equal Jaccard scores for an agreeing pair and a disagreeing pair prove the measure blind to values, so it cannot serve here. The failure is structural, not numerical: a pure overlap count can never separate like-like from like-dislike.

User A and user B share one title out of seven combined, so . User A and user C also share one title out of seven, so . The first pair holds on the shared title, a small gap of star. The second pair holds , a wide gap of stars. Same Jaccard, opposite meaning. Sense-check: any measure that outputs the same number for near-agreement and near-opposition cannot rank neighbors for star prediction.

Scope: Jaccard fits binary or unary data such as bought-or-not, where overlap is the signal. It does not fit scalar stars, where the values carry the signal. Use it for sets, not for ratings.

Equal overlap with opposite stars exposes the gap: rating similarity must read the values, not just the overlap. That need leads to cosine next.

13.7.3 Cosine similarity and its narrow gap

Cosine similarity (the dot product of two rating vectors divided by the product of their lengths) reads the values through the angle between users.

Cosine similarity uses the values through a dot product over lengths. Heard in class as dot product divided by the lengths, it reconciles to the standard vector form:

where sums pairwise products over co-rated items only and is the L2 length of that user's co-rated ratings. Each symbol is concrete: over the shared item set , and . Scoring only co-rated entries matters because unrated cells must never turn into zeros. A zero would pose as a scored dislike and shrink both the dot product and the lengths.

The toy result gives similarity 0.38 for A and B against 0.32 for A and C. The direction is right, since 0.38 tops 0.32, but the gap stays tiny while intuition demands a wide split between agreement and direct opposition. Raw cosine sees values yet misses the baseline of agreement versus disagreement, so it also falls short as is. The reason is scale: all stars are positive numbers between 1 and 5, so any two users point into the same positive corner and their angle stays small. Two users who disagree on every shared title still get a positive cosine near the agreeing pair.

Picture two arrows from the origin into the positive quadrant. One pair points nearly together and the other pair points only slightly apart, because with no negative coordinates no pair can open a wide angle. The geometric takeaway: without centering, opposition cannot show as a negative number.

Cosine moves past Jaccard by reading stars, but on 1 to 5 scales every angle stays small and positive. The missing piece is a per-user baseline, which centering supplies.

13.7.4 Pearson correlation as centered cosine

Pearson correlation (cosine computed after subtracting each user's mean rating) turns agreement into a positive sign and opposition into a negative sign.

Pearson correlation centers each rating around its mean before taking the cosine-style ratio. Heard in class as centering the data and then taking the dot product over the lengths, it reconciles to the standard centered form:

where is user A's rating of co-rated item , is A's mean rating over the co-rated or profile set used in the lecture, and the denominator holds the L2 lengths of the centered vectors. Centering means subtracting the mean from each point, so a rating above the user's usual level becomes positive and one below it becomes negative. The ratio then lies in , with for perfect agreement, for perfect opposition, and for no linear relation.

For the toy user with ratings 4, 5, and 1, the mean is:

and the centered points follow by subtraction:

Numerically, , so the centered values are about , , and . The first two sit above the user's average and read as likes, the last sits far below and reads as a dislike. Spot-check the arithmetic: , as any centered set must sum to zero.

Now both sign and size speak. Pair A and B score strongly positive because likes line up with likes, while pair A and C turn negative because one side's likes are the other side's dislikes. That negative sign is the missing dissimilarity signal, and it makes the score trustworthy. Boundary check: the output always stays inside , and flipping all signs of one user flips the sign of the score, exactly as opposition should.

Center the toy row to . A neighbor who also likes the first two and dislikes the third gives a positive product sum and a positive correlation near . A neighbor who dislikes the first two and likes the third gives a negative product sum and a negative correlation. Same overlap as Jaccard, opposite signs under Pearson. Sense-check: the sign now answers the question Jaccard could not even ask.

Subtract each user's mean, then take cosine: above-average agreement points the same way and scores positive, while mirrored taste points apart and scores negative. That sign is why Pearson is the default for stars.

13.7.5 Rating prediction formula

Prediction is a similarity-weighted vote of neighbor stars, rescaled by total similarity weight.

Prediction blends neighbor ratings by similarity weight. Heard in class as similarity times neighbor rating, summed and scaled by similarity, it reconciles to the standard neighborhood predictor:

where is the predicted stars user gives item , is the similarity between user and neighbor , and is neighbor 's actual rating of item . The numerator sums one product per neighbor, the denominator sums absolute similarities so opposing neighbors still count toward scale without canceling it, and the result stays on the star scale. Division only rescales the blend.

With one neighbor of similarity 1 who rated Harry Potter 2 with 5 stars, the math collapses to:

so the prediction is 5. With many neighbors nothing cancels, and the weighted sum earns its keep. For example, with similarities and and neighbor stars and , the prediction is , which rounds to a whole-star 4.

Exam note: In multi-neighbor sums, write the full sigma form with every product term shown. A single-neighbor collapse to that neighbor's stars is expected, not a flaw in the formula.

13.7.6 Norms zeros distance and exam tactics

Three small facts prevent most errors. First, the denominator uses the L2 norm, the square root of squared sums, computed on centered values for Pearson scores. An L2 norm (the length of a vector, written for vector ) and an L1 norm (the sum of absolute entries, written ) differ as:

where is the rating vector at hand. For the centered triple , the squared sum is , so the L2 length is , while the L1 sum is . Squaring then rooting gives the L2 norm. Summing moduli instead gives the L1 norm. Keep the two apart, since Pearson needs L2 lengths.

Second, never fill blanks with zero, because zero reads as a scored rating and pollutes the math. Score only co-rated entries, which is why vector lengths differ per pair. A pair sharing three titles has three-dimensional vectors, while another pair sharing two titles has two-dimensional vectors, and that is intended.

Third, a distance measure reports dissimilarity, so flip it with similarity equals one minus dissimilarity:

where is similarity and is the distance on the same pair, both on a zero-to-one scale. A Manhattan distance over co-rated stars is the fast exam substitute: sum absolute star gaps, scale into , then flip with .

Exam note: Pearson scoring costs time, so a Manhattan distance on co-rated entries is an accepted faster path, provided the assumption is stated and the flip to similarity is shown. Never fill blanks with zero in any similarity or distance work.

13.7.7 Student questions and answers

Q: The matrix is sparse, so which similarity fits, and can blanks become zeros? Do dimensions differ per pair? A: No similarity can use zero-filled blanks, because zero carries meaning as a scored rating. Score only co-rated items and skip the rest. That choice makes dimensions differ from pair to pair, and the walkthrough honors it by dotting only shared entries. Jaccard is still wrong for stars even with this fix, since it skips values.

Q: Jaccard gives one by seven for both pairs, yet one pair agrees with 4 and 5 while the other splits 5 against 2. Are both pairs really similar? A: No. Jaccard counts occurrences only and skips values, so the 4 and 5 agreement and the 5 against 2 split look identical to it. That blindness disqualifies Jaccard for rating data. Cosine reads the values and Pearson adds the baseline, which is why the lecture moves past Jaccard.

The first two doubts share the sparsity theme but ask different things, so each keeps its canonical answer: the first about zero-filling and dimensions, the second about the Jaccard tie.

Q: If centering is the fix, why not run K-means clustering instead? A: The two centerings differ. K-means centers on cluster centroids for grouping points, while Pearson subtracts each user's mean to expose agreement. Cosine alone never signals opposition, but the centered score adds the negative sign. A negative value means negative correlation: my likes are your dislikes and your likes are my dislikes.

Q: How is the Pearson denominator built, and what do squared sums and moduli give? A: Take the L2 norm, the square root of squared sums, over centered values such as 2 by 3, 5 by 3, and minus 7 by 3. Squaring then rooting gives the L2 norm, about 2.94 for that triple. Summing moduli instead gives the L1 norm, 14 by 3 for the same triple. Keep the two apart and use L2 in Pearson denominators.

Q: With one neighbor the numerator and denominator cancel, so what is the point of the formula? A: With one neighbor the blend collapses to that neighbor's rating, which is exactly what happened in the Harry Potter 2 case with prediction 5. With many neighbors or many items the sigma sum holds several similarity-weighted products, nothing cancels, and the formula carries real weight. Always show every product term in the multi-neighbor case.

13.8 Item Based Collaborative Filtering

13.8.1 Transposed matrix and shared philosophy

Item-based filtering turns the table on its side: rows become items, columns become users, and similarity runs between items instead of users.

Item-based filtering does the same job from the other side. Transpose the utility matrix so rows become items and columns become users, then score similarity across items instead of users. The hypothesis flips with it: items that the same users scored alike in the past will be scored alike next. Centered scores stay the better input, exactly as in the user-based case, since baselines differ per item as well as per user. Sparsity hurts less here because item columns accumulate ratings across many users, so an item row in the transposed view is denser than a user row in the original view.

When asked for the difference between the two flavors, answer with the transpose plus the similarity axis, then note the shared prediction shape. User-based weights neighbor users for one target user, item-based weights neighbor items for one target item, and both divide a similarity-weighted star sum by total absolute similarity.

Exam note: When asked for the difference between the two flavors, answer with the transpose plus the similarity axis, then note the shared prediction shape: weighted neighbor stars over absolute similarity weights.

13.8.2 Worked prediction for user 5 and movie 1

Ratings run 1 to 5 with blanks left blank. The goal is the missing rating of user 5 for movie 1. Candidate neighbors are movie 3 and movie 6, chosen because they share rated users with movie 1: movies 1 and 3 share users 1, 9, and 11, and a parallel overlap supports movie 6. Only those shared users enter the similarity math, and only user 5's actual stars on movies 3 and 6 enter the prediction math.

Centering comes first. Each movie's mean is subtracted from its ratings on the shared users, so above-average entries turn positive and below-average entries turn negative. Movie totals reach 18 over 5 ratings, so the first centered entry is:

Here is the movie mean and is the centered value for a 1-star rating against that mean. Matching centered values are built for the neighbor rows on the same shared users. Similarity between movie 1 and movie 3 then takes the dot product over the three shared users divided by the two L2 lengths, and the same ratio gives similarity between movie 1 and movie 6. In symbols, with shared user set and centered ratings :

with the same shape for . The denominator uses L2 lengths over the shared users only, never over blanks.

Prediction reuses the weighted blend, now over items:

where is the similarity between movie 1 and movie 3, is user 5's actual rating of movie 3, and the second pair mirrors this for movie 6. The numerator must use actual stars, not centered values, because the target is an actual star count. Since stored ratings are whole stars, round the result with a ceiling or floor to land on a whole-star prediction. The worked numbers confirm the earlier lesson: with two live terms nothing cancels, since the numerator holds two similarity-star products and the denominator holds two absolute weights.

Sense-check the scale: similarities stay inside , stars stay in , and the weighted mean of two stars stays inside , so a result like 4.2 rounding to 4 is valid while a result outside the scale would flag an error.

Scope: This two-neighbor blend assumes movies 3 and 6 are genuinely close to movie 1 with enough shared raters to trust the similarities. With one shared rater the similarity is noise, and with negatively similar neighbors the absolute denominator still rescales correctly but the prediction leans away from the opposed titles.

Center for similarity, vote with actual stars: similarities come from centered overlaps, predictions come from actual neighbor stars, and rounding returns the answer to the star scale.

13.8.3 Neighbor picking rules that survive scrutiny

Neighbor quality decides the result. A neighbor with 1 star here and 5 stars there on the same user signals opposite taste and must not count as close. State the picking rule before computing: for example, demand at least three co-rated users, or score every movie pair and keep the top two. Either path is accepted when written down. The first rule guards evidence per pair, the second guards rank among pairs, and writing either one makes the grading of the steps checkable.

Compute distances only over co-rated entries, flip distance to similarity with one minus distance, and never impute zero. In symbols, on a shared zero-to-one scale. A pair sharing users 1, 9, and 11 is scored in three dimensions, while a pair sharing only two users is scored in two, and the two scores are still comparable as similarities even though their dimensions differ.

Do not pick neighbors by raw popularity or by title resemblance. Pick by rated-overlap similarity on shared users, state the threshold or top-K rule first, and only then compute. Popularity without similarity recommends blockbusters to everyone, which defeats personalization.

Write the neighbor rule, score only overlaps, flip distance to similarity, and keep zeros out. Good neighbors make the weighted vote trustworthy.

13.8.4 Student questions and answers

Q: For this movie problem, show step one: how are the nearest neighbor movies found? A: Score the target movie against every other movie and keep the top two, which here are movie 3 and movie 6. That means computing similarity between movie 1 and movie 2, movie 1 and movie 3, movie 1 and movie 4, and so on, then keeping the closest to one. Movies 1 and 3 share users 1, 9, and 11, which is the overlap that supports their similarity.

Q: How is that similarity computed when dimensions differ, say movie 1 against movie 2 with gaps everywhere? A: Use only co-rated entries, for example the 3 against 5 and 4 against 1 pairs, and skip the rest. Score the dot product and L2 lengths in that shared subspace only. A distance on those entries reports dissimilarity, so convert with one minus dissimilarity to get similarity. Never fill blanks with zero, because zero is itself a rating signal that would shrink lengths and twist the angle.

The first two doubts form a natural pair about finding and scoring neighbors, so they sit together with one story: rank all pairs, score each pair only on its overlap.

Q: Does the prediction numerator use centered ratings or actual ratings? A: Actual ratings. Centering serves similarity only. The goal is a real star count, so multiply each similarity by the neighbor's actual stars, sum those products, and scale by total similarity. Centered values in the numerator would predict a deviation from a mean, not a star count, and would need a mean added back.

13.9 Content Based Recommendation

13.9.1 Item features from explicit traits and text

What if there are no peers to ask, only the items themselves? Then taste must be read off the content.

Content-based methods set peer data aside and model taste from item content. Features split two ways. Explicit attributes name structured traits such as genre, year, cast, and crew for a movie. A textual attribute (a word or phrase mined from titles, abstracts, or tables of contents for text goods such as books and research papers) supplies the second stream. An item feature (one measurable trait of an item, for example one genre flag or one keyword weight) is defined on first use with its symbol and a number, such as a genre flag for action or a keyword weight for data.

The user profile becomes the footprint of liked-item content, meaning the weighted mix of traits from items the user liked. A classifier such as naive Bayes, a support vector machine, or a neural net can learn the mapping from that footprint to future likes. A clustering option also came up for modeling taste groups: Gaussian mixture models score each point by its probability of belonging to class one, class two, or class three, and the highest probability wins the assignment, unlike hard clustering that fixes each point to one cluster by distance. In soft assignment a book can be 70 percent class one and 30 percent class two, while hard assignment would force it fully into one class.

Think of the profile as a scent trail left by past picks: new items that smell strongly of the same traits score high. The trail metaphor breaks for feel-based goods where no trait list captures the scent, which previews the limits below.

13.9.2 Worked TF-IDF book title match

A TF-IDF vector (a keyword list where each entry weights how often a word occurs in one title against how rare that word is across all titles) places every book in one shared word space where closeness means shared content.

A shopper opens the title "building data mining applications for CRM" and the model must rank seven candidate titles. Each title turns into a TF-IDF keyword vector, placing bought and candidate books in one shared vector space. Term frequency lifts words frequent in one title, inverse document frequency lifts words rare across titles, and their product gives the entry weight. The tokens data and mining visibly dominate the bought title's vector, so books about data mining your website and mastering data mining rise to the top, joined by the CRM technology title through the shared CRM token. Titles about marketing and customer behavior sink away. The match runs purely on content words with zero peer input, which is the whole point of the demo.

Score the bought title against each candidate with cosine between TF-IDF vectors. Suppose the bought vector puts its largest weights on data and mining, a medium weight on CRM, and near-zero weights on marketing and behavior. A candidate titled around data mining inherits large weights on the same two entries, so its dot product with the bought vector is large and its cosine lands near the top. A candidate about customer behavior shares almost no high-weight entries, so its dot product stays small and it sinks. The top three titles win on shared high-weight tokens, and the unrelated titles fall away. Sense-check: the ranking follows token overlap weighted by rarity, with no peer rows consulted.

Visualize one bar chart per title with one bar per keyword. The bought chart shows tall bars for data and mining, a medium bar for CRM, and flat bars elsewhere. Winners are charts with the same tall bars, losers are charts tall where the bought chart is flat. The one-sentence takeaway is that rare shared words decide, not raw word counts.

Scope: This vector match assumes titles carry enough topical words to separate winners from losers. It fits text goods with descriptive titles and abstracts. It weakens for items whose appeal lives in sound, image, or feel that no keyword list captures.

Shared rare words win: TF-IDF vectors plus cosine rank content neighbors with no peer data, and the winning tokens explain each pick.

13.9.3 Strengths and limits

Freedom from peer data is the headline strength. The method handles users with rare taste, surfaces unpopular or brand-new items, and explains itself, since the winning tokens show why a title won. A user who loves only narrow CRM titles still gets CRM titles, and a book published yesterday with a rich blurb can be recommended today with no ratings at all.

Limits bite elsewhere. Only content that encodes into sound features works well, so text goods shine while music or movie feel resist encoding. Pure content matching also sidelines the user's own past ratings signal in the sense that it never borrows peer rows, which a hybrid blend later restores by adding collaborative scores. Overspecialization is the third limit: the method stays inside the content neighborhood and rarely surprises.

Do not expect content matching to discover cross-genre peer hits. A thriller fan whose neighbors love a new comedy gets no comedy recommendation from content alone, since no liked item shares its traits. That discovery needs peer or hybrid signals.

Content methods win on rare taste, new items, and explainability, and lose on feel-based goods, overspecialization, and missed peer discoveries. Hybrids keep the wins and cover the losses.

13.9.4 Student questions and answers

Q: The earlier view showed integers but this one shows decimals. Is the matrix normalized here? A: The earlier view showed plain counts while this view shows document-frequency style weights, heard as df. Either way the read-off stays direct: raw counts emphasize frequent words, weighted entries emphasize rare shared words, and both views leave the data and mining tokens dominant. The top three titles win and the unrelated titles fall away under either scaling.

13.10 Hybrid Models and the Netflix Prize

13.10.1 Three layer winning design

What happens when content traits, peer neighborhoods, and global habits all matter at once? One model cannot carry all three, but a stack can.

Hybrids fuse content signals with collaborative signals, either by scoring each side apart and merging or by unifying both in one model. Scoring apart means training a content scorer and a collaborative scorer separately and blending their outputs, while unifying means training one model that reads both trait and peer inputs together. The Netflix Prize story shows the payoff.

Netflix opened about six years of data with 100 million ratings from 480,000 people across nearly 18,000 movies, posting its in-house root mean square error near 0.95 and offering 1 million dollars for roughly a ten percent improvement. In standard reference form the contest released 100,480,507 ratings on a 1 to 5 star scale from 480,189 users on 17,770 movies covering late 1999 through 2005, with the in-house Cinematch baseline at RMSE 0.9514 on the quiz set and the grand-prize bar set below 0.8563, meaning a ten percent cut. The lecture's rounded figures match this standard form: near 0.95 is 0.9514, and ten percent is the drop to 0.8563, finally beaten at 0.8567 by the winners.

The lecture heard about 207,000 teams entering. Standard reports count the scale differently: roughly 51,000 contestants forming about 41,000 teams from 186 countries, with about 5,000 teams submitting valid entries. The two counts differ because registrations, contestants, teams, and submitting teams are counted separately across sources. The working picture stays fixed either way: tens of thousands of entrants chased one ten-percent gap.

The winning team heard in class under a Bellcore-like name reconciles to BellKor's Pragmatic Chaos, the merged team of BellKor with BigChaos and Pragmatic Theory, seven members in total. The contest ran from October 2006 to September 2009, almost three years rather than the heard five, with progress prizes along the way before the merged team crossed the bar in the final month.

Their design stacked three scales: a global layer for baseline effects, a latent-factor layer with matrix factorization such as SVD for regional hidden factors, and a neighborhood collaborative layer for local patterns. The global layer (standing biases for each user and each item plus the overall mean) captures who rates high and what is liked on average. The latent-factor layer (hidden taste dimensions learned by factorizing the rating matrix, often with SVD-style methods) captures regional structure such as genre or style affinities. The neighborhood layer (peer or item-neighbor corrections around the baseline) captures local exceptions such as loving one thriller but hating a close sibling. No single model won; the stack won, with blending of hundreds of predictors doing the final lift.

Scope: The three-layer stack assumes enough ratings to learn per-user and per-item biases plus dozens of latent dimensions. On tiny or ice-cold catalogs the latent and neighborhood layers starve and the global baseline carries almost all the weight.

Picture the prediction as a three-step correction. Start from the world average, adjust for the movie and the rater, add hidden-factor affinities, then nudge for near-title exceptions. Each layer fixes what the coarser layer above it cannot see.

Global baselines plus latent factors plus neighborhoods, blended as an ensemble, beat any single model. That stack is the standard hybrid playbook the contest left behind.

13.10.2 Global and local effects worked numbers

The global estimate (overall mean plus item lift plus user drag) sets the standing prediction before any neighborhood correction.

The global layer adjusts for standing biases. All movies average 3.7 stars while Sixth Sense sits 0.5 above that line, and a test user rates 0.2 below average, so the global estimate is:

where 3.7 is the overall movie mean, 0.5 is the Sixth Sense lift, and 0.2 is the user's drag. In words, start from the world mean , add the item bias so the title mean is , add the user bias , and land at . Domain check: every input and the output sit inside the 1 to 5 star range, so no clipping is needed.

World mean 3.7 plus Sixth Sense lift 0.5 gives title mean 4.2. Subtract the user's 0.2 drag to reach global estimate 4.0. The local layer then checks a near title: the same user disliked Signs, a similar movie, so the estimate takes a penalty down to 3.8 stars. Global bias plus local neighborhood together beat either alone, which is why the winning stack kept both. Sense-check: a dislike of a close sibling should pull the score down, never up, and 3.8 sits one small penalty below 4.0 as expected.

The local penalty has no fixed formula in the lecture; it is a neighborhood nudge learned from similar-title ratings. Its sign is what matters: similarity to a disliked neighbor lowers the estimate, similarity to a liked neighbor raises it.

Global sets the level from means and biases, local adjusts it from near-title likes and dislikes. Their sum is the hybrid prediction in miniature.

13.10.3 Student questions and answers

Q: Is the 3.7 mean for Sixth Sense alone or for all movies, and what is the 0.5 about? A: The 3.7 mean covers all movies. Sixth Sense averages 0.5 stars above that overall mean, which puts its own mean at 4.2. The test user sits 0.2 stars below average, so the global estimate is 3.7 plus 0.5 minus 0.2, which is 4.0. Dislike of the similar Signs title then pulls the final local estimate to 3.8. Confusing 3.7 for the title mean would double-count the lift, so keep the world mean and the lift apart.

Exam Guidance Summary

Exam note: URL normalization questions expect the absolute form as the frontier entry. Relative links are resolved at parse time and never queued as-is.

Exam note: The Mercator front queue guards prioritization and freshness while the back queue guards politeness, and selector internals stay self-study with no questions drawn from them. Name the split and the guarded goal for each tier.

Exam note: Pearson scoring costs time, so stating a Manhattan-distance assumption on co-rated entries is an accepted faster path, with the one-minus-distance flip shown as .

Exam note: Prediction numerators must use actual stars, never centered values, and multi-neighbor sigma sums must show every product term, for example .

Exam note: Never fill blanks with zero in any similarity or distance work. Score only co-rated entries, which is why vector lengths differ per pair.

Exam note: Link analysis with the PageRank algorithm arrives in the next session, so current preparation should lock down crawling filters, similarity math, and hybrid reasoning first. Anchor handling, fingerprinting, Jaccard against cosine against Pearson, item-based transposes, and the global-to-local hybrid correction carry the most weight.

Key Industry Applications

Anchor text from every outbound link feeds indexer ranking signals across tutorial and reference sites, where outside words describe targets better than on-page text alone and help fight spam. DNS retry budgets with about five growing waits plus host-splitter routing keep large crawler fleets moving without freezing on slow hosts or bursting polite servers.

Shopping, travel, ticket booking, grocery, and streaming platforms, including Amazon, MakeMyTrip, BookMyShow, Big Basket, Hotstar, and Prime Video, run ensemble recommenders that blend profile, peer, content, and need signals. Need-aware suggestions such as the egg boiler bundle and peer-driven picks such as newly popular thriller titles show hybrid models shaping carts and watch lists daily. The Netflix Prize setup with 100 million ratings turned global baselines, latent factors, and neighborhood signals into the standard hybrid playbook, with per-user and per-item biases plus hidden dimensions plus near-title corrections behind most modern stacks.

IR Lecture 13 notes · Web Crawling in Detail and Recommender Systems

Information Retrieval· undergraduate· 2026-09-13

Sections Breakdown

1Anchor Text and the Crawler Indexer Link

Crawler hands page text, tags, and four-part anchor records to the indexer so outside anchor words rank target pages.

2Three Filters Before the Frontier

Fresh pages pass fingerprint content test, URL regex and robots filters, then duplicate elimination with priority before re-entering the frontier.

3Normalization Distributed Crawling and DNS

Relative links normalize to absolute URLs; host splitter partitions hosts across nodes with weaker duplicate detection; DNS bottleneck handled by five-attempt retry rule.

4Frontier Design and Index Partitioning

Mercator two-tier frontier separates front-queue prioritization from per-host polite back queues; indexes split by term or more often by document.

5Recommender Systems and the Utility Matrix

Utility function f(u,i) ranks items; utility matrix is sparse; explicit vs implicit signals both hide dislikes; cold start is the sharpest sparsity case.

6Five Paradigms of Recommendation

Five paradigms differ by evidence used: profile, peers, item traits, stated needs, or hybrid blend; collaborative and content-based are the course focus.

7User Based Collaborative Filtering

User-based CF filters to overlapping users, ranks by similarity, and predicts by weighted votes; Jaccard fails on values, cosine gap stays narrow, centered Pearson adds the sign.

8Item Based Collaborative Filtering

Item-based CF transposes the matrix, scores item similarity on shared users with centering, and predicts missing stars by similarity-weighted actual ratings.

9Content Based Recommendation

Content-based methods model taste from explicit and TF-IDF text traits; book-title match ranks by shared rare tokens with no peer input.

10Hybrid Models and the Netflix Prize

Netflix Prize hybrids stack global, latent-factor, and neighborhood layers; global estimate 4.0 adjusts to local 3.8 via similar-title dislike.

Undergraduate students studying Information Retrieval

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Anchor Text and the Crawler Indexer Link

Must-know: Anchor URL, anchor text, source page, and context flow to the indexer and anchor words describe the target page.

Top pitfall: Indexing anchor words only on the source page instead of attaching them to the destination

Self-check: Which four pieces does the crawler forward for each anchor element?

Connects to: 13.2, 13.4

Three Filters Before the Frontier

Must-know: Content-seen by shingle fingerprints, then URL regex filters plus robots permits, then duplicate-URL elimination with quality/freshness priority.

Top pitfall: Testing the address instead of the words, missing copies under different URLs

Self-check: Which test catches identical content under a fully different URL?

Connects to: 13.1, 13.3

Normalization Distributed Crawling and DNS

Must-know: Queue only absolute normalized URLs; host splitter sits after filtering and weakens copy detection; DNS retries about five times with growing waits.

Top pitfall: Queuing relative URLs or deduplicating before the host splitter

Self-check: Which URL form enters the frontier and where does the host splitter sit?

Connects to: 13.2, 13.4

Frontier Design and Index Partitioning

Must-know: Front queues guard priority/freshness, back queues guard politeness; document partitioning dominates term partitioning.

Top pitfall: Calling the back queue the priority stage; priority lives in front queues

Self-check: Which tier guards politeness and which guards priority?

Connects to: 13.2, 13.3, 13.5

Recommender Systems and the Utility Matrix

Must-know: Utility f(u,i) ranks unseen items; matrix is sparse; explicit stars skew to extremes and implicit actions show likes better than dislikes; cold start hits new rows and columns.

Top pitfall: Reading a blank as a zero or as dislike

Self-check: Why does the utility matrix stay sparse by nature?

Connects to: 13.6, 13.7

Five Paradigms of Recommendation

Must-know: Personalized uses one profile, collaborative uses peer rows, content uses item traits, knowledge uses stated needs, hybrid blends them; course goes deep on collaborative and content-based.

Top pitfall: Calling peers real-life friends instead of like-minded raters; expecting one model to fit all paradigms

Self-check: Which paradigm surfaces a new title through peer taste alone?

Connects to: 13.5, 13.7, 13.9, 13.10

User Based Collaborative Filtering

Must-know: Jaccard ignores values, cosine misses baselines, Pearson centers then takes cosine; predict by similarity-weighted neighbor stars.

Top pitfall: Filling blanks with zero; using L1 instead of L2 in Pearson denominator; hiding every product term in multi-neighbor sums

Self-check: Why does Jaccard give 1/7 to both an agreeing and a disagreeing pair?

Connects to: 13.5, 13.6, 13.8

Item Based Collaborative Filtering

Must-know: Transpose so similarity runs between items; center for similarity but predict with actual stars; state the neighbor rule first.

Top pitfall: Putting centered values in the prediction numerator; picking neighbors by popularity instead of overlap similarity

Self-check: Why must the item-based numerator use actual stars?

Connects to: 13.7, 13.9

Content Based Recommendation

Must-know: Explicit traits plus TF-IDF text vectors define taste footprint; cosine ranks content neighbors with no peers; strengths are rare taste, new items, explainability.

Top pitfall: Expecting content matching to surface cross-genre peer hits

Self-check: Why do data and mining dominate the bought title vector?

Connects to: 13.6, 13.8, 13.10

Hybrid Models and the Netflix Prize

Must-know: Hybrid stacks global baselines, latent factors, and neighborhoods; global 3.7+0.5-0.2=4.0 then local penalty to 3.8; Cinematch 0.9514 to below 0.8563 by BellKor's Pragmatic Chaos.

Top pitfall: Reading 3.7 as the Sixth Sense mean instead of the all-movies mean and double-counting the lift

Self-check: How does the global 4.0 become the local 3.8?

Connects to: 13.7, 13.8, 13.9

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.