International Workshop on “Build a Handwritten Digit Recognizer Using Studio & PyTorch” Technically Sponsored By: IBM Developer Ecosystem Group Duration: 2 Days (31st Jan.-01st Feb. 2019)

WORKSHOP REPORT

Perspective: About the Workshop Objective: The objective of this workshop is to Build and train AI & machine learning models, prepare and analyze data – all in a flexible, hybrid cloud environment. With the advancement of Machine Learning, humans have made machines capable of performing redundant tasks faster. We now have mobile banking apps that can scan cheques in seconds and accounting software that can extract dollar amounts from thousands of contracts in minutes. In this workshop, learn how to build a machine learning model to recognize handwritten digits using Watson Studio and PyTorch.

IBM Watson Studio Accelerate the machine and deep learning workflows required to infuse AI into your business. IBM Watson Studio provides tools for data scientists, application developers and subject matter experts to collaboratively and easily work with data to build and train models at scale. It gives you the flexibility to build models where your data resides and deploy anywhere in a hybrid environment so you can operationalize data science faster.

Watson Studio Cloud Quickly get started and train your models on IBM Public Cloud.

Watson Studio Desktop Prepare data and build models on your desktop with visual drag and drop tools.

Watson Studio Local Train models behind your own firewall or on IBM Private Cloud.

Collaborative data science Use open-source tools like Jupyter Notebooks, combined with collaborative project features, like programmatic access and version control, to fine- tune your parameters until you find your ideal model for production.

Enhanced visual modeling Explore data and use machine learning with drag-and-drop tooling from SPSS Modeler - a new look on the classic tool.

Automated deep learning Visually program for deep learning with an intuitive drag-and-drop, no-code interface in Neural Network Modeler.

Analyst rankings Forrester ranks Watson Studio as the leader in Predictive Analytics and Machine Learning

Overview Recognizing handwritten numbers is a piece of cake for humans, but it's a non-trivial task for machines. Nowadays, with the advancement of machine learning, people have made machines more and more capable of performing this task. We now have mobile banking apps that can scan checks in seconds and accounting software that can extract dollar amounts from thousands of contracts in minutes. If you are interested in knowing how this all works, please follow along with this code pattern as we take you through the steps to create a simple handwritten digit recognizer in Watson Studio with PyTorch.

What is Watson Studio? Watson Studio is an integrated environment for data scientists, developers and domain experts to collaboratively work with data to build, train and deploy models at scale. If you are new to Watson Studio, the best way to understand it is to see it in action.

What is PyTorch? PyTorch is a relatively new deep learning framework. Yet, it has begun to gain adoption especially among researchers and data scientists. The strength of PyTorch is its support of dynamic computational graph while most deep learning frameworks are based on static computational graph. In addition, its strong NumPy like GPU accelerated tensor computation has allowed Python developers to easily learn and build deep learning networks for GPUs and CPUs alike.

In this code pattern, you will use Jupyter Notebook in Watson Studio and access preinstalled and optimized PyTorch environments through the Python client library of the Watson Machine Learning service, which has a set of REST APIs in its core that allows users to submit training jobs, monitor status, and store and deploy models.

When you have completed this code pattern, you will understand how to:  Create a project in Watson Studio and use Jupyter Notebooks in the project.  Use the Python client of Cloud Object Storage to create buckets and upload data to buckets.  Submit PyTorch training jobs to Watson Machine Learning service.  Use the trained PyTorch model to predict handwritten digits from images.

Flow 1. Log into IBM Watson Studio 2. Run the Jupyter notebook in Watson Studio 3. Use PyTorch to download and process the data 4. Use Watson Machine Learning to train and deploy the model

Included components  Watson Machine Learning: Make smarter decisions, solve tough problems, and improve user outcomes.  Watson Studio: IBM's integrated hybrid environment that provides flexible data science tools to build and train AI models and prepare and analyze data.  Jupyter Notebooks: An open-source web application that allows you to create and documents that contain live code, equations, visualizations and explanatory text.  Cloud Object Storage: Provides flexible, cost-effective, and scalable cloud storage for unstructured data.

Featured Technologies  Artificial Intelligence: Artificial intelligence can be applied to disparate solution spaces to deliver disruptive technologies.  Python: Python is a programming language that lets you work more quickly and integrate your systems more effectively.  PyTorch: PyTorch is an open source deep learning platform that provides a seamless path from research prototyping to production deployment.

Steps 1. Sign up for Watson Studio 2. Create a new project 3. Create the notebook 4. Create a Watson Machine Learning Service instance 5. Create HMAC credentials for the Cloud Object Storage instance 6. Run the notebook 7. See the results

1. Sign up for Watson Studio Sign up for IBM's Watson Studio. By creating a project in Watson Studio a free tier Object Storage service will be created in your IBM Cloud account. Take note of your service names as you will need to select them in the following steps.

Note: When creating your Object Storage service, select the Free storage type in order to avoid having to pay an upgrade fee.

2. Create a new project From the Watson Studio home page, select New Project, then select the Create Project button located in the Data Science tile.

 To create a project in Watson Studio, give the project a name and either create a new Cloud Object Storage service or select an existing one from your IBM Cloud account.

 Upon a successful project creation, you are taken to a dashboard view of your project. Take note of the Assets and Settings tabs, we'll be using them to associate our project with any external assets (such as notebooks) and any IBM Cloud services.

3. Create the notebook From the project dashboard view, select the Add to project drop-down menu and click on Notebook.

Use the From URL tab to create our notebook.  Give your notebook a name and select your desired runtime. In this case, select the Default Python 3.5 Free option.

 Press the Create Notebook button.

4. Create a Watson Machine Learning Service instance

If you do not already have a running instance of the Watson Machine Learning (WML) service, follow these steps to create one.  From the IBM Cloud Catalog, under the AI category, select Machine Learning.

 Enter a service name, select the Lite plan, then press Create.

 Once the service instance is created, navigate to Service credentials, view credentials and make note of them. If you don't see any credentials available, create a New credential.

If you get this error: "You do not have the required permission to assign role 'Writer'. Contact the account owner to update your access." Give yourself writer access by:  Use the IBM Cloud menu ☰ and select Security.  Click on Manage.  Click on Identity and Access.  Use the three dots icon to assign access to yourself.  Click on Assign access to resources.  Use the Services pulldown to select All Identity and Access enabled services.  Use the checkbox to enable Writer.  Hit Assign.  Go back and try to create your Watson ML credentials again.

 In the notebook available with this pattern, there is a which requires you to enter your WML credentials. Copy and paste these credentials into that notebook cell.

5. Create HMAC credentials for the Cloud Object Storage instance To run the notebook available with this pattern, you must create a Keyed-Hashing for Message Authentication (HMAC) set of credentials for your Cloud Object Storage instance.

 From the IBM Cloud dashboard, click on the Cloud Object Storage instance that you assigned to your Watson Studio project. Then click the Service credentials tab.

 Click on New Credential to initiate creating a new set of credentials. Enter a name, then enter {"HMAC":true} in the Add Inline Configuration Parameters field. Press Add to create the credentials.

 Once the credentials are created, you should see a set of cos_hmac_keys values.

 In the notebook available with this pattern, there is a cell which requires you to enter your Cloud Object Storage credentials. Copy and paste these credentials into that notebook cell.

6. Run the notebook To view your notebooks, select Notebooks in the project Assets list. To run a notebook, simply click on the edit icon listed in the row associated with the notebook in the Notebooks list.

Some background on executing notebooks: When a notebook is executed, what is actually happening is that each code cell in the notebook is executed, in order, from top to bottom.

Each code cell is selectable and is preceded by a tag in the left margin. The tag format is In [x]:. Depending on the state of the notebook, the x can be:  A blank, this indicates that the cell has never been executed.  A number, this number represents the relative order this code step was executed.  A *, which indicates that the cell is currently executing.

There are several ways to execute the code cells in your notebook:  One cell at a time. Select the cell, and then press the Play button in the toolbar.  Batch mode, in sequential order. From the Cell menu bar, there are several options available. For example, you can Run All cells in your notebook, or you can Run All Below, that will start executing from the first cell under the currently selected cell, and then continue executing all cells that follow.  At a scheduled time. Press the Schedule button located in the top right section of your notebook panel. Here you can schedule your notebook to be executed once at some future time, or repeatedly at your specified interval.

7. See the results Once the model is trained we can use it to recognize handwritten digits.

Note: With only 1 epoch, the results might be less then perfect.

Description In this code pattern, you’ll use Jupyter Notebook in IBM Watson Studio to access pre-installed and optimized PyTorch environments through Python client library of Watson Machine Learning Service. The library has a set of REST APIs in its core that allow you to submit training jobs, monitor status, store, and deploy models.

Technology: Machine Learning Using IBM Watson Studio Cloud. Trainers: 1. Mr. Lawrence Mohanraj, IBM Developer Ecosystem Group, IBM India Pvt. Ltd, Chennai. 2. Ms. Riya M. Roy, Developer Advocate-Cloud & AI, IBM India Pvt. Ltd, Bangalore. Department: CS/IT, 6th Semester B.Tech. Students Number of Students: 111 Number of Faculties: 05 Tools Used: Jupyter Notebook in IBM Watson Studio (IBM Public Cloud). Venue: Industry Academia Interface Lab (IAI Lab) Faculty Participants from SKIT: Ms. Anjana Sangwan, Mr. M.K.Beniwal, Mr. Pankaj Dadheech, Ms. Neha Mathur, Mrs. Priyanka.

• How the workshop will progress to the conference (ICETCE-2019) The workshop is beneficial and have progress to the conference as workshop includes the “Build a Handwritten Digit Recognizer Using Watson Studio & PyTorch” which directly maps with our International Conference on “Emerging Technologies in Computer Engineering: ICETCE-2019” organized on 01st-02nd Feb. 2019 Sponsored By Department of Science & Technology, Rajasthan, Springer, IETE and Technically Sponsored by IBM, INFOSYS Ltd. & Natural Group of Theme “Microservices in Big Data Analytics”. Hands On Session:

WORKSHOP SCHEDULE International Workshop on “Build a Handwritten Digit Recognizer Using Watson Studio & PyTorch” Technically Sponsored By: IBM Developer Ecosystem Group Duration: 2 Days (31st Jan.-01st Feb. 2019)

Timings Activities 8:00 am onwards Registration and Campus Visit (All Participants)

INAUGURAL CEREMONY DAY-1 (31st January 2019), THURSDAY 9:00 - 09:05 am Inauguration at Industry Acdemia Interface (IAI) Lab

9:05 - 09:10 am Welcome Note & About the Conference by Prof. (Dr.) C. M. Choudhary – HOD-CS, SKIT

9:10 - 09:15 am Motivational Speech by Prof. (Dr.) S. L. Surana (Director Academics, SKIT) 9:15 - 09:20 am Inaugural Address by Mr. Lawrence Mohanraj, IBM Developer Ecosystem Group, IBM India Pvt. Ltd, Chennai. 09:20 - 09:30 am Objectives and Overview of Workshop Ms. Riya M. Roy, Developer Advocate-Cloud & AI, IBM India Pvt. Ltd, Bangalore. 09:30 - 09:35 am Group Photo Session

09:35 - 10:00 am High Tea & Interaction

10:00 – 11:30 am Session on “Advancement of Machine Learning”

11:30 – 01:00 pm Session on “Watson Studio and use of Jupyter Notebook”

01:00 – 02:00 pm Lunck Break 02:00 – 03:30 pm Hands On Session “Machine Learning & Python Client of Cloud Object Storage to Create Buckets and Upload Data to Buckets” 02:00 – 03:30 pm “Faculty Interaction Session” (Parallel Session) DAY-2 (01st February 2019), FRIDAY

09:00 – 11:00 am Session on “How to build a Machine Learning Model to Recognise Handwritten Digits Using Watson Studio and PyTorch” 11:00 – 11:30 am High Tea & Interaction

11:30 – 01:00 pm Session on “Submit PyTorch Training Jobs to Watson Machine Learning Service”

01:00 – 02:00 pm Lunck Break

02:00 – 03:00 pm Session for “PyTorch Model to Predict Handwritten Digits from Images”

03:00 – 03:15 pm Tea Break

03:15 – 03:30 pm Closure, Feedback and Felicitation

 Summary Recognizing handwritten numbers is a piece of cake for humans, but it’s a non-trivial task for machines. Currently, however, with the advancement of machine learning, people have made machines more capable of performing this task. We now have mobile banking apps that can scan checks in seconds, and accounting software that can extract dollar amounts from thousands of contracts in minutes.

By attending this workshop, participants learn how to:

 Create a project in Watson Studio and use Jupyter Notebook in the project.  Use Python client of Cloud Object Storage to create buckets and upload data to buckets.  Submit PyTorch training jobs to Watson Machine Learning Service.  Use trained PyTorch model to predict handwritten digits from images.

 Workshop’s Outcomes (R&D, Placement) The workshop had a lot of knowledge of recent trends in Machine Learning those are very important for the students of pre final year. This workshop will definitely help the students in their recruitment as well as in academics.  Road Ahead The workshop will help students in future for their minor and major projects of the 7th& 8thsemester students. We are expecting these knowledgeable workshops in future also.

Welcome Inaugural Address

Thank You