Home > Back-end >  Error while defining sampling algorithm in hyper parameter tuning using random sampling - Version V1
Error while defining sampling algorithm in hyper parameter tuning using random sampling - Version V1

Time:07-30

I am trying to perform the random sampling to accomplish the hyper parameter tuning and tuning parameter version 1 (v1). I would like to get the chance to define the algorithm as sampling algorithm explicitly.

Currently using the below code block and is there any chance of implementing explicitly defining sampling in V1? If not, any specific procedure to solve the issue is helpful.

from azureml.train.hyperdrive import RandomParameterSampling
from azureml.train.hyperdrive import normal, uniform, choice
param_sampling = RandomParameterSampling( {
        "learning_rate": normal(10, 3),
        "keep_probability": uniform(0.05, 0.1),
        "batch_size": choice(16, 32, 64, 128)
    }
)

CodePudding user response:

There is an explicit procedure called a sweep job. This sweep job in hyperparameter value. We can mention the random sampling using the sweep job explicitly.

From azure.ai.ml.sweep import Normal, Uniform, RandomParameterSampling

Command_job_for_sweep = command_job(
    learning_rate = Normal(mu=value, sigma=value),
    keep_probability=Uniform(min_value= your value, max_value= value),
    batch_size = Choice(value=[.your values in list]),
)

Sweep_job = command_job_sweep.sweep(
    Computer =”cluster”,
    sampling_algorithm=”random”,
    ....
)

This will be available in version 2 (v2) of hyperparameter tuning in random sampling.

  • Related