Set up
The examples in these docs use Python withrequests and pandas. They also work as plain HTTP calls from any language.
The example data
The example is a table of loan applications. Each row is one application. The columndefaulted holds the answer for past applications: whether the loan went 90 days past due within 12 months. The past applications are all more than 12 months old, so every answer in the file is final.
applications.csv
defaulted.
Step 1: send the past rows
The rows whose answer you know are called the context. Sending them to/v1/fit means the model reads them once. Nothing is trained.
context_id and a report. The report lists every column with the type it was read as, and the reason. Here income and loan_amount are numbers, employment and region are categories, applied_on is a date, and application_id is an id that is not read as a feature. If a type is wrong, you can override it. See Column types.
Step 2: score new rows
context_id without sending the past rows again. If it has expired, send them again. The same rows always give the same context_id.
Step 3: check how good the scores are
Before you rely on the scores, measure them on rows whose answer you know./v1/evaluate holds out a share of your rows, predicts them from the rest, and compares the result with a simple baseline.
time_column is given, the held-out rows are the latest 20% of applications. Each one is predicted only from what was known on its application date. The setting target_delay_days says that an application’s answer becomes known 365 days after the application, at the end of its 12-month window. So a held-out application reads only the outcomes of applications made more than a year before it. This is the out-of-time test that credit teams already use. It is a fairer test than a random split for any data that changes over time.
A shortcut for one-off jobs
If your rows to score sit in the same file as the past rows, leave their target empty and call/v1/fill. The rows with an answer become the context, and the rows with an empty answer are predicted.
Next steps
- To forecast series, read Forecasting.
- If your rows form sequences, such as monthly snapshots per account, read Sequences.
- If your data is spread over several tables, read Databases.
- Read Time and leakage before you evaluate anything that changes over time.