Create and deploy a scoring model to predict heartrate failure


Machine learning is branching out across numerous fields, one of the most interesting fields is health care. This code pattern uses a Jupyter Notebook on IBM Watson Studio to build a predictive model that demonstrates a potential healthcare use case. This predictive model is deployed into production on Watson’s Machine Learning Service and invoked by a custom Node.js app running on a Cloud Foundry Runtime in IBM Cloud.


You’re a busy developer or data scientist and want the fastest path delivering data insights to users, but this requires deep expertise in many technology domains. This end-to-end example walks you through the numerous technologies used to:

  • Acquire, clean, and explore data
  • Build a predictive machine learning model
  • Make predictions
  • Host the model for consumption
  • Call the hosted model from a Node.js application

Along the way, you’ll learn about IBM’s Watson Machine Learning Service for hosting your trained model on IBM’s Cloud, and IBM Watson Studio, a Cloud-based IDE for data science teams; tools that bring together many open-source technologies built for data science and machine learning.

In this code pattern, you will use a Jupyter Notebook on IBM Watson Studio to build a predictive model that demonstrates a potential healthcare use case. Although this is for demonstrative purposes only, you’ll see how to use Watson Machine Learning on a data set comprised of health care metrics to create a predictive model for risk of heart failure. After creating this model, inputs that are entered can be scored to form a prediction for an individual case. Note that this application is used for demonstrative and illustrative purposes only and does not constitute an offering that has gone through regulatory review.

After completing this code pattern, you will understand how to:

  • Build a predictive model within a Jupyter Notebook
  • Deploy the model to IBM Watson Machine Learning service
  • Access the machine learning model through either APIs or a Node.js app



  1. The developer creates an IBM Watson Studio Workspace.
  2. IBM Watson Studio depends on an Apache Spark service.
  3. IBM Watson Studio uses Cloud Object storage to manage your data.
  4. This lab is built on a Jupyter Notebook, this is where the developer will import data, train, and evaluate their model.
  5. Import heart failure data.
  6. Trained models are deployed into production using IBM’s Watson Machine Learning Service.
  7. A Node.js web app is deployed on IBM Cloud and calls the predictive model.
  8. A user visits the web app, enters their information, and the predictive model returns a response.


Find the detailed steps for this pattern in the The steps will show you how to:

  1. Deploy the testing application
  2. Create an instance of the Watson Machine Learning Service
  3. Create an instance of Watson Studio
  4. Create a project in Watson Studio and bind it to your Watson Machine Learning service instance
  5. Save the credentials for your Watson Machine Learning Service
  6. Create a notebook in Watson Studio
  7. Run the notebook in Watson Studio
  8. Deploy the saved predictive model as a scoring service