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.
Sign in to the Azure portal by using the credentials for your Azure subscription.
In the upper-left corner of the Azure portal, select + Create a resource.
Use the search bar to find Machine Learning.
Select Machine Learning.
In the Machine Learning pane, select Create to begin.
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.
After you're finished configuring the workspace, select Review + Create.
It can take several minutes to create your workspace in the cloud.
When the process is finished, a deployment success message appears.
To view the new workspace, select Go to resource.
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.
Sign in to Azure Machine Learning studio.
Select your subscription and the workspace you created.
On the left, select Notebooks.
At the top, select the Samples tab.
Open the Python folder.
Open the folder with a version number on it. This number represents the current release for the Python SDK.
Select the ... button at the right of the tutorials folder, and then select Clone.
A list of folders shows each user who accesses the workspace. Select your folder to clone the tutorials folder there.
Open the cloned notebook
Open the tutorials folder that was closed into your User files section.
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.
Select the tutorial-1st-experiment-sdk-train.ipynb file in your tutorials/image-classification-mnist-data folder.
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.
If no VMs are found, select + Add to create the compute instance VM.
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.
Select the VM size from the available choices. For the tutorials, the default VM is a good choice.
Then select Create. It can take approximately five minutes to set up your VM.
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.
Now that you have a development environment set up, continue on to train a model in a Jupyter Notebook.
If you used a compute instance or Notebook VM, stop the VM when you aren't using it to reduce cost.
In your workspace, select Compute.
From the list, select the VM.
When you're ready to use the server again, select Start.