Skip to main content

Python Machine Learning In Azure ML Studio

Just quick post to show you how easy it is to migrate Jupyter notebooks into azure machine learning studio.   For this walkthrough we will use the preview of the latest release of ML Studio (https://ml.azure.com/).   Microsoft has been hard at work making their Machine Learning Studio easier to use and the preview release has simplified several processes.
When you bring up Azure ML Studio Importing a Jupyter notebook is a straight forward process.   Once you’ve loaded studio select notebooks and then select the upload files link. Once you have uploaded the file you’ll be able to select it and view it but no run it yet.



We can’t run the uploaded notebook yet because we need to setup a VM that will be used process our data. Allowing you to control the size of the VM that your notebook will run on lets you control costs associated with housing the notebook in Azure.  Additionally, you can shut down the VM when not in use to further reduce costs.   If you click the “Setup VM” link the dialog below shows up.  The drop down allows you to select the size of VM.  For purposes of the demo select the smallest VM. 





Once your VM starts the imported Notebook will then be editable and runnable on your new VM.

The editing/debug experience is very simliar to the one that you would find in Anaconda. 

Create Dataset
With a Jupyter notepad running in Anaconda you have access to the file system to load models as needed.  In order to get our notebook to run in Azure we need to create a dataset and reference it to load our model.   This is a straight forward process.  To start with we select create from the dataset menu.
We want to create our dataset in this case from a local file so after selecting that option the dialog below is shown. 







If you have already created a datastore you can select it here or you can create a new one.  Next select the file(s) that you want to import as your dataset.  Note by importing the files you are moving the model into the cloud.

 

Once you have imported your model the view below is displayed.  This shows the basic information about your new Dataset.   The most important part of this dialog is on the left.  It shows the changes you need to make to your notebook to access the model.  



A blow up of that section is shown.  This code would be used to replace any place where you load the model from a file as below.   However, the replacement code is almost a direct cut and paste with a possibly needing to rename the variable used in the azure sample code. 



Replaced with snippet below in your notebook.



 That’s it, you’ve now successfully moved a Notebook onto the Azure Platform.  Note to avoid incurring any charges you should shut down your VM after finishing your experiment. 




Comments

Popular posts from this blog

Azure SQL Setup

Now that we have our site being authenticated we need to create the rest of the login process for our new users.   When our users are logged in the first time we want to send them to the login page so that we can collect some additional customer information about them.    We will use the id that is passed back to us by Facebook to lookup our new user in the database we are going to create.     If we don’t find the Id we will redirect our user to the new login page.    Our first step will be to layout our database.   We have a lot options for databases that can be hosted in the cloud.    On one end of the spectrum we could create a VM to host our database.   This would require us to manage the VM as well as the database.   We would also need to setup the storage and manage backups directly.    This gives a fine level of control over the environment.    The downside of this approach is that you have...