Manage models

Stay organized with collections Save and categorize content based on your preferences.

This page describes how to tune, pause, resume, delete, and list recommendation models. For help with creating a new recommendation model, see Create recommendation models.

Tune a model

The Retail API uses the input data you provide to your model to adjust hyperparameters for training.

Tuning takes 2-4 days, during which the model continues to work as usual. For tuning cost details, see Pricing.

Set a model's tuning frequency

We recommend you periodically tune your model. This keeps model training optimal as data changes and customer behavior differs throughout the year. In addition, some internal major model upgrades can only be applied after the model has been tuned.

When creating the model, you can set it to automatically tune every three months, or choose to only tune it manually. Regardless of the setting you choose, the model automatically tunes one time after creation.

You can change the tuning status setting at any time. Changing this setting doesn't affect currently running tuning processes.

To edit a model's tuning status setting:

Console

  1. Go to the Retail Models page in the Google Cloud console.

    Go to the Models page

    You can see the tuning status of every model under Tuning status.

  2. Click a model name to view its details page.

  3. Click Edit next to Tuning status.

  4. From the drop-down list, select a setting:

    • Every three months. Automatically tunes when the last tune was 90 days ago.
    • Manual tune only. Tunes only when you manually tune.
  5. Click Done to save your setting.

curl

Make a Models.patch request using the v2beta API. See the Models.patch API reference.

For details about all Models fields, see the Models API reference.

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d '{
  "name": "projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models/MODEL_ID",
  "PeriodicTuningState": "NEW_TUNING_STATE_VALUE"
}' \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models/MODEL_ID?updateMask=PeriodicTuningState'

Manually tune a model

Manual tune triggers a one-time tune of your model. You might manually tune your model when there is a significant change in your catalog (such as size increase or change in catalog hierarchy) or events (such as backfilling historical events or a change in data distribution after promoting certain groups of items).

To manually tune a model:

Console

  1. Go to the Retail Models page in the Google Cloud console.

    Go to the Models page

  2. Click a model name to view its details page.

  3. Click Manual Tune in the button bar.

    Tuning takes 2-4 days, during which the model continues to work as usual.

curl

Make a Models.tune request using the v2beta API. See the Models.tune API reference.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models/MODEL_ID:tune'

Pause and resume training for a model

If your model is active (not paused), the model is retrained at least once a week, but no more often than once a day. For consistent retraining, make sure that you upload user event data no more than 24 hours after the event occurs.

You can pause your model to stop retraining. You might want to do this if you have imported bad data or to stay under the limit of 10 active models per project. If you have fewer than 10 active models, you can restart a paused model at any time.

For training cost details, see Pricing.

You can start up to 5 model operations per minute. Limited model operations include creation, deletion, pause, and resume.

To pause or restart a model:

Console

  1. Go to the Retail Models page in the Google Cloud console.

    Go to the Models page

    You can see the training status of every model under Training status.

  2. To pause an active model (Training status of TRAINING), click Pause .

  3. To start a paused model (Training status of PAUSED), click Resume .

curl

To pause an active model, make a Models.pause request using the v2beta API. See the Models.pause API reference.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models/MODEL_ID:pause'

To start a paused model, make a Models.resume request using the v2beta API.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models/MODEL_ID:resume'

List your models

View a list of your models in the console or using the Models.list API method.

Console

  1. Go to the Retail Models page in the Google Cloud console.

    Go to the Models page

  2. The Models page lists all your models and their training and query statuses.

curl

To list all models inline, make a Models.list request using the v2beta API. See the Models.list API reference.

Optionally, you can use the parameter pageSize to set a maximum number of results to return. If more results are available, the list response includes a page token. You can pass a page token in the pageToken parameter of a list request to retrieve the next page of results. The example below uses both parameters.

curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models?pageSize=PAGE_SIZE&pageToken=PAGE_TOKEN'

Delete a model

You can start up to 5 model operations per minute. Limited model operations include creation, deletion, pause, and resume.

Delete a model in the console or using the Models.delete API method.

Console

  1. Go to the Retail Models page in the Google Cloud console.

    Go to the Models page

  2. Click the name of the model you want to delete to open its details page.

  3. Click Delete in the button bar.

  4. Reenter the model name and click Confirm.

curl

Make a Models.delete request using the v2beta API. See the Models.delete API reference.

For details about all Models fields, see the Models API reference.

curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
'https://retail.googleapis.com/v2beta/projects/PROJECT_NUMBER/locations/global/catalogs/default_catalog/models/MODEL_ID'