Quickstart: Run Jupyter notebooks in studio

Get started with Azure Machine Learning by using Jupyter notebooks to learn more about the Python SDK.

In this quickstart, you'll learn how to run notebooks on a compute instance in Azure Machine Learning studio. A compute instance is an online compute resource that has a development environment already installed and ready to go.

You'll also learn where to find sample notebooks to help jump-start your path to training and deploying models with Azure Machine Learning.

Prerequisites

Create a new notebook

Create a new notebook in studio.

  1. Sign into Azure Machine Learning studio.

  2. Select your workspace, if it isn't already open.

  3. On the left, select Notebooks.

  4. Select Create new file.

    Screenshot: create a new notebook file.

  5. Name your new notebook my-new-notebook.ipynb.

Create a markdown cell

  1. On the upper right of each notebook cell is a toolbar of actions you can use for that cell. Select the Convert to markdown cell tool to change the cell to markdown.

    Screenshot: Convert to markdown.

  2. Double-click on the cell to open it.

  3. Inside the cell, type:

    # Testing a new notebook
    Use markdown cells to add nicely formatted content to the notebook.
    

Create a code cell

  1. Just below the cell, select + Code to create a new code cell.

  2. Inside this cell, add:

    print("Hello, world!")
    

Run the code

  1. If you stopped your compute instance at the end of the Quickstart: Create workspace resources you need to get started with Azure Machine Learning, start it again now:

    Screenshot: Start a compute instance.

  2. Wait until the compute instance is "Running". When it is running, the Compute instance dot is green. You can also see the status after the compute instance name. You may have to select the arrow to see the full name.

    Screenshot: Compute is running.

  3. You can run code cells either by using Shift + Enter, or by selecting the Run cell tool to the right of the cell. Use one of these methods to run the cell now.

    Screenshot: run cell tool.

  4. The brackets to the left of the cell now have a number inside. The number represents the order in which cells were run. Since this is the first cell you've run, you'll see [1] next to the cell. You also see the output of the cell, Hello, world!.

  5. Run the cell again. You'll see the same output (since you didn't change the code), but now the brackets contain [2]. As your notebook gets larger, these numbers help you understand what code was run, and in what order.

Run a second code cell

  1. Add a second code cell:

    two = 1 + 1
    print("One plus one is ",two)
    
  2. Run the new cell.

  3. Your notebook now looks like:

    Screenshot: Notebook contents.

See your variables

Use the Variable explorer to see the variables that are defined in your session.

  1. Select the "..." in the notebook toolbar.

  2. Select Variable explorer.

    Screenshot: Variable explorer tool. ":::

    The explorer appears at the bottom. You currently have one variable, two, assigned.

  3. Add another code cell:

    three = 1+two
    
  4. Run this cell to see the variable three appear in the variable explorer.

Learn from sample notebooks

There are sample notebooks available in studio to help you learn more about Azure Machine Learning. To find these samples:

  1. Still in the Notebooks section, select Samples at the top.

    Screenshot: Sample notebooks.

  2. The SDK v1 folder can be used with the previous, v1 version of the SDK. If you're just starting, you won't need these samples.

  3. Use notebooks in the SDK v2 folder for examples that show the current version of the SDK, v2.

  4. Select the notebook SDK v2/tutorials/azureml-in-a-day/azureml-in-a-day.ipynb. You'll see a read-only version of the notebook.

  5. To get your own copy, you can select Clone this notebook. This action will also copy the rest of the folder's content for that notebook. No need to do that now, though, as you're going to instead clone the whole folder.

Clone tutorials folder

You can also clone an entire folder. The tutorials folder is a good place to start learning more about how Azure Machine Learning works.

  1. Open the SDK v2 folder.

  2. Select the "..." at the right of tutorials folder to get the menu, then select Clone.

    Screenshot: clone v2 tutorials folder.

  3. Your new folder is now displayed in the Files section.

  4. Run the notebooks in this folder to learn more about using the Python SDK v2 to train and deploy models.

Clean up resources

If you plan to continue now to the next tutorial, skip to Next steps.

Delete all resources

Important

The resources that you created can be used as prerequisites to other Azure Machine Learning tutorials and how-to articles.

If you don't plan to use any of the resources that you created, delete them so you don't incur any charges:

  1. In the Azure portal, select Resource groups on the far left.

  2. From the list, select the resource group that you created.

  3. Select Delete resource group.

  4. Enter the resource group name. Then select Delete.

Next steps