Azure Jupyter Notebookđź“‹ With Azure ML Studio

Azure Machine Learning services is one of the most searched terms on the internet nowadays. Do you know why? It is because Azure ML studio (Preview) offers an interactive and visual workspace for Data Scientists, Analysts, and Developers to make ML workflow easier to build, test, and deploy a model.

Why Azure ML?

  • It provides sophisticated pre-trained models such as Cognitive Services.
  • Provides DevOps for Machine Learning
  • All Open-source frameworks like TensorFlow and Sci-kit Learn, etc.. are available
  • Flexible deployment for on-premises and cloud
  • It provides us with both drag-and-drop and coding workspace with clear documentation.

Open the Azure portal here.

Before getting started, make sure you have an active Azure pass.

Step 1. Create Azure ML resource

First of all, we need to create a workspace for our demo.

In Azure Home, click on Create a resource (plus icon) under Azure Services.

Let us find the Machine Learning service in the search box by typing Machine Learning or clicking on the AI + Machine Learning tap, located on the left side of your panel.

Next, Click on the Create tap to create a new Machine Learning resource.

Machine Learning resource

Now, give some credentials for creating an ML resource. Follow the instructions given below.

  1. Enter your workspace name
  2. You can choose your active Azure pass subscription.
  3. Choose your existing Resource group; if you don’t have one, click on Create now.
  4. Choose your location as the server nearest to you.
  5. Workspace edition: Enterprise.

Click on Review + Create

Create Azure ML resource

In the Review tab, you can verify all credentials that you have entered and click on the Create button.

 Create button

Once your deployment is completed, you will be redirected to the service overview window.

Here, we can open our deployed resource by clicking on the Go to resource button.

Resource button

Step 2. Launch Azure ML studio

In our Machine Learning resource, there is an option for exploring Azure Machine Learning Studio directly. That provides an interactive workspace and end-to-end machine learning lifecycle as well.

By default, you are in the Overview pane, click on the Launch Now button (Highlighted right side) to launch the Azure ML studio.

Azure ML studio

Step 3. Create Notebook

In the Azure Machine Learning Studio (preview) window, there are three different types of tools available, which provide better and more convenient handling for the author such as Data Scientists, Developers, and data analysts.

Click on Notebooks under the author to explore the Azure Notebook.

Azure Notebook

Here, we can see the Azure ML gallery and User files. If you need some tutorial for Azure ML, click on samples under the Azure ML gallery.

Click on create folder >> folder name >> Select target directory >> Create

Select target directory

Now, create a Python file for our ML experiment.

  • Click on the File icon.
  • Filename: your file name >> File type: Python Notebook >> Target directory: your directory
  • Click on the Create button to make a Python notebook.
    Python notebook

Step 4. Create a Notebook VM

Before getting started at Notebook, we need a Virtual Machine for computing.

Here, the Azure Notebook virtual machine comes to fulfill this task.

Click on +New VM to create a new Virtual Machine.

Configure VM,

  • Notebook VM name: Enter your VM name
  • VM type: Choose your system type (as a beginner, the STANDARD_DS1_V2 is sufficient)

Once you create a Notebook VM, you can see that in the Compute under the Manage panel.

Manage panel

Step 5. Run Notebook

Now, it's time to check if our Notebook is working fine or not.

  • Make sure your Notebook VM is on the running level.
  • Move the cursor in the middle of your Notebook you will see the Create text cell dialog and click on it.
  • By default, the cell is an empty markdown cell. Choose Convert code cell for changing.

Now, we are ready to enter the coding part and write the Python “Hello World” program to check if the Notebook is working.

The run button is available at the top right side of the Notebook and each cell.

Notebook is working

Step 6. Upload Dataset

On the left side of your Notebook, you can see the vertical arrow, which helps us to upload the datasets.

Here, I will use the Iris dataset that is located in my local system.

Click on the Upload files icon >> Navigate your dataset folder and choose file >> Open >> select target directory>> Upload.

Once it has been uploaded, you can see the Dataset visually in your directory.

Dataset visually

Step 7. Understanding the dataset

Now read our uploaded dataset in the Notebook, which can be achieved effectively by executing the below commands.

# Read Dataset
import pandas as pd
from pandas import read_csv
data = pd.read_csv("iris-data.csv")
print("Dataset read successfully")

Here, I will give you the basic commands for understanding the Dataset quickly.

You can execute the below commands step by step with separate cells to get good understandability.

# Shape
print(data.shape)

# Species distribution
print(data.groupby('species').size())

# Head
print(data.head(20))

# Descriptions
print(data.describe())

Dataset quickly

Step 8. Data Visualization

Here, we are going to visualize our dataset through some famous Python libraries.

As I said, run at separate cells for better and more features.

import seaborn as sns
import matplotlib.pyplot as plt

sns.boxplot(x='species', y='sepal_length', data=data)
plt.show()

sns.violinplot(x='species', y='sepal_width', data=data)
plt.show()

sns.pairplot(data, hue='species', kind='reg')
plt.show()

from pandas.plotting import radviz
radviz(data, "species")
plt.show()

The above-mentioned code will give you attractive univariate and multivariate plot visualization to make the dataset more meaningful.

Dataset more meaningful

Conclusion

We have learned about,

  • How we create Azure ML Notebooks
  • Creating a Notebook VM
  • Uploading the datasets
  • Understanding the dataset
  • Data visualization.

I hope this article will help you. If you have any queries, feel free to ask in the comment section.

References


Similar Articles