AWS sagemaker documentation change
Summary
Updated SageMaker Python SDK examples from v2 to v3 syntax, replacing s3_input method with Channel/S3DataSource shapes and adding new code examples
Security assessment
The changes are purely SDK syntax updates and code example improvements. There's no mention of vulnerabilities, security patches, or security features. The modifications focus on data distribution configuration without any security context.
Diff
diff --git a/sagemaker/latest/dg/randomcutforest.md b/sagemaker/latest/dg/randomcutforest.md index 335bd7b90..9e81e6677 100644 --- a//sagemaker/latest/dg/randomcutforest.md +++ b//sagemaker/latest/dg/randomcutforest.md @@ -40 +40 @@ Amazon SageMaker AI Random Cut Forest supports the `train` and `test` data chann -The train channel only supports `S3DataDistributionType=ShardedByS3Key` and the test channel only supports `S3DataDistributionType=FullyReplicated`. The following example specifies the S3 distribution type for the train channel using the [Amazon SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/v2.html). +The train channel only supports `S3DataDistributionType=ShardedByS3Key` and the test channel only supports `S3DataDistributionType=FullyReplicated`. The following example specifies the S3 distribution type for the train channel using the [Amazon SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/). @@ -44 +44,31 @@ The train channel only supports `S3DataDistributionType=ShardedByS3Key` and the -The `sagemaker.inputs.s3_input` method was renamed to `sagemaker.inputs.TrainingInput` in [SageMaker Python SDK v2](https://sagemaker.readthedocs.io/en/stable/v2.html#s3-input). +The `sagemaker.inputs.s3_input` method is replaced by the `Channel` and `S3DataSource` shapes in SageMaker Python SDK v3. Distribution type is configured on the `S3DataSource` within a `Channel`. + +SageMaker Python SDK v3 + + + + import sagemaker + from sagemaker.train import ModelTrainer + from sagemaker.core.shapes import Channel, DataSource, S3DataSource + from sagemaker.core.helper.session_helper import Session, get_execution_role + + # specify Random Cut Forest training job information and hyperparameters + rcf = ModelTrainer(...) + + # specify training data input channel with ShardedByS3Key distribution + train_data = Channel( + channel_name="training", + data_source=DataSource( + s3_data_source=S3DataSource( + s3_data_type="S3Prefix", + s3_uri=s3_training_data_location, + s3_data_distribution_type="ShardedByS3Key" + ) + ) + ) + + # run the training job on input data stored in S3 + rcf.train(input_data_config=[train_data]) + +SageMaker Python SDK v2 (Legacy) +