

This is the new *Amazon CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [Amazon CloudFormation User Guide](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::SageMaker::Algorithm TrainingSpecification
<a name="aws-properties-sagemaker-algorithm-trainingspecification"></a>

Defines how the algorithm is used for a training job.

## Syntax
<a name="aws-properties-sagemaker-algorithm-trainingspecification-syntax"></a>

To declare this entity in your Amazon CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-sagemaker-algorithm-trainingspecification-syntax.json"></a>

```
{
  "[MetricDefinitions](#cfn-sagemaker-algorithm-trainingspecification-metricdefinitions)" : {{[ MetricDefinition, ... ]}},
  "[SupportedHyperParameters](#cfn-sagemaker-algorithm-trainingspecification-supportedhyperparameters)" : {{[ HyperParameterSpecification, ... ]}},
  "[SupportedTrainingInstanceTypes](#cfn-sagemaker-algorithm-trainingspecification-supportedtraininginstancetypes)" : {{[ String, ... ]}},
  "[SupportedTuningJobObjectiveMetrics](#cfn-sagemaker-algorithm-trainingspecification-supportedtuningjobobjectivemetrics)" : {{[ HyperParameterTuningJobObjective, ... ]}},
  "[SupportsDistributedTraining](#cfn-sagemaker-algorithm-trainingspecification-supportsdistributedtraining)" : {{Boolean}},
  "[TrainingChannels](#cfn-sagemaker-algorithm-trainingspecification-trainingchannels)" : {{[ ChannelSpecification, ... ]}},
  "[TrainingImage](#cfn-sagemaker-algorithm-trainingspecification-trainingimage)" : {{String}},
  "[TrainingImageDigest](#cfn-sagemaker-algorithm-trainingspecification-trainingimagedigest)" : {{String}}
}
```

### YAML
<a name="aws-properties-sagemaker-algorithm-trainingspecification-syntax.yaml"></a>

```
  [MetricDefinitions](#cfn-sagemaker-algorithm-trainingspecification-metricdefinitions): {{
    - MetricDefinition}}
  [SupportedHyperParameters](#cfn-sagemaker-algorithm-trainingspecification-supportedhyperparameters): {{
    - HyperParameterSpecification}}
  [SupportedTrainingInstanceTypes](#cfn-sagemaker-algorithm-trainingspecification-supportedtraininginstancetypes): {{
    - String}}
  [SupportedTuningJobObjectiveMetrics](#cfn-sagemaker-algorithm-trainingspecification-supportedtuningjobobjectivemetrics): {{
    - HyperParameterTuningJobObjective}}
  [SupportsDistributedTraining](#cfn-sagemaker-algorithm-trainingspecification-supportsdistributedtraining): {{Boolean}}
  [TrainingChannels](#cfn-sagemaker-algorithm-trainingspecification-trainingchannels): {{
    - ChannelSpecification}}
  [TrainingImage](#cfn-sagemaker-algorithm-trainingspecification-trainingimage): {{String}}
  [TrainingImageDigest](#cfn-sagemaker-algorithm-trainingspecification-trainingimagedigest): {{String}}
```

## Properties
<a name="aws-properties-sagemaker-algorithm-trainingspecification-properties"></a>

`MetricDefinitions`  <a name="cfn-sagemaker-algorithm-trainingspecification-metricdefinitions"></a>
A list of `MetricDefinition` objects, which are used for parsing metrics generated by the algorithm.  
*Required*: No  
*Type*: Array of [MetricDefinition](aws-properties-sagemaker-algorithm-metricdefinition.md)  
*Maximum*: `40`  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SupportedHyperParameters`  <a name="cfn-sagemaker-algorithm-trainingspecification-supportedhyperparameters"></a>
A list of the `HyperParameterSpecification` objects, that define the supported hyperparameters. This is required if the algorithm supports automatic model tuning.>  
*Required*: No  
*Type*: Array of [HyperParameterSpecification](aws-properties-sagemaker-algorithm-hyperparameterspecification.md)  
*Maximum*: `100`  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SupportedTrainingInstanceTypes`  <a name="cfn-sagemaker-algorithm-trainingspecification-supportedtraininginstancetypes"></a>
A list of the instance types that this algorithm can use for training.  
*Required*: Yes  
*Type*: Array of String  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SupportedTuningJobObjectiveMetrics`  <a name="cfn-sagemaker-algorithm-trainingspecification-supportedtuningjobobjectivemetrics"></a>
A list of the metrics that the algorithm emits that can be used as the objective metric in a hyperparameter tuning job.  
*Required*: No  
*Type*: Array of [HyperParameterTuningJobObjective](aws-properties-sagemaker-algorithm-hyperparametertuningjobobjective.md)  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`SupportsDistributedTraining`  <a name="cfn-sagemaker-algorithm-trainingspecification-supportsdistributedtraining"></a>
Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more than one instance during training.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`TrainingChannels`  <a name="cfn-sagemaker-algorithm-trainingspecification-trainingchannels"></a>
A list of `ChannelSpecification` objects, which specify the input sources to be used by the algorithm.  
*Required*: Yes  
*Type*: Array of [ChannelSpecification](aws-properties-sagemaker-algorithm-channelspecification.md)  
*Minimum*: `1`  
*Maximum*: `8`  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`TrainingImage`  <a name="cfn-sagemaker-algorithm-trainingspecification-trainingimage"></a>
The Amazon ECR registry path of the Docker image that contains the training algorithm.  
*Required*: Yes  
*Type*: String  
*Maximum*: `255`  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`TrainingImageDigest`  <a name="cfn-sagemaker-algorithm-trainingspecification-trainingimagedigest"></a>
An MD5 hash of the training algorithm that identifies the Docker image used for training.  
*Required*: No  
*Type*: String  
*Pattern*: `^[Ss][Hh][Aa]256:[0-9a-fA-F]{64}$`  
*Maximum*: `72`  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)