Real time prediction of telco customer churn using Watson Machine Learning from Cognos dashboard


Cognos 11 is not only positioned toward the professional report author, but specifically toward power users and data scientists by offering Watson-like features such as natural language search and automatic proposal of charts. With all the latest features including custom control, interacting or communicating with cloud hosted services is also possible from the Cognos application.

This pattern demonstrates how to build a custom control widget, using javascript which internally invokes Watson Machine learning model API’s, to integrate the custom control widget in Cognos dashboard and show the real-time results. The dataset considered here is Telecom sample customer data. Using this data, we’ll predict behavior to retain or churn the customers. You can also analyze all relevant customer data and develop focused customer retention programs.


If there’s a need to see a real-time machine learning model output from Cognos Dashboard, then we need to have an external mechanism to invoke the model, pass the parameters, and get the scores written back to the database. Cognos reads the latest scores from the database and displays them on the dashboard. This can be a tedious process of displaying the machine learning model outputs and is not real time.

This code pattern explains how to invoke the Watson Machine Learning model hosted on IBM cloud from the IBM Cognos dashboard. Some Cognos users get the requirements to dynamically get scores/prediction results of the ml models from within the Cognos console. However, with older versions of Cognos applications, we don’t have a straight forward solution or option to invoke these models directly. Now, however, with the latest versions of the release (for demo purposes we used cognos 11.0.11), we can use a custom widget built using Java scripts/D3 charts to invoke models hosted on the cloud platform. This helps enable you to get insight from the Cognos dashboard, and also include another tab or a dashboard within the same application to input the model required parameters and get instant predicted outputs.

After you have completed this code pattern, you’ll understand how to:

  • Create a real time dashboard using Cognos custom control.
  • Import the external JavaScript to Cognos reports.
  • Invoke machine learning models hosted on cloud through REST API from Cognos.



  1. Create the custom control widget using JavaScript and place it in Cognos webcontent folder.
  2. Create Watson Machine Learning Model and deploy as web service.
  3. Launch Cognos on web browser.
  4. Create the Cognos report using Custom Control and run the report.
  5. Report invokes WML model based on the input parameters.
  6. Gets output from the WML model and displays on the Cognos dashboard. Dashboard gets updated with real time WML model output.


Get the detailed instructions in the README file. These steps will show you how to:

  1. Create and deploy the Watson Machine Learning model from Watson Studio.
  2. Get the WML Credentials and model API code.
  3. Host the WML model through the node application.
  4. Create custom control widgets.
  5. Build the Cognos report and import the custom control widget.
  6. Run the report and analyze the results.