Trains a dataset and creates a model.
Request Parameters
Name | Type | Description | Available Version |
---|---|---|---|
| string | Specifies the algorithm used to train the dataset. Optional. Use this parameter only when training a dataset with a
| 2.0 |
| long | ID of the dataset to train. | 1.0 |
| int | Number of training iterations for the neural network. Optional. Valid values are 1–1,000.
The larger the number, the longer the training takes to complete. | 1.0 |
| float | Specifies how much the gradient affects the optimization of the model at each time step. Optional. Use this parameter to tune your model. Valid values are between 0.0001 and 0.01. If not specified, the default is 0.0001. We recommend keeping this value between 0.0001 and 0.001. This parameter isn't used when training a detection dataset. | 1.0 |
| string | Name of the model. Maximum length is 180 characters. | 1.0 |
| object | JSON that contains parameters that specify how the model is created. Optional. Valid values:
| 1.0 |
Keep the following points in mind when training a dataset:
- If you’re unsure which values to set for the
epochs
andlearningRate
parameters, we recommend that you omit them and use the defaults. - A dataset can have only one training in progress at a time. Let's say you train a dataset and there's a model with a status of
RUNNING
orQUEUED
. If you attempt to train the same dataset again, you receive an error. - If you try to train a dataset that was deleted or that has a status of
DELETE_PENDING
, you receive an error.
Response Body
Name | Type | Description | Available Version |
---|---|---|---|
| string | Algorithm used to create the model. Returned only when the | 2.0 |
| date | Date and time that the model was created. | 1.0 |
| long | ID of the dataset trained to create the model. | 1.0 |
| int | N/A | 1.0 |
| int | Number of epochs used during training. | 1.0 |
| string | Model language inherited from the dataset language. Default is | 2.0 |
| float | Learning rate used during training. | 1.0 |
| string | ID of the model. Contains letters and numbers. | 1.0 |
| string | Type of data from which the model was created. Inferred from the dataset
| 1.0 |
| string | Name of the model. | 1.0 |
| string | Object returned; in this case, | 1.0 |
| float | How far the training job has progressed. Values are between 0–1. | 1.0 |
| int | Where the training job is in the queue. This field appears in the response only if the status is | 1.0 |
| string | Status of the training job. Valid values are:
| 1.0 |
| object | Training parameters passed into the request. For example, if you sent in a split of 0.7, the response contains | 1.0 |
| object | Returns null when you train a dataset. Training statistics are returned when the status is | 1.0 |
| date | Date and time that the model was last updated. | 1.0 |
This cURL command sends in the trainParams
request parameter. This command has double quotes and escaped double quotes around trainSplitRatio
to run on Windows. You might need to reformat it to run on another OS.
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "name=Beach Mountain Model" -F "datasetId=57" -F "trainParams={\"trainSplitRatio\":0.7}" https://api.einstein.ai/v2/vision/train
You can pass in multiple training parameters. For example, you specify withFeedback
and trainSplitRatio
using this JSON: {"withFeedback" : true, "trainSplitRatio" : 0.7}
.
If you want to train a dataset and update an existing model, see Retrain a Dataset.