Hyperparameters

Accessors to retrieve hyperparameters for training jobs.

sagemaker.hyperparameters.retrieve_default(region=None, model_id=None, model_version=None, include_container_hyperparameters=False)

Retrieves the default training hyperparameters for the model matching the given arguments.

Parameters
  • region (str) – The AWS Region for which to retrieve the default hyperparameters. Defaults to None.

  • model_id (str) – The model ID of the model for which to retrieve the default hyperparameters. (Default: None).

  • model_version (str) – The version of the model for which to retrieve the default hyperparameters. (Default: None).

  • include_container_hyperparameters (bool) – True if the container hyperparameters should be returned. Container hyperparameters are not used to tune the specific algorithm. They are used by SageMaker Training jobs to set up the training container environment. For example, there is a container hyperparameter that indicates the entrypoint script to use. These hyperparameters may be required when creating a training job with boto3, however the Estimator classes add required container hyperparameters to the job. (Default: False).

Returns

The hyperparameters to use for the model.

Return type

dict

Raises

ValueError – If the combination of arguments specified is not supported.

sagemaker.hyperparameters.validate(region=None, model_id=None, model_version=None, hyperparameters=None, validation_mode=None)

Validates hyperparameters for models.

Parameters
  • region (str) – The AWS Region for which to validate hyperparameters. (Default: None).

  • model_id (str) – The model ID of the model for which to validate hyperparameters. (Default: None).

  • model_version (str) – The version of the model for which to validate hyperparameters. (Default: None).

  • hyperparameters (dict) – Hyperparameters to validate. (Default: None).

  • validation_mode (HyperparameterValidationMode) – Method of validation to use with hyperparameters. If set to VALIDATE_PROVIDED, only hyperparameters provided to this function will be validated, the missing hyperparameters will be ignored. If set to``VALIDATE_ALGORITHM``, all algorithm hyperparameters will be validated. If set to VALIDATE_ALL, all hyperparameters for the model will be validated. (Default: None).

Raises
  • JumpStartHyperparametersError – If the hyperparameter is not formatted correctly, according to its specs in the model metadata.

  • ValueError – If the combination of arguments specified is not supported.

Return type

None