Choice Class
Choice distribution configuration.
- Inheritance
-
azure.ai.ml.entities._job.sweep.search_space.SweepDistributionChoice
Constructor
Choice(values: List[float | str | dict] | None = None, **kwargs: Any)
Parameters
Name | Description |
---|---|
values
|
List of values to choose from. Default value: None
|
Examples
Using Choice distribution to set values for a hyperparameter sweep
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",
)
from azure.ai.ml.sweep import Choice, LogUniform
# we can reuse an existing Command Job as a function that we can apply inputs to for the sweep configurations
job_for_sweep = job(
kernel=LogUniform(min_value=-6, max_value=-1),
penalty=Choice([0.9, 0.18, 0.36, 0.72]),
)
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure SDK for Python