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.
Select the Samples tab at the top.
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.
Open the cloned notebook
Open the tutorials folder that was just closed into your User files section.
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/create-first-ml-experiment 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.
If no VMs are found, select + Add to create the compute instance VM.
When you create a VM, follow these rules:
- Name is required and can't be empty.
- Name needs to be unique (in a case insensitive fashion) across all existing compute instances in the Azure region of the workspace/compute instance. You'll get an alert if the name you choose is not unique.
- Valid characters are upper and lower case letters, numbers (0 to 9), and dash character (-).
- Name must be between 3 and 24 characters long.
- Name should start with a letter (not a number or a dash character).
- If dash character is used, then it needs to be followed by at least one letter after the dash. Example: Test-, test-0, test-01 are invalid, while test-a0, test-0a are valid instances.
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.
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.