DEV Community

Cover image for Azure ML Experiments and Runs
Ambarish Ganguly
Ambarish Ganguly

Posted on • Edited on

4 3

Azure ML Experiments and Runs

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'
            )
Enter fullscreen mode Exit fullscreen mode

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')
Enter fullscreen mode Exit fullscreen mode

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()
Enter fullscreen mode Exit fullscreen mode

References

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay