Missing values
You do not need to fill missing values. Send a missing cell as empty. The model handles many kinds of missing data: columns that are mostly empty, values that go missing for a reason (for example, an income field left blank more often by people with low income), and groups of columns that go missing together, such as a set of test results that were not ordered. The fact that a value is missing can itself carry information, and the model can use it. Some systems write a code, such as -1, 0, -999 or 9999, in place of a missing value. The model copes with such codes. If you know that a code means missing, it is still better to send the cell as empty, so that the model does not have to work it out. In a sequence, a value can also be missing because it did not exist yet, such as a field that was added to the system part way through. The model copes with this too.Categories with many values
A category column can have a few values, such as a gender or a region, or very many, such as a postcode, a merchant id or a product code. You do not need to group rare values or encode the column. The model does not use the names of the categories. A value seen many times in the context tells the model more than a value seen once or twice. A value that never appears in the context is handled too: the model then relies on the rest of the row. If a high-cardinality column has a natural grouping that you know, such as postcode within region or product within category, add the group as a column of its own. The model can then use the group when a single value is rare.Text
A text column is embedded by a frozen language model, the same for every customer. The result enters the model as a few numeric columns, next to your other columns.embed_dims sets how many numeric columns are made from each text column, 8 by default.
Adding or changing a row to predict changes only that row’s own prediction. The same context always gives the same result.
A text column needs enough texts in the context to be useful. With too few, the column is left out and the report says so.
Images, audio and documents
Columns that hold links to images, audio files or documents are handled in the same way as text. A frozen model for that kind of media embeds each file, and the result enters the model as a few numeric columns. Mark such columns withcolumn_types, for example {"photo_url": "image"}.
Examples of use:
- photos of a vehicle or property in an insurance claim;
- recorded calls in collections, next to their transcripts as text;
- scanned documents in a loan application.
Embeddings you bring
If you already have embeddings, for example from your own model of customers or products, send them as a column whose cells are lists of numbers of the same length. They enter the model in the same way, as a few numeric columns. Embeddings you bring are useful when a frozen general model does not know your domain well, or when you cannot send the raw text or files.What you do not need to do
- Scale or normalise numbers. A change of units, such as dollars to thousands of dollars, gives the same predictions.
- One-hot encode categories, or group rare values.
- Remove columns that are near copies of each other, or derived from each other.
- Remove id columns. They are recognised and not read as features. Check the report to make sure.