如何在 AzureML Python SDK 中将 PipelineParameter 传递到 AutoMLStep

How to pass PipelineParameter into AutoMLStep in AzureML Python SDK

我正在将 AzureML SDK 管道与 AutoMLStep 结合使用。如何将 PipelineParameter 添加到 AutoMLStep 配置中?我想用它来定义 max_horizon。 它应该与

一起使用

passthru_automl_config=False

但我收到错误

Message: Unsupported value of max_horizon. max_horizon must be integer or 'auto'

max_horizon = PipelineParameter(name='max_horizon', default_value=30)

automl_settings = {
            "iteration_timeout_minutes" : 60
            "grain_column_names": ["COUNTRY_CODE"],
            "time_column_name": "DATE"
        }        

automl_config = AutoMLConfig(task='forecasting',
                             path = "./src",
                             primary_metric=primary_metric,
                             iterations=iterations,
                             max_concurrent_iterations=max_concurrent_iterations,
                             training_data = train_data,
                             label_column_name = label,
                             n_cross_validations=5,
                             compute_target = compute_target,
                             max_horizon= max_horizon,
                             **automl_settings)

trainWithAutomlStep = AutoMLStep(name="experiment_name",
                                 automl_config=automl_config,
                                 passthru_automl_config=False,
                                 outputs=[metrics_data, model_data],
                                 allow_reuse=True)

您 运行 陷入类型检查问题。 max_horizon.

不允许类型 PipelineParameter

作为替代方案:您为什么不争取一个简单的 python_script_step 并使用 PipelineParameter 作为其输入。然后在 Python-Step 文件中定义 AutoML 例程。这样一来,一切尽在掌握...

这是微软的回复:

PipelineParameter is currently not supported for use with AutoMLConfig parameters inside of AutoMLStep.

Then, the only workaround in order to use PipelineParameter with AutoMLConfig would be to use AutoML in a PythonScriptStep, which is a similar usage/approach when you use AutoMLConfig with ParallelRunConfig in pipelines (without using AutoMLStep), like the ‘Many Models’ solution accelerator does.