# AlgorithmSpecification

Specify the training algorithm and algorithm-specific metadata.

- Source: [`aws-stepfunctions-tasks/lib/sagemaker/base-types.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts#L20)

## Example

```ts
new tasks.SageMakerCreateTrainingJob(this, 'TrainSagemaker', {
  trainingJobName: sfn.JsonPath.stringAt('$.JobName'),
  algorithmSpecification: {
    algorithmName: 'BlazingText',
    trainingInputMode: tasks.InputMode.FILE,
  },
  inputDataConfig: [{
    channelName: 'train',
    dataSource: {
      s3DataSource: {
        s3DataType: tasks.S3DataType.S3_PREFIX,
        s3Location: tasks.S3Location.fromJsonExpression('$.S3Bucket'),
      },
    },
  }],
  outputDataConfig: {
    s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket'), 'myoutputpath'),
  },
  resourceConfig: {
    instanceCount: 1,
    instanceType: new ec2.InstanceType(sfn.JsonPath.stringAt('$.InstanceType')),
    volumeSize: Size.gibibytes(50),
  }, // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
  stoppingCondition: {
    maxRuntime: Duration.hours(2),
  }, // optional: default is 1 hour
});
```

## Properties

- `algorithmName`: string — Name of the algorithm resource to use for the training job.

  **Default:** No algorithm is specified

  This must be an algorithm resource that you created or subscribe to on AWS Marketplace.
  If you specify a value for this parameter, you can't specify a value for TrainingImage.

- `metricDefinitions`: [MetricDefinition](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.MetricDefinition.html)[] — List of metric definition objects.

  **Default:** No metrics

  Each object specifies the metric name and regular expressions used to parse algorithm logs.

- `trainingImage`: [DockerImage](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.DockerImage.html) — Registry path of the Docker image that contains the training algorithm.

  **Default:** No Docker image is specified

- `trainingInputMode`: [InputMode](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks.InputMode.html) — Input mode that the algorithm supports.

  **Default:** 'File' mode
