AlgorithmSpecification

class aws_cdk.aws_stepfunctions_tasks.AlgorithmSpecification(*, algorithm_name=None, metric_definitions=None, training_image=None, training_input_mode=None)

Bases: object

Specify the training algorithm and algorithm-specific metadata.

Parameters
  • algorithm_name (Optional[str]) – Name of the algorithm resource to use for the training job. 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. Default: - No algorithm is specified

  • metric_definitions (Optional[Sequence[MetricDefinition]]) – List of metric definition objects. Each object specifies the metric name and regular expressions used to parse algorithm logs. Default: - No metrics

  • training_image (Optional[DockerImage]) – Registry path of the Docker image that contains the training algorithm. Default: - No Docker image is specified

  • training_input_mode (Optional[InputMode]) – Input mode that the algorithm supports. Default: ‘File’ mode

ExampleMetadata

infused

Example:

tasks.SageMakerCreateTrainingJob(self, "TrainSagemaker",
    training_job_name=sfn.JsonPath.string_at("$.JobName"),
    algorithm_specification=tasks.AlgorithmSpecification(
        algorithm_name="BlazingText",
        training_input_mode=tasks.InputMode.FILE
    ),
    input_data_config=[tasks.Channel(
        channel_name="train",
        data_source=tasks.DataSource(
            s3_data_source=tasks.S3DataSource(
                s3_data_type=tasks.S3DataType.S3_PREFIX,
                s3_location=tasks.S3Location.from_json_expression("$.S3Bucket")
            )
        )
    )],
    output_data_config=tasks.OutputDataConfig(
        s3_output_location=tasks.S3Location.from_bucket(s3.Bucket.from_bucket_name(self, "Bucket", "mybucket"), "myoutputpath")
    ),
    resource_config=tasks.ResourceConfig(
        instance_count=1,
        instance_type=ec2.InstanceType(sfn.JsonPath.string_at("$.InstanceType")),
        volume_size=Size.gibibytes(50)
    ),  # optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
    stopping_condition=tasks.StoppingCondition(
        max_runtime=Duration.hours(2)
    )
)

Attributes

algorithm_name

Name of the algorithm resource to use for the training job.

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.

Default
  • No algorithm is specified

Return type

Optional[str]

metric_definitions

List of metric definition objects.

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

Default
  • No metrics

Return type

Optional[List[MetricDefinition]]

training_image

Registry path of the Docker image that contains the training algorithm.

Default
  • No Docker image is specified

Return type

Optional[DockerImage]

training_input_mode

Input mode that the algorithm supports.

Default

‘File’ mode

Return type

Optional[InputMode]