Quickstart: Use your own notebook server to get started with Azure Machine Learning

Use your own Python environment and Jupyter Notebook Server to get started with Azure Machine Learning service. For a quickstart with no SDK installation, see Quickstart: Use a cloud-based notebook server to get started with Azure Machine Learning.

This quickstart shows how you can use the Azure Machine Learning service workspace to keep track of your machine learning experiments. You will run Python code that log values into the workspace.

View a video version of this quickstart:

If you don’t have an Azure subscription, create a free account before you begin. Try the free or paid version of Azure Machine Learning service today.

Prerequisites

  • A Python 3.6 notebook server with the Azure Machine Learning SDK installed
  • An Azure Machine Learning service workspace
  • A workspace configuration file (.azureml/config.json).

Get all these prerequisites from Create an Azure Machine Learning service workspace.

Use the workspace

Create a script or start a notebook in the same directory as your workspace configuration file (.azureml/config.json).

Attach to workspace

This code reads information from the configuration file to attach to your workspace.

from azureml.core import Workspace

ws = Workspace.from_config()

Log values

Run this code that uses the basic APIs of the SDK to track experiment runs.

  1. Create an experiment in the workspace.
  2. Log a single value into the experiment.
  3. Log a list of values into the experiment.
from azureml.core import Experiment

# Create a new experiment in your workspace.
exp = Experiment(workspace=ws, name='myexp')

# Start a run and start the logging service.
run = exp.start_logging()

# Log a single  number.
run.log('my magic number', 42)

# 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()

View logged results

When the run finishes, you can view the experiment run in the Azure portal. To print a URL that navigates to the results for the last run, use the following code:

print(run.get_portal_url())

This code returns a link you can use to view the logged values in the Azure portal in your browser.

Logged values in the Azure portal

Clean up resources

Important

You can use the resources you've created here as prerequisites to other Machine Learning tutorials and how-to articles.

If you don't plan to use the resources that you created in this article, delete them to avoid incurring any charges.

ws.delete(delete_dependent_resources=True)

Next steps

In this article, you created the resources you need to experiment with and deploy models. You ran code in a notebook, and you explored the run history for the code in your workspace in the cloud.

You can also explore more advanced examples on GitHub or view the SDK user guide.