BanditPolicy 클래스
slack 조건과 평가 빈도 및 지연 간격을 기반으로 조기 종료 정책을 정의합니다.
- 상속
-
azure.ai.ml.entities._job.sweep.early_termination_policy.EarlyTerminationPolicyBanditPolicy
생성자
BanditPolicy(*, delay_evaluation: int = 0, evaluation_interval: int = 0, slack_amount: float = 0, slack_factor: float = 0)
키워드 전용 매개 변수
Name | Description |
---|---|
delay_evaluation
|
첫 번째 평가를 지연할 간격의 수입니다. 기본값은 0입니다. |
evaluation_interval
|
정책 평가 사이의 간격(실행 수)입니다. 기본값은 0입니다. |
slack_amount
|
최상의 실행에서 허용되는 절대 거리입니다. 기본값은 0입니다. |
slack_factor
|
가장 성능이 뛰어난 실행에서 허용된 거리의 비율입니다. 기본값은 0입니다. |
예제
Command 작업에서 하이퍼 매개 변수 스윕의 BanditPolicy 조기 종료 구성
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),
)
from azure.ai.ml.sweep import BanditPolicy
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=BanditPolicy(slack_factor=0.15, evaluation_interval=1, delay_evaluation=10),
)
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for Python