Through this notebook, we showcase the inbuilt machine learning capabilities in Db2 to solve a common business problem (Customer retention). The analytics stored procedures in Db2 use data from Db2 tables to provide an ML solution. We demonstrate the use of these analytics stored procedures and their integration with Watson Studio for model development via Python Jupyter notebook.
For more information, see Machine learning stored procedures.
One of the challenges in any business is to retain existing customers. Businesses often carry out surveys to gather public opinion on their products and services. A generic template for the survey includes a few personal questions, preferences, and product-related questions.
The machine learning model pipeline is as follows:
The sample data file named Customer_survey.csv used in this example is from a fictional customer survey. Modify cell 5 to point to the correct schema. This schema should contain the table named PROC_CUSTOMER_SURVEY (original dataset). Click the blue Download button above to download the zip file that also contains the sample data.
The ML model was able to predict 72% customers may come back or retain for the given test dataset with the prediction/precision accuracy of 94%.
Note: Both the prediction and accuracy values could vary depending on many factors such as train/test data, feature engineering, etc.
Load the Db2 credentials from a local json file in cell 1. If you are running the notebook for the first time then you will need to create a local json file named db2-cred.json. Fill in the username and password and then save it in the same working directory.
Run on Watson Studio
This notebook can be directly imported into Watson Studio. For more information, see Notebooks (Watson Studio).