Retrains a dataset and updates a model. Use this API call when you want to update a model and keep the model ID instead of creating a new 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 |
| int | Number of training iterations for the neural network. Optional. If not specified, the default is calculated based on the dataset size. The larger the number, the longer the training takes to complete. The training process stops before the specified number of epochs if the model has reached the optimal accuracy. When you get the training staus, the | 2.0 |
| float | N/A for intent or sentiment models. | 2.0 |
| string | ID of the model to be updated from the training. | 2.0 |
| object | JSON that contains parameters that specify how the model is created. Optional. Valid values:
| 2.0 |
This call retrains the dataset associated with model you specify in the request parameters. Use this call to retrain a dataset and update the model after new examples are added to a dataset or after feedback examples are added to a dataset. To find out the values specified in the trainParams
parameter when the model was trained, such as withFeedback
or withGlobalDatasetId
, see Get Training Status.
Keep the following points in mind when training a dataset:
- A dataset can have only one training in progress at a time. Let's say you retrain a dataset and there's a model with a status of
RUNNING
orQUEUED
. If you attempt to retrain the same dataset again, you receive an error. - You receive an error when you train a dataset that has more than 3 million words across all examples. Be sure that when you create a dataset or add examples to a dataset, that it contains less than 3 million words. For best results, we recommend that each example is around 100 words.
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. | 2.0 |
| long | ID of the dataset trained to create the model. | 2.0 |
| int | N/A | 2.0 |
| int | Number of epochs used during training. | 2.0 |
| string | Model language inherited from the dataset language. | 2.0 |
| float | N/A for intent or sentiment models. | 2.0 |
| string | ID of the model. Contains letters and numbers. | 2.0 |
| string | Type of data from which the model was created. Inferred from the dataset
| 2.0 |
| string | Name of the model. | 2.0 |
| string | Object returned; in this case, | 2.0 |
| float | How far the training job has progressed. Values are between 0–1. | 2.0 |
| int | Where the training job is in the queue. This field appears in the response only if the status is | 2.0 |
| string | Status of the training job. Valid values are:
| 2.0 |
| object | Training parameters passed into the request. For example, if you sent in a split of 0.7, the response contains | 2.0 |
| object | Returns null when you retrain a dataset. Training statistics are returned when the status is | 2.0 |
| date | Date and time that the model was last updated. | 2.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 "modelId=TUWBAIRLFB3KKEDZMEGIUR6COM" -F "trainParams={\"trainSplitRatio\":0.7}" https://api.einstein.ai/v2/language/retrain
You can pass in multiple training parameters. For example, you specify withFeedback
and trainSplitRatio
using this JSON: {"withFeedback" : true, "trainSplitRatio" : 0.7}
.