REST Resource: projects.locations.catalogs.models

Resource: Model

Metadata that describes the training and serving parameters of a Model. A Model can be associated with a ServingConfig and then queried through the Predict API.

JSON representation
{
  "name": string,
  "displayName": string,
  "trainingState": enum (TrainingState),
  "servingState": enum (ServingState),
  "createTime": string,
  "updateTime": string,
  "type": string,
  "optimizationObjective": string,
  "periodicTuningState": enum (PeriodicTuningState),
  "lastTuneTime": string,
  "tuningOperation": string,
  "dataState": enum (DataState),
  "filteringOption": enum (RecommendationsFilteringOption),
  "servingConfigLists": [
    {
      object (ServingConfigList)
    }
  ],
  "modelFeaturesConfig": {
    object (ModelFeaturesConfig)
  }
}
Fields
name

string

Required. The fully qualified resource name of the model.

Format: projects/{projectNumber}/locations/{locationId}/catalogs/{catalogId}/models/{modelId} catalogId has char limit of 50. recommendation_model_id has char limit of 40.

displayName

string

Required. The display name of the model.

Should be human readable, used to display Recommendation Models in the Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 characters.

trainingState

enum (TrainingState)

Optional. The training state that the model is in (e.g. TRAINING or PAUSED).

Since part of the cost of running the service is frequency of training - this can be used to determine when to train model in order to control cost. If not specified: the default value for models.create method is TRAINING. The default value for models.patch method is to keep the state the same as before.

servingState

enum (ServingState)

Output only. The serving state of the model: ACTIVE, NOT_ACTIVE.

createTime

string (Timestamp format)

Output only. Timestamp the Recommendation Model was created at.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

updateTime

string (Timestamp format)

Output only. Timestamp the Recommendation Model was last updated. E.g. if a Recommendation Model was paused - this would be the time the pause was initiated.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

type

string

Required. The type of model e.g. home-page.

Currently supported values: recommended-for-you, others-you-may-like, frequently-bought-together, page-optimization, similar-items, buy-it-again, on-sale-items, and recently-viewed(readonly value).

This field together with optimizationObjective describe model metadata to use to control model training and serving. See https://cloud.google.com/retail/docs/models for more details on what the model metadata control and which combination of parameters are valid. For invalid combinations of parameters (e.g. type = frequently-bought-together and optimizationObjective = ctr), you receive an error 400 if you try to create/update a recommendation with this set of knobs.

optimizationObjective

string

Optional. The optimization objective e.g. cvr.

Currently supported values: ctr, cvr, revenue-per-order.

If not specified, we choose default based on model type. Default depends on type of recommendation:

recommended-for-you => ctr

others-you-may-like => ctr

frequently-bought-together => revenue_per_order

This field together with optimizationObjective describe model metadata to use to control model training and serving. See https://cloud.google.com/retail/docs/models for more details on what the model metadata control and which combination of parameters are valid. For invalid combinations of parameters (e.g. type = frequently-bought-together and optimizationObjective = ctr), you receive an error 400 if you try to create/update a recommendation with this set of knobs.

periodicTuningState

enum (PeriodicTuningState)

Optional. The state of periodic tuning.

The period we use is 3 months - to do a one-off tune earlier use the models.tune method. Default value is PERIODIC_TUNING_ENABLED.

lastTuneTime

string (Timestamp format)

Output only. The timestamp when the latest successful tune finished.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

tuningOperation

string

Output only. The tune operation associated with the model.

Can be used to determine if there is an ongoing tune for this recommendation. Empty field implies no tune is goig on.

dataState

enum (DataState)

Output only. The state of data requirements for this model: DATA_OK and DATA_ERROR.

Recommendation model cannot be trained if the data is in DATA_ERROR state. Recommendation model can have DATA_ERROR state even if serving state is ACTIVE: models were trained successfully before, but cannot be refreshed because model no longer has sufficient data for training.

filteringOption

enum (RecommendationsFilteringOption)

Optional. If RECOMMENDATIONS_FILTERING_ENABLED, recommendation filtering by attributes is enabled for the model.

servingConfigLists[]

object (ServingConfigList)

Output only. The list of valid serving configs associated with the PageOptimizationConfig.

modelFeaturesConfig

object (ModelFeaturesConfig)

Optional. Additional model features config.

TrainingState

The training state of the model.

Enums
TRAINING_STATE_UNSPECIFIED Unspecified training state.
PAUSED The model training is paused.
TRAINING The model is training.

ServingState

The serving state of the model.

Enums
SERVING_STATE_UNSPECIFIED Unspecified serving state.
INACTIVE The model is not serving.
ACTIVE The model is serving and can be queried.
TUNED The model is trained on tuned hyperparameters and can be queried.

PeriodicTuningState

Describes whether periodic tuning is enabled for this model or not. Periodic tuning is scheduled at most every three months. You can start a tuning process manually by using the models.tune method, which starts a tuning process immediately and resets the quarterly schedule. Enabling or disabling periodic tuning does not affect any current tuning processes.

Enums
PERIODIC_TUNING_STATE_UNSPECIFIED Unspecified default value, should never be explicitly set.
PERIODIC_TUNING_DISABLED The model has periodic tuning disabled. Tuning can be reenabled by calling the EnableModelPeriodicTuning method or by calling the models.tune method.
ALL_TUNING_DISABLED The model cannot be tuned with periodic tuning OR the models.tune method. Hide the options in customer UI and reject any requests through the backend self serve API.
PERIODIC_TUNING_ENABLED The model has periodic tuning enabled. Tuning can be disabled by calling the DisableModelPeriodicTuning method.

DataState

Describes whether this model have sufficient training data to be continuously trained.

Enums
DATA_STATE_UNSPECIFIED Unspecified default value, should never be explicitly set.
DATA_OK The model has sufficient training data.
DATA_ERROR The model does not have sufficient training data. Error messages can be queried via Stackdriver.

ServingConfigList

Represents an ordered combination of valid serving configs, which can be used for PAGE_OPTIMIZATION recommendations.

JSON representation
{
  "servingConfigIds": [
    string
  ]
}
Fields
servingConfigIds[]

string

Optional. A set of valid serving configs that may be used for PAGE_OPTIMIZATION.

ModelFeaturesConfig

Additional model features config.

JSON representation
{

  // Union field type_dedicated_config can be only one of the following:
  "frequentlyBoughtTogetherConfig": {
    object (FrequentlyBoughtTogetherFeaturesConfig)
  }
  // End of list of possible types for union field type_dedicated_config.
}
Fields

Union field type_dedicated_config.

type_dedicated_config can be only one of the following:

frequentlyBoughtTogetherConfig

object (FrequentlyBoughtTogetherFeaturesConfig)

Additional configs for frequently-bought-together models.

FrequentlyBoughtTogetherFeaturesConfig

Additional configs for the frequently-bought-together model type.

JSON representation
{
  "contextProductsType": enum (ContextProductsType)
}
Fields
contextProductsType

enum (ContextProductsType)

Optional. Specifies the context of the model when it is used in predict requests. Can only be set for the frequently-bought-together type. If it isn't specified, it defaults to MULTIPLE_CONTEXT_PRODUCTS.

ContextProductsType

Use single or multiple context products for recommendations.

Enums
CONTEXT_PRODUCTS_TYPE_UNSPECIFIED Unspecified default value, should never be explicitly set. Defaults to MULTIPLE_CONTEXT_PRODUCTS.
SINGLE_CONTEXT_PRODUCT Use only a single product as context for the recommendation. Typically used on pages like add-to-cart or product details.
MULTIPLE_CONTEXT_PRODUCTS Use one or multiple products as context for the recommendation. Typically used on shopping cart pages.

Methods

create

Creates a new model.

delete

Deletes an existing model.

get

Gets a model.

list

Lists all the models linked to this event store.

patch

Update of model metadata.

pause

Pauses the training of an existing model.

resume

Resumes the training of an existing model.

tune

Tunes an existing model.