Tutorial: Get started with Azure Machine Learning in Jupyter Notebooks

In this tutorial, you complete the steps to get started with Azure Machine Learning by using Jupyter Notebooks on a managed cloud-based workstation (compute instance). This tutorial is a precursor to all other Jupyter Notebook tutorials.

In this tutorial, you:

  • Create an Azure Machine Learning workspace to use in other Jupyter Notebook tutorials.
  • Clone the tutorials notebook to your folder in the workspace.
  • Create a cloud-based compute instance with the Azure Machine Learning Python SDK installed and preconfigured.

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 today.

Create a workspace

An Azure Machine Learning workspace is a foundational resource in the cloud that you use to experiment, train, and deploy machine learning models. It ties your Azure subscription and resource group to an easily consumed object in the service.

You create a workspace via the Azure portal, a web-based console for managing your Azure resources.

  1. Sign in to the Azure portal by using the credentials for your Azure subscription.

  2. In the upper-left corner of the Azure portal, select + Create a resource.

    Screenshot that shows the Create a resource option.

  3. Use the search bar to find Machine Learning.

  4. Select Machine Learning.

  5. In the Machine Learning pane, select Create to begin.

  6. Provide the following information to configure your new workspace:

    Field Description
    Workspace name Enter a unique name that identifies your workspace. In this example, we use docs-ws. Names must be unique across the resource group. Use a name that's easy to recall and to differentiate from workspaces created by others.
    Subscription Select the Azure subscription that you want to use.
    Resource group Use an existing resource group in your subscription, or enter a name to create a new resource group. A resource group holds related resources for an Azure solution. In this example, we use docs-aml.
    Location Select the location closest to your users and the data resources to create your workspace.
    Workspace edition Select Basic as the workspace type for this tutorial. The workspace type determines the features to which you'll have access and pricing. Everything in this tutorial can be performed with either a Basic or Enterprise workspace.
  7. After you're finished configuring the workspace, select Review + Create.

    Warning

    It can take several minutes to create your workspace in the cloud.

    When the process is finished, a deployment success message appears.

  8. To view the new workspace, select Go to resource.

Important

Take note of your workspace and subscription. You'll need this information to ensure you create your experiment in the right place.

Run a notebook in your workspace

Azure Machine Learning includes a cloud notebook server in your workspace for an install-free and preconfigured experience. Use your own environment if you prefer to have control over your environment, packages, and dependencies.

Follow along with this video or use the detailed steps to clone and run the tutorial notebook from your workspace.

Clone a notebook folder

You complete the following experiment setup and run steps in Azure Machine Learning studio. This consolidated interface includes machine learning tools to perform data science scenarios for data science practitioners of all skill levels.

  1. Sign in to Azure Machine Learning studio.

  2. Select your subscription and the workspace you created.

  3. On the left, select Notebooks.

  4. At the top, select the Samples tab.

  5. Open the Python folder.

  6. Open the folder with a version number on it. This number represents the current release for the Python SDK.

  7. Select the ... button at the right of the tutorials folder, and then select Clone.

    Screenshot that shows the Clone tutorials folder.

  8. A list of folders shows each user who accesses the workspace. Select your folder to clone the tutorials folder there.

Open the cloned notebook

  1. Open the tutorials folder that was closed into your User files section.

    Important

    You can view notebooks in the samples folder but you can't run a notebook from there. To run a notebook, make sure you open the cloned version of the notebook in the User Files section.

  2. Select the tutorial-1st-experiment-sdk-train.ipynb file in your tutorials/image-classification-mnist-data folder.

    Screenshot that shows the Open tutorials folder.

  3. On the top bar, select a compute instance to use to run the notebook. These virtual machines (VMs) are preconfigured with everything you need to run Azure Machine Learning.

  4. If no VMs are found, select + Add to create the compute instance VM.

    1. When you create a VM, follow these rules:

      • A name is required, and the field can't be empty.
      • The name must be unique (in a case-insensitive fashion) across all existing compute instances in the Azure region of the workspace or compute instance. You'll get an alert if the name you choose isn't unique.
      • Valid characters are uppercase and lowercase letters, numbers 0 to 9, and the dash character (-).
      • The name must be between 3 and 24 characters long.
      • The name should start with a letter, not a number or a dash character.
      • If a dash character is used, it must be followed by at least one letter after the dash. For example, Test-, test-0, test-01 are invalid, while test-a0, test-0a are valid instances.
    2. Select the VM size from the available choices. For the tutorials, the default VM is a good choice.

    3. Then select Create. It can take approximately five minutes to set up your VM.

  5. When the VM is available, it appears in the top toolbar. You can now run the notebook by using either Run all in the toolbar or Shift+Enter in the code cells of the notebook.

If you have custom widgets or prefer to use Jupyter or JupyterLab, select the Jupyter drop-down list on the far right. Then select Jupyter or JupyterLab. The new browser window opens.

Next steps

Now that you have a development environment set up, continue on to train a model in a Jupyter Notebook.

If you don't plan on following any other tutorials now, stop the cloud notebook server VM when you aren't using it to reduce cost.

If you used a compute instance or Notebook VM, stop the VM when you aren't using it to reduce cost.

  1. In your workspace, select Compute.

  2. From the list, select the VM.

  3. Select Stop.

  4. When you're ready to use the server again, select Start.