liveBook · Manning

Relevancy score

As explained in Machine Learning System Design

A numerical score expressing how relevant an item is to a particular user query.

A relevancy score expresses how well an item matches a user’s query. A search engine can calculate a score for each query–item pair and rank the candidates accordingly. Before scoring, hard requirements such as file format, image width, and price can reduce the candidate set. section 3.4.2

relevancy = f(encode_text(query), encode_image(item)) 

A query and an image can be encoded separately before a function produces their relevancy score. section 3.4.2

For a photo search, labelers can assign scores based on how closely images match queries. Past queries paired with clicks offer another signal of relevance and interest; time on the photo page and subsequent purchases can add context. Query–image pairs for labeling can initially be sampled randomly, then selected using active learning. section 6.7.2

Several baselines can produce a score, with different tradeoffs:

  • A simple linear model can use TF-IDF features from queries and photo metadata. It is easy to train and debug, but does not use the images themselves. section 8.6.2
  • A pretrained CLIP model can use query–image output as a score. A two-component score can also combine query–image and query–description distances. section 8.6.2
  • A unified score can incorporate additional signals, such as user and document features. A weighted sum offers one way to combine distances, using a small linear model. section 11.5.2

Scoring still leaves design questions: how to encode queries and items, choose a scoring function, measure relevance, and incorporate feedback. More features may improve the system, but they also expand its scope, so it helps to leave room for later extensions. section 3.4.2 section 11.5.2

How Machine Learning System Design covers it

How deep it goes
Defines query–item scoring and outlines baseline combinations, while leaving encoding, measurement, and feedback questions for further investigation.
Examples
Uses stock-photo queries, manually scored query–image pairs, click data, and query–description distances.
What you can do after
Evaluate and understand scoring alternatives for a photo-search baseline and identify questions for further design.
How it connects
Connects ranking with candidate filtering, feature engineering, user feedback, and active learning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.