Skip to main content
A recommendation asks which rows of one table a row of another table will link to. Which products will a customer buy in the next 30 days? Which drivers will race at a circuit? The answer is a ranked list for each source, with the best first. The links are the past events that tie a source to an item. There are two ways to give them.
  • An event table of the database. Give link_table, the name of a table with a time column and a foreign key to each of the two tables. An orders table with customer_id and product_id is an example.
  • The links themselves. Give links, a table with a source column, an item column and a time column.

Predict lists

The examples use a database sent as in Databases, and the API, HEADERS and records set up in the Quickstart.
With links given directly, send them in links, and name their item column with dest_column and their time column with link_time_column.

How the lists are made

For each source at a date, the model draws on everything the database says about the source and the items: the source’s past links, what other sources picked, the other tables that relate the two, and the item columns, including their text. It ranks the items by how likely the link is. Only links and rows dated strictly before the date are read. When the model finds fewer suitable items than k, the list is filled with the items most picked in the window before. Those places are marked filled_from_popular and have no probability. The lists for each date are made separately. The context for a date is made of the lists of the earlier dates, one window apart, whose outcome is already known.

Evaluate

/v1/databases/{database_id}/evaluate-recommend scores the lists of one date with MAP@k, the measure RelBench uses. By default the date is one window before the last link, so the outcome of every list is known.
The result places the model next to rules that need no training: without_text shows what the model gets from the item texts.

Files

format can be json, csv or parquet. A table has one row per item, with the columns id, rank, item, probability and filled_from_popular.