Taxonomy Icon

Data Science

The challenge with deploying complex machine learning models (example: tensorflow) is that these models are very computationally expensive and time-consuming to train. Some solutions include GPU acceleration, distributed computing, or a combination of both. IBM Cloud offers both solutions. In this tutorial, you will deploy a deep neural network (using Tensorflow) on IBM Watson Studio (Watson Studio) to speed up the process of training the model. Watson Studio allows you to leverage the computational power available on the cloud to speed up the training time of the more complex machine learning models, and thus reducing the time from hours or days, down to minutes.

  • Tensorflow: TensorFlow is an open source software library for numerical computation using data flow graphs. TensorFlow offers developers the tools necessary to develop complex and deep neural networks and other machine learning models. Building deep neural networks with TensorFlow requires a great deal of computational power, so with Watson Studio, one should be able to reduce the training time from hours to minutes. More information on Tensorflow can be viewed on their website.

  • Watson Studio: IBM’s Watson Studio is a data science platform that provides all the tools necessary to develop a data-centric solution on the cloud. It makes use of Apache Spark clusters to provide the computational power needed to develop complex machine learning models. You can choose to create assets in Python, Scala, and R, and leverage open source frameworks (such as TensorFlow) that are already installed on Watson Studio.

Learning objectives

The goal of this tutorial is to import and run through a Jupyter notebook written in Python on IBM’s Watson Studio, and in the process demonstrate the value Watson Studio offers to speed up the training time of a neural network built with Tensorflow. With Watson Studio, you will take advantage of the distributed computing capabilities of Apache Spark and deploy a computationally complex neural network in Python. We begin by signing up to Watson Studio, creating a new project in Watson Studio, importing the notebook, and finally, running the notebook.

Prerequisites

Before we begin, we have to create a new IBM Cloud account, if you haven’t already. Additionally, we have to sign up for IBM Watson Studio. This gives us access to an interactive, collaborative, cloud-based environment.

  1. In a web browser, navigate to https://datascience.ibm.com.

  2. Click on Sign Up at the top right.

    Sign Up

  3. Click on Sign in with your IBM id and enter your IBM Cloud credentials.

    Sign In

  4. Follow the instructions to complete the sign up for IBM Watson Studio. As soon as the Get Started button is enabled, click it and you should be directed to the Watson Studio dashboard as shown below.

    Watson Studio dashboard

Estimated time

This tutorial will take approximately one hour to complete.

Steps

We will begin by navigating to IBM’s Watson Studio to create a new project; then we will import a notebook to that project; run the notebook that contains the Tensorflow example; and lastly highlight a few next steps.

Create a new project

  1. Click on the Projects tab to see a list of your projects. You should only see a default project.

    Landing Page

  2. Click on the create project icon on the top right of the project list.

    Create Project

  3. Type a name for your project. For instance, “ML Model”. Create a new Spark Service and Object Storage Service as indicated on the screen. A container is a collection of objects used for object storage. Click on Create to create the new project. Once created, you will be directed to your new project where you can create notebooks, import data assets, or add collaborators.

    New Project

Create a new notebook

  1. From the newly created project dashboard, click the Add to project option and select Notebook.

    Add NB

  2. You can create a new, empty notebook or specify to import an existing one, either from a file or from a known URL. In this case, we will choose the latter. Select the option From URL and specify https://github.com/aounlutfi/building-first-ML-model/blob/master/Complete.ipynb as the URL of the notebook. Now click on Create Notebook to begin the import.

    NB from URL

Run the notebook

  1. To run the notebook, click on Cell from the Commands ribbon, and then click Run all cells. Watson Studio will then run all the code snippets in the notebook. The notebook takes around 15 minutes to run since the data set is made up of 20,000 images.

    Run NB

Alternatively, you can run a single cell by selecting the Play icon from the menu, highlighted below.

Run Cell by Cell

Next steps

Watson Studio is more than just a development platform. It is also a community-driven and collaboration platform. With Watson Studio you can share a project with other users and collaborate on a specific notebook. You can also benefit from community created content that includes free notebooks and data sets. See the image below for how to add collaborators to a project.

Collaborate

Summary

After completing the steps above, you are able to deploy models from other frameworks such as Sklearn and Spark MLLib on Watson Studio. You can then try to set up Python and Tensorflow on your personal computer and run an example provided by Tensorflow to compare the results. It might take hours, maybe days to train, depending on the performance of your machine.

For additional learning, check out some of our IBM Code Patterns on this topic: