Tutorial: Get started creating your first ML experiment with the Python SDK
APPLIES TO: Basic edition Enterprise edition (Upgrade to Enterprise edition)
In this tutorial, you complete the end-to-end steps to get started with the Azure Machine Learning Python SDK running in Jupyter notebooks. This tutorial is part one of a two-part tutorial series, and covers Python environment setup and configuration, as well as creating a workspace to manage your experiments and machine learning models. Part two builds on this to train multiple machine learning models and introduce the model management process using both Azure Machine Learning studio and the SDK.
In this tutorial, you:
- Create an Azure Machine Learning Workspace to use in the next tutorial.
- Clone the tutorials notebook to your folder in the workspace.
- Create a cloud-based compute instance with Azure Machine Learning Python SDK installed and pre-configured.
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 Azure portal by using the credentials for your Azure subscription.
In the upper-left corner of 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 (Basic & Enterprise) 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 are 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 these to ensure you create your experiment in the right place.
Run notebook in your workspace
This tutorial uses the cloud notebook server in your workspace for an install-free and pre-configured 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 below to clone and run the tutorial from your workspace.
Clone a notebook folder
You complete the following experiment set-up and run steps in Azure Machine Learning studio, a consolidated interface that 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.
Select Notebooks on the left.
Open the Samples folder.
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 "..." at the right of the tutorials folder and then select Clone.
A list of folders displays showing each user who accesses the workspace. Select your folder to clone the tutorials folder there.
Under User Files open your folder and then open the cloned tutorials folder.
You can view notebooks in the samples folder but you cannot run a notebook from there. In order 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 folder.
On the top bar, select a compute instance to use to run the notebook. These VMs are pre-configured with everything you need to run Azure Machine Learning. You can select a VM created by any user of your workspace.
If no VMs are found, select + Add to create the compute instance VM.
When you create a VM, provide a name. The name must be between 2 to 16 characters. Valid characters are letters, digits, and the - character, and must also be unique across your Azure subscription.
Select the Virtual Machine size from the available choices.
Then select Create. It can take approximately 5 minutes to set up your VM.
Once the VM is available it will be displayed in the top toolbar. You can now run the notebook either by using Run all in the toolbar, or by using Shift+Enter in the code cells of the notebook.
If you have custom widgets or prefer using Jupyter/JupyterLab select the Jupyter drop down on the far right, then select Jupyter or JupyterLab. The new browser window will be opened.
Compute instances (preview) are currently available only for workspaces with a region of North Central US or UK South, with support for other regions coming soon. If your workspace is in any other region, you can continue to create and use a Notebook VM instead. You can use either a Notebook VM or a compute instance to run your notebook. A VM will continue running and incurring cost unless you stop it. You can stop it manually from the Compute tab in the Studio, or see the blog post on enabling scheduled automatic shutdown for Azure VMs.
In this tutorial, you completed these tasks:
- Created an Azure Machine Learning workspace.
- Created and configured a cloud notebook server in your workspace.
In part two of the tutorial you run the code in
tutorial-1st-experiment-sdk-train.ipynb to train a machine learning model.
If you do not plan on following part 2 of this tutorial or any other tutorials, you should stop the cloud notebook server VM when you are not using it to reduce cost.