Training

Our training endpoints allow you to programmatically train models based off of datasets you've uploaded to Akkio. They can be viewed as a better-designed v2 of our legacy /v1/models route.

Training is a fundamentally long operation, so is surfaced through a polling-based mechanism where you make the following calls:

  • One call to /new to submit the task

  • Polling calls to /{task_id}/status to check up on your task's status

  • One last call to /{task_id}/result once /status indicates it's done

Submit Controller

post

Model creation via API.

Body
dataset_idstringRequired

The ID of the dataset to train the model on.

durationintegerRequired

Integer corresponding to how much time we should spend on training. Higher values will take longer but generally be more accurate. Allowed values: 10 (Fastest), 60 (High Quality), 300 (Higher Quality), 1800 (Production)

extra_attentionbooleanOptional

Helps with predicting rare cases.

Default: false
forcebooleanOptional

Forces the creation of a new model even if another currently exists.

Default: false
ignore_fieldsstring[]Optional

An array of field names to ignore (case sensitive).

Default: []
predict_fieldsstring[]Required

An array of field names to predict (case sensitive).

Other propertiesanyOptional
Responses
post
/api/v1/models/train/new

Get Status Controller

get

Retrieves the status of the provided model creation call.

Path parameters
task_idstringRequired
Responses
200

Successful Response

application/json
get
/api/v1/models/train/{task_id}/status

Get Result Controller

get

Retrieves the result of a model creation call.

Path parameters
task_idstringRequired
Responses
200

Successful Response

application/json
Responseobject · ResponseGetResultControllerApiV1ModelsTrainTaskIdResultGet
get
/api/v1/models/train/{task_id}/result

Example Call Sequence

Here's a rough outline of how you'd make a request to the Inference bulk predictions endpoints.

HTTP Headers

Header Name
Required
Value

X-API-Key

Yes

Your team's API key. See Authentication.

1. Create Request

First, we'll submit the task into our asynchronous processing queue.

POST /api/v1/models/train/new

You'll receive an object like this containing a task id:

We'll use this in the next request.

2. Query for Task Status

Next, we'll query the status endpoint at a cadence to see whether the task is complete yet. This request might look something like this:

GET /api/v1/models/train/<task_id>/status

Note that you must use the same Task ID that you received from the task creation endpoint above.

This will provide you with a status field set to either SUBMITTED, IN_PROGRESS, FAILED, or SUCCEEDED. You can read more about each state on the Asynchronous Endpoints page.

Here's an example response you might get:

You should retry ("poll") this endpoint at a regular cadence until you get a response that looks something like this:

note

The location field is always relative to the API root (https://api.akkio.com/api/v1), not the overall website root (https://api.akkio.com). You'll need to remember to construct the end URL from the site name, API root, and the provided location.

Armed with this information, we'll move to the last request.

3. Query for Result

Armed with the location we got from the status call, we'll make a request for the end result.

GET /api/v1/models/train/<task_id>/result

You'll get a response that looks something like this:

Last updated

Was this helpful?