calibrate
POST /v1/calibrate fits a scoring model to labeled records, and can add or remove its questions.
Up to 10 calibrations per scoring model per day. See Calibration and Changing questions.
Fits a scoring model to labeled records: past records with the fields of the records it scores, each with is_bad. Grayson answers all the scoring model's questions, and yours, for every record, and Finic chooses again which to use and how much each counts. It can add and remove questions too.
A scoring model's first calibration, for one created from its criteria alone, also has Finic write its questions from the records and gives it its schema. Creating one from labeled records is its first calibration.
Returns 202 with a job_id; score calls after the job completes, in about two minutes, use the updated scoring model. One calibration at a time per scoring model. The records are kept encrypted only while the job runs, and deleted when it ends.
Request body
application/json or multipart/form-data
| Field | Type | Description |
|---|---|---|
model_idrequired | string | The scoring model to calibrate. |
datarequired | array of object or string | Labeled records: a JSON array of objects, or CSV text with a header row, with the fields of the records the scoring model scores and |
add_questions | array of string | Optional. Your own yes/no questions to try; the scoring model uses the ones that help, and the others are listed as not used on its page in the Finic app. Up to 20 at a time, and 50 per scoring model. add_questions adds them without calibrating. |
remove_questions | array of string | Optional. The ids of questions to stop using, from get_model. A removed question isn't asked or tried again. |
| Field | Type | Description |
|---|---|---|
model_idrequired | string | The scoring model to calibrate. |
filerequired | string | The labeled records, as CSV with a header row or a JSON array, every row with |
add_questions | string | Optional: a question of your own. Repeat the field for each, or send a JSON array of strings. |
remove_questions | string | Optional. A question id to remove. Repeat the field for each. |
Responses
The calibration is running.
| Field | Type | Description |
|---|---|---|
job_id | string | The calibration's job, |
rows | integer | The labeled records used. |
request_id | string |
|
| Status | Type and when |
|---|---|
400 |
|
401 |
|
404 |
|
409 |
|
413 |
|
429 |
|
Every error has the same shape; see Errors.
Examples
curl -X POST 'https://api.finic.ai/v1/calibrate' \ -H "Authorization: Bearer $FINIC_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "model_id": "scm_01M4XRC000RT2GZSKYPD8J86G9", "data": [ { "amount_usd": 2400, "merchant_category": "electronics", "account_age_days": 19, "new_device": true, "billing_country": "US", "ip_country": "NG", "is_bad": true }, { "amount_usd": 58.12, "merchant_category": "grocery", "account_age_days": 1260, "new_device": false, "billing_country": "US", "ip_country": "US", "is_bad": false } ], "add_questions": [ "Was the account opened less than a week before the payment?" ], "remove_questions": [ "q022" ]}'{ "job_id": "job_01M4YY4AZRJ8NR5QFRW628CJ5G", "rows": 1800, "request_id": "req_01M4YPJNK0SZGEQS0A76EEND4N"}