TruncationSelectionPolicy クラス

指定された割合の実行を評価間隔ごとに取り消す早期終了ポリシーを定義します。

継承
azure.ai.ml.entities._job.sweep.early_termination_policy.EarlyTerminationPolicy
TruncationSelectionPolicy

コンストラクター

TruncationSelectionPolicy(*, delay_evaluation: int = 0, evaluation_interval: int = 0, truncation_percentage: int = 0)

キーワードのみのパラメーター

名前 説明
delay_evaluation
int

最初の評価を遅らせる間隔の数。 既定値は 0 です。

evaluation_interval
int

ポリシー評価間の間隔 (実行数)。 既定値は 0 です。

truncation_percentage
int

各評価期間に取り消される実行の割合。 既定値は 0 です。

TruncationStoppingPolicy を使用したハイパーパラメーター スイープ ジョブの早期終了ポリシーの構成


   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),
   )