azure.ai.ml.sweep package¶
-
class
azure.ai.ml.sweep.
BanditPolicy
(**kwargs)[source]¶ - Keyword Arguments
delay_evaluation (int) – Number of intervals by which to delay the first evaluation.
evaluation_interval (int) – Interval (number of runs) between policy evaluations.
slack_amount (float) – Absolute distance allowed from the best performing run.
slack_factor (float) – Ratio of the allowed distance from the best performing run.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
class
azure.ai.ml.sweep.
BayesianSamplingAlgorithm
(**kwargs)[source]¶ -
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
-
class
azure.ai.ml.sweep.
Choice
(values: Optional[List[Union[float, str, dict]]] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
GridSamplingAlgorithm
(**kwargs)[source]¶ -
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
-
class
azure.ai.ml.sweep.
LogNormal
(mu: Optional[float] = None, sigma: Optional[float] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
LogUniform
(min_value: Optional[float] = None, max_value: Optional[float] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
MedianStoppingPolicy
(**kwargs)[source]¶ - Keyword Arguments
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
class
azure.ai.ml.sweep.
Normal
(mu: Optional[float] = None, sigma: Optional[float] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
Objective
(goal: Optional[str] = None, primary_metric: Optional[str] = None, **kwargs)[source]¶ Optimization objective.
All required parameters must be populated in order to send to Azure.
- Parameters
- Keyword Arguments
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
goal
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
class
azure.ai.ml.sweep.
QLogNormal
(mu: Optional[float] = None, sigma: Optional[float] = None, q: Optional[int] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
QLogUniform
(min_value: Optional[float] = None, max_value: Optional[float] = None, q: Optional[int] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
QNormal
(mu: Optional[float] = None, sigma: Optional[float] = None, q: Optional[int] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
QUniform
(min_value: Optional[Union[int, float]] = None, max_value: Optional[Union[int, float]] = None, q: Optional[int] = None, **kwargs)[source]¶
-
class
azure.ai.ml.sweep.
RandomSamplingAlgorithm
(rule=None, seed=None, **kwargs)[source]¶ - Keyword Arguments
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
class
azure.ai.ml.sweep.
SamplingAlgorithm
[source]¶ -
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.
-
-
class
azure.ai.ml.sweep.
SweepJob
(*, name: Optional[str] = None, description: Optional[str] = None, tags: Optional[Dict] = None, display_name: Optional[str] = None, experiment_name: Optional[str] = None, identity: Optional[Union[azure.ai.ml._restclient.v2022_02_01_preview.models._models_py3.ManagedIdentity, azure.ai.ml._restclient.v2022_02_01_preview.models._models_py3.AmlToken, azure.ai.ml._restclient.v2022_02_01_preview.models._models_py3.UserIdentity]] = None, inputs: Optional[Dict[str, Union[azure.ai.ml.entities._inputs_outputs.Input, str, bool, int, float]]] = None, outputs: Optional[Dict[str, azure.ai.ml.entities._inputs_outputs.Output]] = None, compute: Optional[str] = None, limits: Optional[azure.ai.ml.entities._job.job_limits.SweepJobLimits] = None, sampling_algorithm: Optional[Union[str, azure.ai.ml.entities._job.sweep.sampling_algorithm.SamplingAlgorithm]] = None, search_space: Optional[Dict[str, azure.ai.ml.entities._job.sweep.search_space.SweepDistribution]] = None, objective: Optional[azure.ai.ml.entities._job.sweep.objective.Objective] = None, trial: Optional[Union[azure.ai.ml.entities._job.command_job.CommandJob, azure.ai.ml.entities._component.command_component.CommandComponent]] = None, early_termination: Optional[azure.ai.ml.entities._job.sweep.early_termination_policy.EarlyTerminationPolicy] = None, **kwargs: Any)[source]¶ Sweep job for hyperparameter tuning.
- Parameters
name (str) – Name of the job.
display_name (str) – Display name of the job.
description (str) – Description of the job.
tags (dict[str, str]) – Tag dictionary. Tags can be added, removed, and updated.
properties (dict[str, str]) – The asset property dictionary.
experiment_name (str) – Name of the experiment the job will be created under, if None is provided, job will be created under experiment ‘Default’.
identity (Union[azure.ai.ml.ManagedIdentity, azure.ai.ml.AmlToken, azure.ai.ml.UserIdentity]) – Identity that training job will use while running on compute.
inputs (dict) – Inputs to the command.
outputs (dict[str, azure.ai.ml.Output]) – Mapping of output data bindings used in the job.
sampling_algorithm (str) – The hyperparameter sampling algorithm to use over the search_space. Defaults to “random”.
search_space (Dict) – Dictionary of the hyperparameter search space. The key is the name of the hyperparameter and the value is the parameter expression.
objective (Objective) – Metric to optimize for.
compute (str) – The compute target the job runs on.
trial (Union[azure.ai.ml.entities.CommandJob, azure.ai.ml.entities.CommandComponent]) – The job configuration for each trial. Each trial will be provided with a different combination of hyperparameter values that the system samples from the search_space.
early_termination (EarlyTerminationPolicy) – The early termination policy to use. A trial job is canceled when the criteria of the specified policy are met. If omitted, no early termination policy will be applied.
limits (SweepJobLimits) – Limits for the sweep job.
kwargs (dict) – A dictionary of additional configuration parameters.
Class Resource constructor.
- Parameters
name (str) – Name of the resource.
description (str, optional) – Description of the resource., defaults to None
tags (Dict, optional) – Tag dictionary. Tags can be added, removed, and updated., defaults to None
properties (Dict, optional) – The asset property dictionary., defaults to None
kwargs (dict) – A dictionary of additional configuration parameters.
-
dump
(path: Union[os.PathLike, str]) → None¶ Dump the job content into a file in yaml format.
- Parameters
path (str) – Path to a local file as the target, new file will be created, raises exception if the file exists.
-
set_limits
(*, max_concurrent_trials: Optional[int] = None, max_total_trials: Optional[int] = None, timeout: Optional[int] = None, trial_timeout: Optional[int] = None) → NoReturn¶ Set limits for Sweep node. Leave parameters as None if you don’t want to update corresponding values.
-
set_objective
(*, goal: Optional[str] = None, primary_metric: Optional[str] = None) → None¶ Set the sweep object
- Parameters
goal – Required. Defines supported metric goals for hyperparameter tuning. Possible values
include: “minimize”, “maximize”. :type goal: str :param primary_metric: Required. Name of the metric to optimize. :type primary_metric: str
-
PYTHON_SDK_TYPE_MAPPING
= {<class 'float'>: 'number', <class 'int'>: 'integer', <class 'bool'>: 'boolean', <class 'str'>: 'string'}¶
-
property
creation_context
¶ Creation context
- Returns
Creation metadata of the resource.
- Return type
Optional[SystemData]
-
property
early_termination
¶
-
property
id
¶ Resource ID.
- Returns
Global id of the resource, Azure Resource Manager ID
- Return type
Optional[str]
-
property
inputs
¶
-
property
limits
¶
-
property
log_files
¶ Job output files.
-
property
outputs
¶
-
property
sampling_algorithm
¶
-
property
status
¶ Status of the job.
Common values returned include “Running”, “Completed”, and “Failed”.
Note
NotStarted - This is a temporary state client-side Run objects are in before cloud submission.
Starting - The Run has started being processed in the cloud. The caller has a run ID at this point.
Provisioning - Returned when on-demand compute is being created for a given job submission.
- Preparing - The run environment is being prepared:
docker image build
conda environment setup
- Queued - The job is queued in the compute target. For example, in BatchAI the job is in queued state
while waiting for all the requested nodes to be ready.
Running - The job started to run in the compute target.
Finalizing - User code has completed and the run is in post-processing stages.
CancelRequested - Cancellation has been requested for the job.
- Completed - The run completed successfully. This includes both the user code and run
post-processing stages.
Failed - The run failed. Usually the Error property on a run will provide details as to why.
Canceled - Follows a cancellation request and indicates that the run is now successfully cancelled.
NotResponding - For runs that have Heartbeats enabled, no heartbeat has been recently sent.
- Returns
Status of the job.
- Return type
-
class
azure.ai.ml.sweep.
SweepJobLimits
(*, max_concurrent_trials: Optional[int] = None, max_total_trials: Optional[int] = None, timeout: Optional[int] = None, trial_timeout: Optional[int] = None, **kwargs: Any)[source]¶ Sweep Job limit class.
Variables are only populated by the server, and will be ignored when sending a request.
- Parameters
max_concurrent_trials (int) – Sweep Job max concurrent trials.
max_total_trials (int) – Sweep Job max total trials.
timeout (int) – The max run duration in seconds , after which the job will be cancelled. Only supports duration with precision as low as Seconds.
trial_timeout (int) – Sweep Job Trial timeout value in seconds.
- Keyword Arguments
timeout (timedelta) – The max run duration in ISO 8601 format, after which the job will be cancelled. Only supports duration with precision as low as Seconds.
max_concurrent_trials (int) – Sweep Job max concurrent trials.
max_total_trials (int) – Sweep Job max total trials.
trial_timeout (timedelta) – Sweep Job Trial timeout value.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
property
timeout
¶
-
property
trial_timeout
¶
-
class
azure.ai.ml.sweep.
TruncationSelectionPolicy
(**kwargs)[source]¶ - Keyword Arguments
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionally use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
validate
()¶ Validate this model recursively and return a list of ValidationError.
- Returns
A list of validation error
- Return type
-
type
¶ A data descriptor that transforms value from snake_case to CamelCase in setter, CamelCase to snake_case in getter. When the optional private_name is provided, the descriptor will set the private_name in the object’s __dict__.