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

Speedy emails, satisfied customers

Postmark Image

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay