本文整理汇总了Python中azureml.core.Experiment方法的典型用法代码示例。如果您正苦于以下问题:Python core.Experiment方法的具体用法?Python core.Experiment怎么用?Python core.Experiment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azureml.core
的用法示例。
在下文中一共展示了core.Experiment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from azureml import core [as 别名]
# 或者: from azureml.core import Experiment [as 别名]
def __init__(
self,
experiment_name,
workspace_name=_WORKSPACE,
resource_group=_RESOURCE_GROUP,
subscription_id=_SUBSCRIPTION_ID,
workspace_region=_REGION,
config_path=_DEFAULT_AML_PATH,
):
self._logger = logging.getLogger(__name__)
self._logger.info("SDK version:" + str(azureml.core.VERSION))
self._ws = workspace_for_user(
workspace_name=workspace_name,
resource_group=resource_group,
subscription_id=subscription_id,
workspace_region=workspace_region,
config_path=config_path,
).aml_workspace
self._experiment = core.Experiment(self._ws, name=experiment_name)
self._cluster = None
self._datastore = None
示例2: _get_experiment
# 需要导入模块: from azureml import core [as 别名]
# 或者: from azureml.core import Experiment [as 别名]
def _get_experiment(self):
from azureml.core import Experiment
from .project import AzureProject
ws = AzureProject(self.ctx)._get_ws()
experiment_name = self.ctx.config.get('experiment/name', None)
if experiment_name is None:
raise AzureException('Please specify Experiment name...')
experiment = Experiment(ws, experiment_name)
return ws, experiment
示例3: run_batchscore_pipeline
# 需要导入模块: from azureml import core [as 别名]
# 或者: from azureml.core import Experiment [as 别名]
def run_batchscore_pipeline():
try:
env = Env()
args = parse_args()
aml_workspace = Workspace.get(
name=env.workspace_name,
subscription_id=env.subscription_id,
resource_group=env.resource_group,
)
scoringpipeline = get_pipeline(args.pipeline_id, aml_workspace, env)
experiment = Experiment(workspace=aml_workspace, name=env.experiment_name) # NOQA: E501
run = experiment.submit(
scoringpipeline,
pipeline_parameters={
"model_name": env.model_name,
"model_version": env.model_version,
"model_tag_name": " ",
"model_tag_value": " ",
},
)
run.wait_for_completion(show_output=True)
if run.get_status() == "Finished":
copy_output(list(run.get_steps())[0].id, env)
except Exception as ex:
print("Error: {}".format(ex))
示例4: create_cluster
# 需要导入模块: from azureml import core [as 别名]
# 或者: from azureml.core import Experiment [as 别名]
def create_cluster(
self,
name=_CLUSTER_NAME,
vm_size=_CLUSTER_VM_SIZE,
min_nodes=_CLUSTER_MIN_NODES,
max_nodes=_CLUSTER_MAX_NODES,
):
"""Creates AzureML cluster
Args:
name (string, optional): The name you wish to assign the cluster.
Defaults to _CLUSTER_NAME.
vm_size (string, optional): The type of sku to use for your vm.
Defaults to _CLUSTER_VM_SIZE.
min_nodes (int, optional): Minimum number of nodes in cluster.
Use 0 if you don't want to incur costs when it isn't being used.
Defaults to _CLUSTER_MIN_NODES.
max_nodes (int, optional): Maximum number of nodes in cluster.
Defaults to _CLUSTER_MAX_NODES.
Returns:
ExperimentCLI: Experiment object
"""
self._cluster = _create_cluster(
self._ws,
cluster_name=name,
vm_size=vm_size,
min_nodes=min_nodes,
max_nodes=max_nodes,
)
return self
示例5: create_datastore
# 需要导入模块: from azureml import core [as 别名]
# 或者: from azureml.core import Experiment [as 别名]
def create_datastore(
self,
datastore_name=_DATASTORE_NAME,
container_name=_CONTAINER_NAME,
account_name=_ACCOUNT_NAME,
account_key=_ACCOUNT_KEY,
):
"""Creates datastore
Args:
datastore_name (string, optional): Name you wish to assign to your datastore. Defaults to _DATASTORE_NAME.
container_name (string, optional): Name of your container. Defaults to _CONTAINER_NAME.
account_name (string, optional): Storage account name. Defaults to _ACCOUNT_NAME.
account_key (string, optional): The storage account key. Defaults to _ACCOUNT_KEY.
Returns:
ExperimentCLI: Experiment object
"""
assert account_name is not None, "Account name for Datastore not set"
assert account_key is not None, "Account key for Datastore not set"
self._datastore = _create_datastore(
self._ws,
datastore_name=datastore_name,
container_name=container_name,
account_name=account_name,
account_key=account_key,
)
return self
示例6: cancel_all_runs
# 需要导入模块: from azureml import core [as 别名]
# 或者: from azureml.core import Experiment [as 别名]
def cancel_all_runs(exp_name, run_id=None):
from azureml.core import Experiment
from azureml.core import get_run
ws = get_workspace()
exp = Experiment(ws, exp_name)
if run_id:
r = get_run(experiment=exp, run_id=run_id, rehydrate=True)
# check the returned run type and status
print(type(r), r.get_status())
# you can cancel a run if it hasn't completed or failed
if r.get_status() not in ["Complete", "Failed"]:
r.cancel()
else:
# if you don't know the run id, you can list all
# runs under an experiment
for r in exp.get_runs():
run = get_run(experiment=exp, run_id=r.id, rehydrate=True)
for c in run.get_children():
for gc in c.get_children():
if (
gc.get_status() == "Running"
or gc.get_status() == "Queued"
):
print(gc.id, gc.get_status())
gc.cancel()
if c.get_status() == "Running" or c.get_status() == "Queued":
print(c.id, c.get_status())
c.cancel()
if r.get_status() == "Running" or r.get_status() == "Queued":
print(r.id, r.get_status())
r.cancel()