RandomSamplingAlgorithm Class
Random Sampling Algorithm.
- Inheritance
-
azure.ai.ml.entities._job.sweep.sampling_algorithm.SamplingAlgorithmRandomSamplingAlgorithm
Constructor
RandomSamplingAlgorithm(*, rule: str | None = None, seed: int | None = None, logbase: float | str | None = None)
Keyword-Only Parameters
Name | Description |
---|---|
rule
|
The specific type of random algorithm. Accepted values are: "random" and "sobol". |
seed
|
The seed for random number generation. |
logbase
|
A positive number or the number "e" in string format to be used as the base for log based random sampling. |
Examples
Assigning a random sampling algorithm for a SweepJob
from azure.ai.ml.entities import CommandJob
from azure.ai.ml.sweep import RandomSamplingAlgorithm, 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=RandomSamplingAlgorithm(seed=999, rule="sobol", logbase="e"),
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),
)
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for Python