AWS sagemaker documentation change
Summary
Removed legacy SageMaker Python SDK v2/v3 sections and code examples, including built-in algorithm implementation details
Security assessment
Documentation cleanup removing outdated implementation examples. No evidence of security vulnerability fixes or security feature additions.
Diff
diff --git a/sagemaker/latest/dg/xgboost-how-to-use.md b/sagemaker/latest/dg/xgboost-how-to-use.md index 785ea5d38..53efeaf16 100644 --- a//sagemaker/latest/dg/xgboost-how-to-use.md +++ b//sagemaker/latest/dg/xgboost-how-to-use.md @@ -28,3 +27,0 @@ Use XGBoost as a framework to run your customized training scripts that can inco -SageMaker Python SDK v3 - - @@ -84,44 +80,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - - import boto3 - import sagemaker - from sagemaker.xgboost.estimator import XGBoost - from sagemaker.session import Session - from sagemaker.inputs import TrainingInput - - # initialize hyperparameters - hyperparameters = { - "max_depth":"5", - "eta":"0.2", - "gamma":"4", - "min_child_weight":"6", - "subsample":"0.7", - "verbosity":"1", - "objective":"reg:squarederror", - "num_round":"50"} - - # set an output path where the trained model will be saved - bucket = sagemaker.Session().default_bucket() - prefix = 'DEMO-xgboost-as-a-framework' - output_path = 's3://{}/{}/{}/output'.format(bucket, prefix, 'abalone-xgb-framework') - - # construct a SageMaker AI XGBoost estimator - # specify the entry_point to your xgboost training script - estimator = XGBoost(entry_point = "your_xgboost_abalone_script.py", - framework_version='1.7-1', - hyperparameters=hyperparameters, - role=sagemaker.get_execution_role(), - instance_count=1, - instance_type='ml.m5.2xlarge', - output_path=output_path) - - # define the data type and paths to the training and validation datasets - content_type = "libsvm" - train_input = TrainingInput("s3://{}/{}/{}/".format(bucket, prefix, 'train'), content_type=content_type) - validation_input = TrainingInput("s3://{}/{}/{}/".format(bucket, prefix, 'validation'), content_type=content_type) - - # execute the XGBoost training job - estimator.fit({'train': train_input, 'validation': validation_input}) - @@ -134,3 +86,0 @@ Use the XGBoost built-in algorithm to build an XGBoost training container as sho -SageMaker Python SDK v3 - - @@ -190,52 +139,0 @@ When you retrieve the SageMaker AI XGBoost image URI, do not use `:latest` or `: -SageMaker Python SDK v2 (Legacy) - - -After specifying the XGBoost image URI, use the XGBoost container to construct an estimator using the SageMaker AI Estimator API and initiate a training job. This XGBoost built-in algorithm mode does not incorporate your own XGBoost training script and runs directly on the input datasets. - -###### Important - -When you retrieve the SageMaker AI XGBoost image URI, do not use `:latest` or `:1` for the image URI tag. You must specify one of the [Supported versions](./xgboost.html#xgboost-supported-versions) to choose the SageMaker AI-managed XGBoost container with the native XGBoost package version that you want to use. To find the package version migrated into the SageMaker AI XGBoost containers, see [Docker Registry Paths and Example Code](https://docs.aws.amazon.com/sagemaker/latest/dg-ecr-paths/sagemaker-algo-docker-registry-paths.html). Then choose your AWS Region, and navigate to the **XGBoost (algorithm)** section. - - - import sagemaker - import boto3 - from sagemaker import image_uris - from sagemaker.session import Session - from sagemaker.inputs import TrainingInput - - # initialize hyperparameters - hyperparameters = { - "max_depth":"5", - "eta":"0.2", - "gamma":"4", - "min_child_weight":"6", - "subsample":"0.7", - "objective":"reg:squarederror", - "num_round":"50"} - - # set an output path where the trained model will be saved - bucket = sagemaker.Session().default_bucket() - prefix = 'DEMO-xgboost-as-a-built-in-algo' - output_path = 's3://{}/{}/{}/output'.format(bucket, prefix, 'abalone-xgb-built-in-algo') - - # this line automatically looks for the XGBoost image URI and builds an XGBoost container. - # specify the repo_version depending on your preference. - xgboost_container = sagemaker.image_uris.retrieve("xgboost", region, "1.7-1") - - # construct a SageMaker AI estimator that calls the xgboost-container - estimator = sagemaker.estimator.Estimator(image_uri=xgboost_container, - hyperparameters=hyperparameters, - role=sagemaker.get_execution_role(), - instance_count=1, - instance_type='ml.m5.2xlarge', - volume_size=5, # 5 GB - output_path=output_path) - - # define the data type and paths to the training and validation datasets - content_type = "libsvm" - train_input = TrainingInput("s3://{}/{}/{}/".format(bucket, prefix, 'train'), content_type=content_type) - validation_input = TrainingInput("s3://{}/{}/{}/".format(bucket, prefix, 'validation'), content_type=content_type) - - # execute the XGBoost training job - estimator.fit({'train': train_input, 'validation': validation_input}) -