Get Image Model Learning Curve

Returns the metrics for each epoch in a model that has a modelType of image. These metrics show you the f1 score, accuracy, confusion matrix, test accuracy, and so on for each training iteration performed to create the model.

Response Body

Name

Type

Description

Available Version

data

array

Array of learningcurve objects.

1.0

object

string

Object returned; in this case, list.

1.0

learningCurve Response Body

Name

Type

Description

Available Version

epoch

int

Epoch to which the metrics correspond.

1.0

epochResults

object

Prediction results for the set of data used to test the model during training.

1.0

metricsData

object

Model metrics values.

1.0

object

string

Object returned; in this case, learningcurve.

1.0

metricsData Response Body

Name

Type

Description

Available Version

confusionMatrix

array

Array of integers that contains the correct and incorrect classifications for each label in the dataset based on testing done during the training process.

1.0

f1

array

Array of floats that contains the weighted average of precision and recall for each label in the dataset. The corresponding label for each value in this array can be found in the labels array. For example, the first f1 score in the f1 array corresponds to the first label in the labels array.

1.0

labels

array

Array of strings that contains the dataset labels. These labels correspond to the values in the f1 array and the confusionMatrix array.

1.0

testAccuracy

float

Accuracy of the test data. From your initial dataset, by default, 10% of the data is set aside and isn't used during training to create the model. This 10% is then sent to the model for prediction. How often the correct prediction is made with this 10% is reported as testAccuracy.

1.0

trainingAccuracy

float

Accuracy of the training data. By default, 90% of the data from your dataset is left after the test accuracy set is set aside. This 90% is then sent to the model for prediction. How often the correct prediction is made with this 90% is reported as trainingAccuracy.

1.0

trainingLoss

float

Summary of the errors made in predictions using the training and validation data. The lower the number value, the more accurate the model.

1.0

epochResults Response Body

Name

Type

Description

Available Version

exampleName

string

Example name, followed by a hyphen, and the expected label. For example, "exampleName": "549525751.jpg-Mountains".

1.0

expectedLabel

string

Image label provided when the dataset (used to create the model) was created.

1.0

predictedLabel

string

Label that the model predicted for the example

1.0

You can use the learning curve data to see how a model performed in each training iteration. This information helps you tune your model and identify the optimal number of epochs to specify when you train a dataset.

When you train a dataset, you can specify the number of epochs used to create the model, or if you don't specify any epochs, the training call selects a number of epochs based on the dataset data. In each epoch, machine learning happens behind the scenes to create the model. Information from an epoch is passed into the next epoch, from that epoch to the next, and so on.

When it comes to epochs, more isn't always better. For example, you could train a dataset and specify five epochs. Using the learning curve data for the resulting model, you might see that the most accurate results for that dataset are in the third epoch. You can use the learning curve data to see if your model is overfit (model predicts accurately with training data but not unseen data) or underfit (model doesn't predict accurately with training data or unseen data).

For information about correlating the confusion matrix values and the labels, see Get Model Metrics.

Use the Epoch Results to Tune the Model

Use the epochResults values to better understand the testAccuracy number the model returns for each epoch. For example, if testAccuracy is 1, then each example in the set of test examples was predicted correctly. But if testAccuracy is .5, then you can look at the epochResults to see for which test data the model returned incorrect predictions.

Query Parameters

By default, this call returns 25 epochs. To page through the epochs for a model, use the offset and count query parameters.

Name

Description

Available Version

count

Number of epochs to return. Maximum valid value is 25. If you specify a number greater than 25, the call returns 25 epochs. Optional.

1.0

offset

Index of the epoch from which you want to start paging. Optional.

1.0

Here's an example of these query parameters. If you omit the count parameter, the API returns 25 epochs. If you omit the offset parameter, paging starts at 0.

curl -X GET -H "Authorization: BEARER <TOKEN>" -H "Cache-Control: no-cache"  "https://api.einstein.ai/v2/vision/models/7JXCXTRXTMNLJCEF2DR5CJ46QU/lc?offset=30&count=10"

For example, let's say you want to page through all of the model epochs and show 10 at a time. The first call would have offset=0 and count=10, the second call would have offset=10 and count=10, and so on.

Language