Creates a new model.

Scopes

You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: retail2 --scope <scope> projects locations-catalogs-models-create ...

Required Scalar Argument

  • <parent> (string)
    • Required. The parent resource under which to create the model. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

GoogleCloudRetailV2Model:
  create-time: string
  data-state: string
  display-name: string
  filtering-option: string
  last-tune-time: string
  model-features-config:
    frequently-bought-together-config:
      context-products-type: string
  name: string
  optimization-objective: string
  periodic-tuning-state: string
  serving-state: string
  training-state: string
  tuning-operation: string
  type: string
  update-time: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . create-time=sadipscing
    • Output only. Timestamp the Recommendation Model was created at.
  • data-state=diam
    • 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.
  • display-name=sea
    • 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.
  • filtering-option=ipsum
    • Optional. If RECOMMENDATIONS_FILTERING_ENABLED, recommendation filtering by attributes is enabled for the model.
  • last-tune-time=stet
    • Output only. The timestamp when the latest successful tune finished.
  • model-features-config.frequently-bought-together-config context-products-type=gubergren

    • 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.
  • ... name=ipsum

    • Required. The fully qualified resource name of the model. Format: projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id} catalog_id has char limit of 50. recommendation_model_id has char limit of 40.
  • optimization-objective=no
    • 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 optimization_objective 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 optimization_objective = ctr), you receive an error 400 if you try to create/update a recommendation with this set of knobs.
  • periodic-tuning-state=sit
    • Optional. The state of periodic tuning. The period we use is 3 months - to do a one-off tune earlier use the TuneModel method. Default value is PERIODIC_TUNING_ENABLED.
  • serving-state=kasd
    • Output only. The serving state of the model: ACTIVE, NOT_ACTIVE.
  • training-state=amet
    • 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 CreateModel method is TRAINING. The default value for UpdateModel method is to keep the state the same as before.
  • tuning-operation=lorem
    • 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.
  • type=justo
    • 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 optimization_objective 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 optimization_objective = ctr), you receive an error 400 if you try to create/update a recommendation with this set of knobs.
  • update-time=invidunt
    • 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.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional Method Properties

You may set the following properties to further configure the call. Please note that -p is followed by one or more key-value-pairs, and is called like this -p k1=v1 k2=v2 even though the listing below repeats the -p for completeness.

  • -p dry-run=boolean
    • Optional. Whether to run a dry run to validate the request (without actually creating the model).

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").