How do I configure search space ranges in an Azure Machine Learning sweep job from input parameters?

Cynthia Luijkx 5 Reputation points
2024-12-06T10:57:50.7766667+00:00

I am using Azure Machine Learning pipeline SDK v2 and I'd like to do a sweep job while specifying the search space range from the inputs parameters. The example currently available currently does not cover this, and I've been having problems getting it to work myself.

I'd like to dosomething like this:

$schema: https://azuremlschemas.azureedge.net/latest/pipelineJob.schema.json
type: pipeline
display_name: pipeline_with_hyperparameter_sweep
description: Tune hyperparameters using TF component
settings:
    default_compute: azureml:cpu-cluster

inputs:
  c_value_min: 0.5
  c_value_max: 0.9

jobs:
  sweep_step:
    type: sweep
    inputs:
      data: 
        type: uri_file
        path: wasbs://datasets@azuremlexamples.blob.core.windows.net/iris.csv
      degree: 3
      gamma: "scale"
      shrinking: False
    outputs:
      model_output:
      test_data:
    sampling_algorithm: random
    trial: ./train.yml
    search_space:
      c_value:
        type: uniform
        min_value: ${{parent.inputs.c_value_min}}
        max_value: ${{parent.inputs.c_value_max}}
    objective:
      goal: minimize
      primary_metric: training_f1_score
    limits:
      max_total_trials: 5
      max_concurrent_trials: 3
      timeout: 7200

This method unfortunately does not work however. The pipeline is submitted correctly, but in the sweep job itself the inputs provided are replaced with '0's as if they are missing. I have been unable to figure out the correct syntax to use here, or to find proper examples.

Could you help me out?

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,073 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.