Uniform Class

Uniform distribution configuration.

Inheritance
azure.ai.ml.entities._job.sweep.search_space.SweepDistribution
Uniform

Constructor

Uniform(min_value: float | None = None, max_value: float | None = None, **kwargs: Any)

Parameters

Name Description
min_value

Minimum value of the distribution.

Default value: None
max_value

Maximum value of the distribution.

Default value: None

Examples

Configuring Uniform distributions for learning rates and momentum during a hyperparameter sweep on a Command job.


   from azure.ai.ml import command

   job = command(
       inputs=dict(kernel="linear", penalty=1.0),
       compute=cpu_cluster,
       environment=f"{job_env.name}:{job_env.version}",
       code="./scripts",
       command="python scripts/train.py --kernel $kernel --penalty $penalty",
       experiment_name="sklearn-iris-flowers",
   )

   # we can reuse an existing Command Job as a function that we can apply inputs to for the sweep configurations
   from azure.ai.ml.sweep import Uniform

   job_for_sweep = job(
       kernel=Uniform(min_value=0.0005, max_value=0.005),
       penalty=Uniform(min_value=0.9, max_value=0.99),
   )