Experiment¶
-
class
smexperiments.experiment.
Experiment
(sagemaker_boto_client, **kwargs)¶ Bases:
smexperiments._base_types.Record
An Amazon SageMaker experiment, which is a collection of related trials.
New experiments are created by calling
create()
. Existing experiments can be reloaded by callingload()
. You can add a new trial to an Experiment by callingcreate_trial()
. To remove a Trial from an experiment, delete the trial.-
experiment_name
= None
-
description
= None
-
save
()¶ Save the state of this Experiment to SageMaker.
Returns: Update experiment API response. Return type: dict
-
delete
()¶ Delete this Experiment from SageMaker.
Deleting an Experiment requires that each Trial in the Experiment is first deleted.
Returns: Delete experiment API response. Return type: dict
-
classmethod
load
(experiment_name, sagemaker_boto_client=None)¶ Load an existing experiment and return an
Experiment
object representing it.Parameters: - experiment_name – (str): Name of the experiment
- sagemaker_boto_client (SageMaker.Client, optional) – Boto3 client for SageMaker. If not supplied, a default boto3 client will be created and used.
Returns: A SageMaker
Experiment
objectReturn type: sagemaker.experiments.experiment.Experiment
-
classmethod
create
(experiment_name=None, description=None, sagemaker_boto_client=None)¶ Create a new experiment in SageMaker and return an
Experiment
object.Parameters: - experiment_name – (str): Name of the experiment. Must be unique. Required.
- experiment_description – (str, optional): Description of the experiment
- sagemaker_boto_client (SageMaker.Client, optional) – Boto3 client for SageMaker. If not supplied, a default boto3 client will be created and used.
Returns: A SageMaker
Experiment
objectReturn type: sagemaker.experiments.experiment.Experiment
-
classmethod
list
(created_before=None, created_after=None, sort_by=None, sort_order=None, sagemaker_boto_client=None)¶ List experiments. Returns experiments in the account matching the specified criteria.
Parameters: - created_before – (datetime.datetime, optional): Return experiments created before this instant.
- created_after – (datetime.datetime, optional): Return experiments created after this instant.
- sort_by (str, optional) – Which property to sort results by. One of ‘Name’, ‘CreationTime’.
- sort_order (str, optional) – One of ‘Ascending’, or ‘Descending’.
- sagemaker_boto_client (SageMaker.Client, optional) – Boto3 client for SageMaker. If not supplied, a default boto3 client will be used.
Returns: - An iterator
over experiment summaries matching the specified criteria.
Return type: collections.Iterator[sagemaker.experiments.api_types.ExperimentSummary]
-
list_trials
(created_before=None, created_after=None, sort_by=None, sort_order=None)¶ List trials in this experiment matching the specified criteria.
Parameters: - created_before (datetime.datetime, optional) – Return trials created before this instant.
- created_after (datetime.datetime, optional) – Return trials created after this instant.
- sort_by (str, optional) – Which property to sort results by. One of ‘Name’, ‘CreationTime’.
- sort_order (str, optional) – One of ‘Ascending’, or ‘Descending’.
Returns: - An iterator over
trials matching the criteria.
Return type: collections.Iterator[sagemaker.experiments.api_types.TrialSummary]
-
create_trial
(trial_name=None, trial_name_prefix='SageMakerTrial')¶ Create a trial in this experiment.
Since trial names are expected to be unique in an account,
trial_name_prefix
can be provided instead oftrial_name
. In this case a unique name will be generated that begins with the specified prefix.Parameters: Returns: - A SageMaker
Trial
object representing the created trial.
Return type: sagemaker.experiments.trial.Trial
- A SageMaker
-