Sagemaker API 列出超参数



我目前正在尝试在我的训练管道中实现 MLFlow 跟踪,并希望记录每个训练作业的超参数优化的超参数。

有谁知道,如何提取可以在 sagemaker 训练作业界面(在 AWS 控制台上(上看到的超参数列表?有没有其他更聪明的方法可以列出模型在 Sagemaker 中的表现(和显示(?

我认为必须有一种简单且 Python 的方式来执行此操作(boto3 或 sagemaker api(来获取这些数据。我无法在Cloudwatch中找到它。

提前非常感谢!

SageMaker python SDK中确实有一种相当python的方式:

tuner = sagemaker.tuner.HyperparameterTuner.attach('< your tuning jobname>')
results = tuner.analytics().dataframe()  # all your tuning metadata, in pandas!

在此处查看完整示例 https://github.com/aws-samples/amazon-sagemaker-tuneranalytics-samples/blob/master/SageMaker-Tuning-Job-Analytics.ipynb

要进行更多比较,请使用Oliver_Cruchant发布的内容。

要使用 SageMaker Python SDK (v1.65.0+( 获取超参数,请执行以下操作:

tuner = sagemaker.tuner.HyperparameterTuner.attach('your-tuning-job-name')
job_desc = tuner.describe()
job_desc['HyperParameterRanges']  # returns a dictionary with your tunable hyperparameters
job_desc['StaticHyperParameters']  # returns a dictionary with your other hyperparameters

和 boto3:

sagemaker = boto3.client('sagemaker')
job_desc = sagemaker.describe_hyper_parameter_tuning_job(HyperParameterTuningJobName='your-tuning-job-name')
job_desc['HyperParameterRanges']  # returns a dictionary with your tunable hyperparameters
job_desc['StaticHyperParameters']  # returns a dictionary with your other hyperparameters

这两种方式都返回调用DescribeHyperParameterTuningJobAPI 的结果。

DescribeHyperParameterTuningJobAPI 文档:https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeHyperParameterTuningJob.html

最新更新