Code Monkey home page Code Monkey logo

azureml-tutorial's Introduction

Azure Machine Learning Tutorial (YAML / Python)

This example shows you generic AI / ML workflow through lifecycle - exploration, train, tune, and publishing - with Azure Machine Learning (AML) API.
(Here I assume TensorFlow version 1.x for AI / ML framework.)

There exist 2 options to run Azure Machine Learning (AML) API - Python SDK and CLI/YAML.

CLI / YAML (v2)

Python SDK (v2)

Python SDK (v1)

Note : When you are new to Azure Machine Learning, use v2 API.

You can also use raw REST API for invoking AML API.

How to Set up

1. Create Azure ML Workspace resource

Create new "Machine Learning" resource in Azure Portal .

Note : We need GPU instance in Exercise04. Please specify the location (region) for machine learning resource, in which you can run GPU virtual machine.
See Exercise04 for details. (Please request quota for GPU AML VM, if you don't have any GPU quotas in your Azure subscription.)

2. Create Virtual Machine for running AML API

In Exercise03, we use TensorFlow 1.x and you cannot then use Python 3.7 or later.
In order to use Python 3.6, here I use Ubuntu Server 18.04 LTS in Microsoft Azure for client, in which Python 3.6 is already installed.

  • Create Ubuntu Server 18.04 LTS virtual machine resource in Azure Portal.

  • Please make sure that Python 3.6 is installed on Ubuntu. (As I have mentioned above, you cannot use Python 3.7 or above to run TensorFlow 1.x.)

# Check version
python3 -V
### # Set python3.6 as default python command (Here I assume /usr/bin/python3.6)
### sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
  • Install and upgrade pip3 as follows.
sudo apt-get update
sudo apt-get install -y python3-pip
sudo -H pip3 install --upgrade pip
  • In this tutorial, we run all exercises in IPython notebook.
    Install Jupyter as follows.
pip3 install jupyter
  • Install the required packages for Exercise03. (Use "tensorflow-gpu" instead, when using GPU VM.)
pip3 install matplotlib tensorflow==1.15

Choose the following settings (3A, 3B, or 3C), depending on which API (Python SDK or CLI/YAML) you use.

3A [CLI/YAML v2] Set up Azure ML CLI

For running AML CLI/YAML, install Azure Machine Learning CLI extension version 2.0 or above as follows.

  • Install Azure CLI (version 2.15 or above) as follows. (See here for details.)
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Note : To see the installed Azure CLI version, run az --version.

  • Install AML CLI extension as follows.
az extension add --name ml

Note : In this example, I have used CLI version 2.4.1. When you install a specific version, please run az extension add --name ml --version 2.4.1.

3B [Python SDK v2] Set up Azure ML SDK v2

For running AML Python SDK v2, install Python SDK version 2 as follows.

pip3 install --pre azure-ai-ml==0.1.0b3

Note : These examples use AML Python SDK v2 early beta. Please specify SDK version, because these might be changed in the future.

3C [Python SDK v1] Set up Azure ML SDK v1

For running AML Python SDK v1, install Python SDK version 1 and depending other packages as follows.

Azure Machine Learning (AML) provides core package (azureml-core) and as well as extension packages. Depending on tasks, you should install addtional extensions. (For instance, if you want to run automated machine learning in AML, you should install automl extension package (azureml-train-automl) as well.)

In this tutorial, we use AML interactive widget's extension (azureml_widgets) used in Exercise 06, and AML train core extension (azureml-train) used in Exercise 07, and pipeline extensions (azureml-pipeline-core and azureml-pipeline-steps) used in Exercise 09.
Install the required Python packages as follows.

# Install AML SDK Core
pip3 install azureml-core

# Install AML interactive widgets extension
pip3 install azureml-widgets

# Install AML train extension (including HyperDrive package)
pip3 install azureml-train

# Install AML dataset extension
pip3 install azureml-dataset-runtime

# Install AML pipeline extension
pip3 install azureml-pipeline-core azureml-pipeline-steps

Note : AML widget's extension is installed as Jupyter notebook extension.
Run jupyter nbextension list to see the installed Jupyter extensions.

4. Clone this repo

Clone this repository in your working environment.

git clone https://github.com/tsmatz/azureml-tutorial

5. Start Jupyter Notebook

  • Start Jupyter notebook as follows. (Please re-login to take effect for "jupyter" path.)
    This will show the access url in console, such as http://localhost:8888/tree?token=xxxxxxxxxx.
    (The default port is 8888.)
jupyter notebook
  • Connect to Ubuntu server with SSH tunnel (port forwarding) from your working desktop in order to access notebook URL.
    For instance, the following is the SSH tunnel setting on "PuTTY" terminal client in Windows. (You can use ssh -L option in Mac OS.)
    SSH Tunnel settings with putty

  • Copy the notebook URL (http://localhost:8888/?token=...) in the console output (see above) and open this address with your web browser.

See my post "Azure Machine Learning Introduction and Key Features" for feature's overview in Azure Machine Learning.

Tsuyoshi Matsuzaki @ Microsoft

azureml-tutorial's People

Contributors

tsmatsuz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.