共用方式為


SweepJobLimits 類別

掃掠作業的限制。

繼承
azure.ai.ml.entities._job.job_limits.JobLimits
SweepJobLimits

建構函式

SweepJobLimits(*, max_concurrent_trials: int | None = None, max_total_trials: int | None = None, timeout: int | None = None, trial_timeout: int | str | None = None)

僅限關鍵字的參數

名稱 Description
max_concurrent_trials

掃掠作業的並行試用版數目上限。

max_total_trials

掃掠作業的總試用版數目上限。

timeout

執行持續時間上限,以秒為單位,之後作業將會取消。

trial_timeout

每個掃掠作業試用的逾時值,以秒為單位。

範例

將限制指派給 SweepJob


   from azure.ai.ml.entities import CommandJob
   from azure.ai.ml.sweep import BayesianSamplingAlgorithm, Objective, SweepJob, SweepJobLimits

   command_job = CommandJob(
       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",
   )

   sweep = SweepJob(
       sampling_algorithm=BayesianSamplingAlgorithm(),
       trial=command_job,
       search_space={"ss": Choice(type="choice", values=[{"space1": True}, {"space2": True}])},
       inputs={"input1": {"file": "top_level.csv", "mode": "ro_mount"}},
       compute="top_level",
       limits=SweepJobLimits(trial_timeout=600),
       objective=Objective(goal="maximize", primary_metric="accuracy"),
   )

屬性

timeout

執行持續時間上限,以秒為單位,之後作業將會取消。

傳回

類型 Description
int

執行持續時間上限,以秒為單位,之後作業將會取消。

trial_timeout

每個掃掠作業試用的逾時值,以秒為單位。

傳回

類型 Description
int

每個掃掠作業試用的逾時值,以秒為單位。