Ambarish Ganguly
Posted on March 13, 2021
An experiment is a grouping of many runs from a specified script. It always belongs to a workspace. When we submit a run, we provide an experiment name. Information for the run is stored under that experiment. If the name doesn't exist when we submit an experiment, a new experiment is automatically created.
A run is a single execution of a training script. An experiment will typically contain multiple runs.
A run has the following characteristics
- Metrics
- Child Runs
- Outputs
- Logs
A run also has metrics and parameters associated with it
A run also has outputs associated with it
Code
Create the workspace
from azureml.core import Workspace
from azureml.core import Workspace
from azureml.core.authentication import InteractiveLoginAuthentication
sid = '<your-subscription-id>'
forced_interactive_auth = InteractiveLoginAuthentication(tenant_id="<your-tenant-id>", force=True)
ws = Workspace.create(name='azureml_workspace',
subscription_id= sid,
resource_group='rgazureml',
create_resource_group = True,
location='centralus'
)
Create an experiment and a run
from azureml.core import Experiment
# create an experiment
exp = Experiment(workspace=ws, name='trial_exp')
# start a run
run = exp.start_logging()
# log a number
run.log('trial', 30)
# log a list (Fibonacci numbers)
run.log_list('my list', [1, 1, 2, 3, 5, 8, 13, 21, 34, 55])
# finish the run
run.complete()
print('Finished logging')
Create another run
# start a run
run = exp.start_logging()
# log a number
run.log('trial2', 35)
# log a list
run.log_list('my list2', [1, 1, 2, 2, 5, 5, 13, 13, 13, 13])
# finish the run
run.complete()
References
💖 💪 🙅 🚩
Ambarish Ganguly
Posted on March 13, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.