Skip to content
Docs

Context, query and target

One table supplies known answers. A second table asks new questions with the same feature columns.
On this page

Give the model examples

The table that carries the answers is called the context, and the table you want predictions for is called the query. Both contain the same feature columns, with the same names in the same order, and only the context contains the target column. Because the model reads the columns by position, a query whose columns are in a different order is refused with a 422 response that lists both orders.

There are two models. causilo-clf handles classification and causilo-reg handles regression. If you want to see how they compare with gradient-boosted trees, the Causilo vs XGBoost example runs XGBoost and LightGBM at their default settings on the same table.

Context: known target

regionspendrenewed · target
EU120yes
US340yes
EU0no

Query: features only

regionspend
EU200
US50

Context conditions this query through Causilo.

Result shape

Causilo → one label per query row

Query orderrenewed · prediction
1 · EU, 200returned label
2 · US, 50returned label

Placeholders show the response shape; they are not recorded prediction values.

Illustrative input and result shape from Quickstart. The query omits the target and keeps feature names and order. Returned labels follow query order.

Check the data conditions

What a column may hold

Each kind of column is handled as follows. Every refusal is a 422 response whose detail names the column.

In your tableWhat happens
Missing values in a feature Accepted as they are. The model handles missing values natively, so there is no need to impute them first.
Strings Accepted and treated as categories, with no encoding needed on your side.
Columns on very different scales Accepted. No scaling or normalisation is needed.
A query column that is empty on every row Refused, because the prediction would otherwise ignore that column without saying so.
Dates, times, durations Refused. Split them into numeric parts such as year, month and day of week, or send epoch seconds. Preprocessing would treat a date as a category, and the predictions would be worse without any warning.
Decimal columns Refused. A Postgres or BigQuery NUMERIC column becomes this type in pandas, so cast it to float first.
Lists, dicts, structsRefused.
Infinities, or values at or above the documented ceiling Refused. Rescale the column or drop those rows.
float16Widened to float32 for you.
Duplicate column namesRefused.
Your DataFrame indexDropped and never sent, so put anything you need to keep in a column.

The same column must hold the same kind of value in both tables. A context in which every feature column holds a single value is refused, since there is nothing in it to predict from.

What the target column may hold

The target column is present in the context and absent from the query. In a single Parquet file, the rows with an empty target are the rows to predict.

RuleApplies to
No missing values in the context's targetboth models
At most 64 distinct values, and at least two causilo-clf
Whole numbers or strings, not fractions causilo-clf
Numeric, finite, under 3.4e38causilo-reg
Not a datetimecausilo-reg, whose predictions would otherwise come back as epoch integers with no unit. causilo-clf treats each distinct date as a class and returns it as a string.