Freigeben über


QUniform Klasse

QUniform-Verteilungskonfiguration.

Vererbung
azure.ai.ml.entities._job.sweep.search_space.Uniform
QUniform

Konstruktor

QUniform(min_value: int | float | None = None, max_value: int | float | None = None, q: int | None = None, **kwargs: Any)

Parameter

Name Beschreibung
min_value

Mindestwert der Verteilung.

Standardwert: None
max_value

Maximaler Wert der Verteilung.

Standardwert: None
q

Quantisierungsfaktor.

Standardwert: None

Beispiele

Konfigurieren von QUniform-Verteilungen für einen Hyperparameter-Sweep für einen Befehlsauftrag.


   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 QUniform, TruncationSelectionPolicy, Uniform

   job_for_sweep = job(
       kernel=Uniform(min_value=0.0005, max_value=0.005),
       penalty=QUniform(min_value=0.05, max_value=0.75, q=1),
   )

   sweep_job = job_for_sweep.sweep(
       sampling_algorithm="random",
       primary_metric="best_val_acc",
       goal="Maximize",
       max_total_trials=8,
       max_concurrent_trials=4,
       early_termination_policy=TruncationSelectionPolicy(delay_evaluation=5, evaluation_interval=2),
   )