<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joseph Kent on Medium]]></title>
        <description><![CDATA[Stories by Joseph Kent on Medium]]></description>
        <link>https://medium.com/@JOSEPHK1?source=rss-a33767a058b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*47U9UPqSsd7Q3Etnpw0EHw.png</url>
            <title>Stories by Joseph Kent on Medium</title>
            <link>https://medium.com/@JOSEPHK1?source=rss-a33767a058b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:16:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@JOSEPHK1/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploy a Heart Disease Prediction Model with SPSS Modeler Flows and Watson Studio]]></title>
            <link>https://medium.com/ibm-watson/deploy-a-heart-disease-prediction-model-with-spss-modeler-flows-and-watson-studio-ed508d568473?source=rss-a33767a058b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed508d568473</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[watson]]></category>
            <category><![CDATA[ibm-spss-modeller]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Joseph Kent]]></dc:creator>
            <pubDate>Wed, 26 Sep 2018 20:05:41 GMT</pubDate>
            <atom:updated>2018-09-26T20:05:41.807Z</atom:updated>
            <content:encoded><![CDATA[<p>This guide follows on from my earlier tutorial on model building — <a href="https://medium.com/ibm-watson/building-models-in-the-cloud-using-spss-modeler-flows-3dc0f30260e9">Predict the Likelihood of Heart Disease with SPSS Modeler Flows</a> — and assumes that you have completed that tutorial and have the final flow in you <a href="https://www.ibm.com/cloud/watson-studio"><strong>Watson Studio</strong></a> project.</p><h3>Intro</h3><p>So you’ve built yourself a model and you can score it using a table node to take a look at your predictions. What now?</p><p>The next step in the model lifecycle is to <a href="https://dataplatform.cloud.ibm.com/docs/content/analyze-data/ml-deploy.html?audience=wdp&amp;context=wdp">deploy your model</a> so that you can score it on demand and make real use of the predictions it provides.</p><p>In order to do that, there are a few steps we need to go through to save the model with Watson Studio, and then to create a web service deployment for the model.</p><h3>Terminology</h3><p>At the end of the previous tutorial we had a Modeler flow that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*kBJr1_yt5IfaNzCluViddA.png" /></figure><p>The first step we need to take is saving the model to the Watson Studio project containing the flow. Before we do this it is worth just defining and explaining a few terms to avoid confusion later.</p><p><strong>Model build node</strong> — The model build node is the model node which you added from the palette (with the green node icon). This is the node in which you change the field roles and build options for the model in the node editor.</p><p><strong>Model apply node (model applier)</strong> — This is the gold coloured node which is generated when you run the model build node. This is the object in the canvas that produces predictions and adds them to the data table. In a loose sense, this could be termed the <em>model</em> but that is slightly misleading when it comes to deployment as we will see later. Model apply nodes are linked to the build node by a dashed line which signifies that if the model build node were to be run again it would rebuild/refresh the model applier. Model apply nodes can be used to score data without this link to their build node, however, in this case, they cannot be rebuilt.</p><p><strong>Branch</strong> — An SPSS Modeler flow can be separated into multiple branches, each of which represents a single flow of data from the input node(s) to the output node. The end of a branch can be defined with an output node. In the figure shown above, there is a single branch in the flow which leads from the Data Asset node, through the Type node and ‘NUM’ model applier and finally to the Table node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*rCMngBgSvwFKvWFfYNeEfw.png" /></figure><p>Here is a second slightly more complicated example with two branches. You can see that the second branch splits off at the Type node. In both cases, the branch can be defined by the Output node at the end of it. If you were to run the second table node then only that branch would execute. The ‘NUM’ model applier would not be run.</p><h3>Saving a Branch as a Model</h3><p>Now that we’ve discussed the terms we use in the Modeler Flows application we can look at what <em>saving a branch</em> means.</p><p><strong>In the SPSS Modeler runtime, a <em>deployment</em> of a model is a snapshot of the model’s entire branch at the time it is saved.</strong> What effectively happens is that when you save a branch, all nodes within the chosen branch are packed into the deployed <em>model</em> and the input node is replaced with a ‘data-in’ input (where you input your scoring data), and the terminal node is replaced with a ‘data-out’ output (where your predictions are returned).</p><p>For this reason, you can only save a model for deployment from the terminal node in its branch. So, for our flow you need to right click on the table node, then click ‘Save branch as a model’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*GxN_j85lesOWs1Nn4Oux6A.png" /><figcaption>In this case, the saved model will include the type node (where field roles and metadata are set) and the NUM C5.0 applier where the predictions are produced.</figcaption></figure><p>This should open a new breadcrumb in the nav bar and show you the ‘Save Model’ page. If, however, you don’t have a <a href="https://www.ibm.com/cloud/machine-learning">Watson Machine Learning</a> service associated with your project then you may get an info message informing you of this. You can follow the instructions on the message to create a new WML service which will be associated with your project and then you’ll be returned to your flow. When this happens click on ‘Save branch as a model’ again.</p><p>Once you are on the <em>Save Model</em> Page enter a model name and optional description and select a Machine Learning service that will be used to score your model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*OtBE4D6ljLKS87qLBwHang.png" /></figure><p>Click the <em>Save</em> button and wait for your model to be saved. When this is complete a confirmation message will pop up and you will be returned to your flow.</p><p>Your branch has now been saved as a model to your project so click the project name in the breadcrumb to navigate there. You should see your saved SPSS model in the Watson Machine Learning Models table on the Assets tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tmWS9Mb4D-fbQk9EnJ-O5Q.png" /></figure><p>Click on the model name to open it and see its details. On the Overview tab you can see the WML service associated with the model, the type and a few other bits of info. The input schema of the model is also shown.</p><h3>Creating Deployments</h3><p>In order to score your model on demand, you need to create a web service deployment for it.</p><p>Click the ‘Deployments’ tab and then ‘Add Deployment’ on the top right of the table. This will show a new page where you can enter a name for your deployment and an optional description. Currently, only the ‘Web service’ deployment type is available. Save your deployment.</p><p>Your deployment will now be created which may take a minute or two. Eventually, you should see the status column change to <strong>DEPLOY_SUCCESS</strong>. When it is complete, click the deployment name.</p><p>There are three tabs on the deployment screen. “Overview” gives you information about your model deployment, Implementation gives you the information you need to use the web service and the Test tab allows you to check your model to make sure the predictions are working correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXfvXLwgLfOLNZtatwKBlw.png" /></figure><p>We’re going to use the model endpoint we’ve created to return a prediction so click on the “Implementation” tab where you can get information on using your model endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ByL-y6vbVsbfhVuwzVymAg.png" /></figure><p>At the bottom of this page are useful code snippets with sample code for how to use your model. We’re going to do a simple cURL execution of the model.</p><p>Firstly you will need to get your WML authentication token using the first curl command. You can find your WML service credentials in the IBM Cloud dashboard —<a href="http://console.ng.bluemix.net/"><strong>console.ng.bluemix.net</strong></a>.</p><p>Find the WML service you used to deploy the model in the table and open it. In the navigation panel on the left side is <em>Service Credentials</em>, click that and either generate new credentials (if you have none) or view an existing one to find the Username, Password and URL required in the curl command.</p><p>Run the command and it should return something like this:</p><p><em>{“token”:”eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRJZCI6Ijk5NDE1ZWU4LWZkZjctNDM4Zi04YmNhLTQwYWE2ODcxYzQ5ZiIsImluc3RhbmNlSWQiOiI5OTQxNWVlOC1mZGY3LTQzOGYtOGJjYS00MGFhNjg3MWM0OWYiLCJwbGFuSWQiOiIzZjZhY2Y0My1lZGU4LTQxM2EtYWM2OS1mOGFmM2JiMGNiZmUiLCJy44uruufTTDJJZCI6IjQ1NTcwMTRkLTEyZDctNDg3Mi04NTg3LTNkYTYxMWViODc3NiIsImlzcyI6Imh0dHBzOi8vdXMtc291dGgubWwuY2xvdWQuaWJtLmNvbS92My9pZGVudGl0eSIsImlhdCI6MTUzMDc3NDMzMSwiZXhwIjoxNTMwODAzMTMxfQ.CWDDOFOffodi443JZNttQ9wOPNDxt3y-vgbaqIV0TSyASGpSv2zySCKuhGwKdRMT8hLV5_0sQG0rIVdRKa5keh4jG4W4iKzyqL0is7etjbYzOSZLjL8YWeLAF8R28zQKIRG_WXvMyiNyYyZYNkUZwYpGGio1Ofa2ZmYCfPMpBq0rqtz18Hz9UY2ZoxyZIwE9Wti1wFvIuJwjAY0IbllH9z-dMlGpK8suR22Bffpprot54566ff3GFDETG6BReZHV5Yc2OavDHLWwS6vbOfga6pEOpm9yThmI148JCEDQobs3YF68MeOV-PR1cq9U12_SxjFpKwLMt_-_hndUTzwAgGfO5IrkqqzIBK1pA”}</em></p><p>You then need to run the second cURL command using this token (including the “” quotes around the string) as the WML_AUTH_TOKEN variable.</p><p>As you can see from the command, the model fields are included in the command for you. For the values these need to be included in a JSON array so here is a sample array you can use:</p><p>“values”: [[64, 1, 4, 145, 212, 0, 2, 132, 0, 2.0, 2, “2”, “6”, null]]</p><p><em>(</em><strong><em>NOTE</em></strong><em>: The double quotes marks around the strings in the above JSON structure need to be quotation marks (utf8 U+0022) and not left and right double quotation marks as Medium’s formatting has enforced. I would recommend formatting your cURL command in a text editor like Atom so that you can be sure the syntax is correct).</em></p><p>These values correspond with the fields in the equivalent array positions. The <em>NUM</em> and <em>THAL</em> fields are strings, hence the quotes. Now, you’re probably wondering that the <em>null</em> is doing in there. If we look at the array of input values the model is expecting we can see what is going on:</p><p>“fields”: [“AGE”, “SEX”, “CP”, “TESTPBS”, “CHOL”, “FBS”, “RESTECG”, “THALACH”, “EXANG”, “OLDPEAK”, “SLOPE”, “CA”, “THAL”, “NUM”]</p><p>See that <em>NUM</em> at the end there? That’s our target field for this model and therefore we don’t need to provide an input value for it (that’s what we’re trying to predict after all) so by entering <em>null</em> we’re still supplying a value to avoid any nasty errors, but it’s a null value so will be ignored by the model.</p><p>And so, if you run that curl command using these input values you should get some output that looks something like this (when you format it nicely anyway):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/1*dxnkJ460Z41KuFdbzJQXoQ.png" /></figure><p>As you can see we have the two new model fields added in (<em>$C-NUM </em>and <em>$CC-NUM</em>). These are our prediction and the confidence in the prediction respectively. In the values array you can see that the model has returned a prediction of <em>2</em> for the <em>NUM</em> field and is about 60% confident in that prediction.</p><p>It’s probably been a while since we looked what our fields actually mean so if we look at the description of the <em>NUM</em> field on the community it says <em>diagnosis of heart disease; integer value from 0 (no presence) to 4.</em> So with a predicted value of 2 from the model the patient whose data we have scored here could possibly have heart disease and would require further examination.</p><p>So there we have it, we’ve created a web service for our deployed model and started returning predictions on demand! You can score the model with multiple rows by using an array of input arrays (i.e. [[1,1,1,1,1],[2,2,2,2,2]] in the <em>values </em>key in the input JSON and you can score the model using any of the other methods shown on the Implementation tab.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed508d568473" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/deploy-a-heart-disease-prediction-model-with-spss-modeler-flows-and-watson-studio-ed508d568473">Deploy a Heart Disease Prediction Model with SPSS Modeler Flows and Watson Studio</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predict the Likelihood of Heart Disease with SPSS Modeler Flows]]></title>
            <link>https://medium.com/ibm-watson/building-models-in-the-cloud-using-spss-modeler-flows-3dc0f30260e9?source=rss-a33767a058b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dc0f30260e9</guid>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[watson-studio]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[ibm-spss-modeller]]></category>
            <dc:creator><![CDATA[Joseph Kent]]></dc:creator>
            <pubDate>Thu, 07 Jun 2018 20:31:17 GMT</pubDate>
            <atom:updated>2018-09-27T13:58:30.159Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_TkRE54OOPNrmJ0O2V_3Q.png" /></figure><h3>Intro</h3><p>In this tutorial, we are going to grab a dataset from the<a href="https://dataplatform.ibm.com/community?context=analytics"> Watson Studio Community</a> (a great resource for sample data, articles and tutorials). Then, we’ll <strong>build a model to predict the likelihood of heart disease</strong> in a sample of patients. The dataset includes various fields including age, gender, blood pressure, and other patient health metrics that we’ll use as inputs to the model. This tutorial demonstrates how quickly and simply you can build models with SPSS Modeler Flows.</p><h3>Getting Started</h3><ul><li>If you haven’t already, log in to Watson Studio at <a href="https://datascience.ibm.com/">https://datascience.ibm.com/</a> and either create a new project or open an existing one (up to you!).</li><li>Once you have a project that you want to use, click the <strong>‘Community’</strong> link in the header bar and search for the dataset — <strong>UCI: Heart Disease — Cleveland. </strong>You can <a href="https://dataplatform.ibm.com/exchange/public/entry/view/f658581635c1979a8ef34da6c1bb2c2a">also find it here</a>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Op0dxJfvhWzpQEgFi3uCMw.png" /></figure><ul><li>Click on the dataset tile to open the preview and take a look at the field names and contents (the field names are a little cryptic but you won’t need to specifically remember what they are apart from the <strong>‘NUM’</strong> field which we will use as our model target).</li><li>Click the back arrow, add the dataset to your chosen project, then open the project. Create a new Modeler Flow using <strong>‘Add to project’</strong> and make sure you use the <strong>‘IBM SPSS Modeler’</strong> runtime.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQruKHrCR0Gi2Z92Uk4byA.png" /></figure><h3>Add and Prepare Data</h3><ul><li>Add a <strong>‘Data Asset’</strong> import node on to the canvas and open the editor by double clicking the node. Click <strong>‘Change data asset’</strong> to open the Asset Browser.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*MDPs5TW71S8C6RlbhrfKLA.png" /></figure><p>The Asset Browser shows you the available data assets contained in your project. If you are using an existing project you’ve worked with before you may have many assets listed. If you started a new project you should only have the <strong>‘Heart Disease’</strong> dataset we just added.</p><ul><li>Once you have selected the dataset, click <strong>‘Ok’</strong> to close the Asset Browser then click <strong>‘Save’</strong> in the node editor to commit the changes.</li><li>Next we’ll add a <strong>‘Type’</strong> node from the <strong>‘Field Operations’</strong> category in the node palette. Drop it on to the canvas and connect the <strong>‘Data Asset’</strong> node to it by dragging a link from its output port.</li></ul><p>We are going to try and predict the <strong>‘NUM’</strong> field which is the diagnosis of heart disease represented as five categories from 0 (no presence) to 4. As the predicted values are categories we are going to use a <strong>C5.0 decision tree model</strong> which can predict a categorical target. However, by default, the SPSS Modeler runtime will consider a field with values of 0–4 as continuous rather than categorical and therefore we must use the type node to change the measurement type (the <strong>measurement type </strong>describes how the field can be used by Modeler).</p><ul><li>Open the ‘Type’ node editor then click the <strong>‘Configure types’</strong> link. This will open the types table panel where you can add fields which you want to modify.</li><li>Using the <strong>‘Add Columns’</strong> link open the field picker and add the <strong>‘NUM’</strong> field.</li><li>In the <strong>‘Measure’</strong> column change the measurement type to ‘Ordinal’ and change the <strong>‘Role’</strong> to ‘Target’.</li></ul><p>Ordinal means categories with some kind of hierarchical order, such as school grades, or in this case severity of heart disease present in the patient. If the categories have no inherent order then the measurement type would be Nominal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*iX1N8S6ptstFw_SzX5ug7A.png" /></figure><ul><li>Click <strong>‘OK’</strong> on the Configure Types panel and then <strong>‘Save’</strong> on the node editor.</li></ul><h3>Build the model</h3><ul><li>Next add a <strong>C5.0</strong> model builder from the node palette and link the type node up to it.</li></ul><p>Modeling nodes in the SPSS Modeler runtime use any field roles which are inherited from earlier in the flow. By default all fields have the <strong>‘Input’</strong> role. As we set the role of <strong>‘NUM’</strong> to target in the previous type node that means our model is already set to predict <strong>‘NUM’</strong> using all other fields as inputs to the model.</p><p>Therefore all we need to do is run the model using either the context menu or the run button in the canvas toolbar which executes the entire flow. You should end up with something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*M51dGU1bMsQYo7ba4uMhsw.png" /></figure><p>Once the model has finished building it will appear as a new node the canvas with a link to the previous type node and a symbolic dashed link to the model build node. This new node is the model object which gets scored with data when you either run the whole flow (which runs all nodes and branches in the flow) or if you run a node subsequent to this model in the same branch using the context menu.</p><p>View the model and take a look at its details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*nKvBiijgwo-QZq_uNcEM3w.png" /></figure><p>Of particular interest is the<strong> ‘Predictor Importance’ </strong>chart which shows which input fields have the most impact on the model predictions. Often you can remove less useful fields to improve the performance of your model.</p><p>Congratulations! You’ve built a model! You can now add a <strong>‘Table’</strong> node from the <strong>‘Output’</strong> category of the palette to score your model and see the output predictions, or alternatively you could try the <strong>‘Analysis’</strong> node (make sure to open the node editor and select the analysis items you want to generate — coincidence matrix is a good start) to take a look at the performance of your model.</p><p>After that, you can<strong> </strong><a href="https://datascience.ibm.com/docs/content/analyze-data/ml-deploy-flow-spss.html?context=analytics"><strong>save your model </strong>model with Watson Machine Learning</a>.</p><p>And that’s it! There are many different model types for different applications, but the general process of building them is the same, so get building!</p><p><strong>Joseph Kent:</strong></p><p>I’ve been a UX designer for IBM for six years and previously worked on the SPSS suite of data science products. My particular areas of interest are graphical representations of data flows and simplifying data science through good interaction design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dc0f30260e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/building-models-in-the-cloud-using-spss-modeler-flows-3dc0f30260e9">Predict the Likelihood of Heart Disease with SPSS Modeler Flows</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predict Customer Churn by Building and Deploying Models Using Watson Studio Flows]]></title>
            <link>https://medium.com/ibm-watson/predict-customer-churn-by-building-and-deploying-models-using-watson-studio-flows-7626b9fb5ada?source=rss-a33767a058b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7626b9fb5ada</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[watson-studio]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Joseph Kent]]></dc:creator>
            <pubDate>Thu, 19 Apr 2018 17:43:25 GMT</pubDate>
            <atom:updated>2018-07-26T08:54:03.797Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9tX4cNX2HLU__zTM0ZTEw.png" /><figcaption>The customer churn prediction model using SPSS Modeler Flow in Watson Studio</figcaption></figure><p>The content for this tutorial came from a session at IBM’s Think! conference in March 20–22, 2018 called: <strong>Accelerating Insight from data by Building and Deploying Models using Watson Studio Flows</strong></p><blockquote><strong><em>Tutorial Update (May 1,2018): </em></strong><em>We updated the ‘</em><strong><em>Adding and merging data using the flow’</em></strong><em> section [Section 3] to match changes to the process of importing data assets into a flow.</em></blockquote><h3>Working with Watson Studio</h3><p>The purpose of this lab session is to use the <strong>Modeler flows</strong> <strong>within </strong><a href="https://www.ibm.com/cloud/watson-studio"><strong>Watson Studio</strong></a> to build and deploy a model for a telecommunications company to <strong>predict customer churn</strong>. Two different datasets will be provided and merged as input for the predictive model. One of the datasets contains information about the customers and which of the company’s services they use. The other set contains call records for the customers.</p><h4><strong>We will cover:</strong></h4><ol><li>Creating a Watson Studio Project</li><li>Establish Project association with Spark instance</li><li>Add data assets to the project</li><li>Building a Modeler Flow — preparing &amp; merging the data in the flow, building the model, evaluating the model</li><li>Comparing a CHAID tree model with an Auto Classifier</li><li>Saving your Modeler Flow in your project</li></ol><h3>1. Create a project</h3><p>All analytical assets within Watson Studio are organized into ‘Projects’. Projects are workspaces which can include data assets, Notebooks, Flows and models (among other items). Projects can be personal or shared with a team of collaborators.</p><p>1. From the ‘Welcome’ page of Watson Studio click on ‘New project’.</p><p>2. Enter a project name, and select your target IBM Cloud Object Storage Instance (<em>we’ll help you create a storage instance if you don’t have one already</em>). Press <strong>Create</strong>.</p><h3>2. Add data assets to project</h3><p>Data assets are added to a project to make them available for any of the tools included in Watson Studio. Data assets added to a project are also available for any of the collaborators sharing that project to use. Examples of data assets are files, such as .csv or .json or database tables added through a data connection.</p><p>1. Click on the ‘Community’ tab in the top bar. From here you can see content in the Watson Studio Community, which includes data sets.</p><p>2. Navigate to the data set ‘<strong>Calls by customers of a Telco company’</strong>, then click on the add (+) icon on the community card for this data set, select your project and click ‘Add’. Once this completes it will display ‘Added’. This may take up to a minute.</p><p>3. From the Community add the data set ‘<strong>Customers of a Telco including services used</strong>’, and once it displays ‘Added’ click on the ‘View Project’ link.</p><p>4. Within the project’s ‘<strong>Assets</strong>’ tab you will see ‘Data assets’ section, which should now have the two added above. Click on the ‘<strong>Calls by customers of a Telco company.csv</strong>’ name to preview the data. From here you will see the description and name on the right. Click on the name to and rename it to ‘<strong>calls</strong>’ then click ‘Apply’.</p><p>5. Return to the project by clicking on the project name in the navigation breadcrumb, then perform similar steps to rename ‘Customers of a Telco including services used.csv’ to ‘<strong>customers</strong>’.</p><h3>3. Building a flow in Modeler</h3><p>1. From the navigation bar select ‘Add to project’ then ‘Modeler flow’.</p><p>2. Provide a name and <strong>use the default runtime ‘IBM SPSS Modeler’</strong>, and click ‘Create’.</p><h3>Adding and merging data using the flow</h3><ol><li>Open the node palette on the left side of the screen using the button in the toolbar. Add a ‘Data Asset’ node from the Import category in the palette.</li><li>Double click the node to open the editor then click the ‘Change data asset’ button. This will open the asset browser allowing you to select from the available data assets in your project.</li><li>Select the ‘<strong>calls</strong>’ dataset and click OK. This will close the asset browser. Then click ‘Save’ in the node editor to apply your changes.</li></ol><p>This dataset contains the call records for the Telco customers. Each customer may have made multiple calls, some of which may have been dropped — meaning the call ended abnormally (perhaps because the phone lost service).</p><p>4. Right click on the ‘calls’ node, or click on the three dots within the node, and select Preview to examine this data set.</p><p>As you can see this dataset contains five columns: from, to, dt, duration and dropped. However there are only two columns in this dataset which will be useful for building the predictive model. The ‘from’ column contains the customer’s phone number, and as this is unique to each customer (and is common with the ‘number’ field in the ‘customers’ dataset) it can be used as an ID. The column labelled ‘DROPPED’ is a flag where 1 is yes (meaning the call ended abnormally) and 0 is no (meaning the call ended normally). This column could be an important input to the predictive model as a reasonable hypothesis to test is:</p><blockquote><strong><em>If a customer has a large number of their calls end abnormally, are they more likely to churn?</em></strong></blockquote><p>The ‘to’ column is the number dialed for that call and the ‘dt’ column is the date of the call.</p><p>5. Add the ‘<strong>customers</strong>’ dataset to the canvas and preview it. Take a look at the <strong>Profile</strong> and <strong>Visualization</strong> tabs to get a better idea of the shape of your data.</p><p>The ‘customers’ dataset contains a row for each customer and various columns with data about the customer. This includes things like the customers age and gender as well as which deals and offers provided by the Telco company that customer makes use of. It also includes the number of times the customer has called the company service desk. The ‘number’ column contains the customers phone number and this maps directly to the ‘from’ column in the ‘calls’ dataset we just looked at.</p><p><strong>In order to work with these datasets it will be useful to read the data and instantiate the fields within the flow. To do this use a Type node, which traverses the data and determines the field types and metadata.</strong></p><p>6. Add a Type node from the node palette on the left hand side. The Type node is a ‘Field Operations’ node (or you can use the search bar).</p><p>7. Connect the ‘calls’ and Type nodes together by dragging a link from the output port of the source node to the input port of the Type node.</p><p>8. Double click the Type node and click on ‘Configure Types’ then click ‘Read Values’. Once this operation completes click OK to close the table dialog, then click ‘Save’.</p><p>9. Add another Type node to the flow and connect the customers node to it, open its settings and click on ‘Configure Types’ then click ‘Read Values’, and then ‘Save’.</p><p>The ‘calls’ dataset potentially contains multiple rows for each customer as multiple calls may have been made and will be logged as separate rows in the table. However, the ‘customers’ dataset contains only a single row for each customer. <strong>It is therefore necessary to take the multiple rows for each customer’s calls and aggregate them together, taking an average for the dropped column to get a ratio of the calls for each customer that were dropped.</strong></p><p>10. To do this, add an Aggregate node from the node palette on the left hand side. The Aggregate node is a ‘Record Operations’ node (or you can use the search bar).</p><p>11. Connect the Type node for the calls dataset and the Aggregate node together by dragging a link from the output port of the Type node to the input port of the Aggregate node.</p><p>12. Open the Aggregate node and click on the ‘Add Columns’ for the ‘Group by’ section. Select the ‘from’ field in the field picker and click ‘OK’.</p><p>As we are grouping the records by the ‘from’ column which, as discussed earlier, can be considered an ID, each unique value will have a single row coming out of the Aggregate node.</p><p>13. Click on the ‘Aggregations’ link to open the Aggregations panel. Add the ‘dropped’ field to the aggregation table using the field picker. For this field, we need to determine what aggregation function will be used to combine the multiple values for each customer into a single value. In this case mean makes sense so click the edit button and ensure that only the ‘Mean’ checkbox is checked, then ‘Save’ the node settings.</p><p>14. Preview the Aggregate node to ensure that the data is as expected. There should now be three columns in the dataset; from, dropped_Mean and Record_Count. Click the ‘Visualizations’ tab and start typing dropped_Mean into the Columns text box, it will autocomplete allowing you to select the field. Click ‘Visualize Data’. A histogram will be generated showing the distribution and frequency of values for the dropped_Mean field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDRG5OnY4pbYcJQI0igWOg.png" /></figure><p>15. Return to the flow by clicking the flow name in the navigation breadcrumb.</p><p>16. Add a Filter node from the node palette and connect it to the Aggregate node. Use the Filter node to rename the ‘dropped_Mean’ field to ‘dropped_ratio’, and also rename the ‘from’ field to ‘number’ then click ‘Save’.</p><p>The next step is to merge the ‘calls’ and ‘customers’ datasets together and in order to do that a key field that has common values for each customer in both datasets is necessary. As discussed earlier the customers’ phone numbers can be used as this ID. As we have renamed the ‘from’ field to ‘number’ it is common with the equivalent field in the ‘customers’ dataset.</p><p>17. Add a Merge node to the canvas and connect the ‘customers’ dataset and then the ‘calls’ dataset to the Merge input port, by connecting first the Type node from customers to the Merge node, then the Filter node from calls to the Merge node.</p><p>The order in which the inputs are connected to the Merge node is important, as the setting we will use, ‘Partial out join’, takes the first input as the primary.</p><p>18. In the Merge node settings tab change the ‘Merge method’ to ‘Keys’ and select the ‘number’ field as the key. Here we are stating that the ‘number’ field is in both datasets and has unique values for each row which match in both datasets (i.e. customer A in dataset 1 is the same person as customer A in dataset 2).</p><p>19. Select ‘Partial outer join’ as the join type. This means that incomplete records from either dataset (where there is no merge to be performed) will be retained in the output dataset. Click the ‘Select Dataset for Outer Join’ link and make sure the ‘customers’ dataset is checked as the primary.</p><h3>Preparing the data for modelling</h3><p>A partial outer join will include all records from both datasets. If there are any customers that only appear in the ‘customers’ dataset then they will still be included in the output dataset but for the columns added from the ‘calls’ dataset the value will be null. A null value is not useful for modeling and in this situation the fact a user has made zero calls may be useful information for the model. We therefore need to convert the null values to ‘0’.</p><p>1. Add a Filler node and connect the Merge node to it.</p><p>2. In the Filler node add the ‘dropped_ratio’ field to the ‘Fill in fields’ list and select ‘Null values’ in the ‘Replace’ dropdown, and click ‘Save’. The default value for the ‘Replace with’ control is 0 so this is all we need to do here.</p><p>Next we need to divide the data into training and testing sets for the model. By doing this the model will use the training partition to build and train and the testing partition to test the accuracy of the model on data it has never seen before.</p><p>3. Add a Partition node to the canvas and connect it up. Open the node editor and ensure that the training and testing partitions use the default value of 50%. This means half of the data will be used to train and half used to test.</p><p>4. To make model building repeatable using the same partitions (meaning the same sets of customers will be used to train and test the model if it is rebuilt) check the ‘Use unique field to assign partitions’ field and select ‘customer_id’ in the dropdown that appears.</p><p>The model won’t need to use all fields in the data and by default all fields are given the ‘input’ role, meaning the model will use that field and try to find relationships between it and the target. For fields like ‘number’ or ‘customer_id’ where the data will have no relationship on the customer churning using these fields as inputs makes no sense so we will use the type node to stop the model using them.</p><p>5. Add a Type node from the palette and connect it up.</p><p>6. Open the node editor and click the ‘Configure Types’ link to open the wider editor.</p><p>7. As mentioned all fields will use the ‘input’ role by default so we only need to add fields we want to change to the type table. Add the following fields:</p><p>number</p><p>customer_id</p><p>first_name</p><p>last_name</p><p>twitter_handle</p><p>location</p><p>churned</p><p>8. Using the dropdown in the table set the role of churned to ‘Target’.</p><p>9. For all the other fields set the role to ‘None’. This means the model will ignore them.</p><h3>Building the model</h3><p>1. Add a CHAID node from the palette and connect it up.</p><blockquote>The CHAID node is a tree model which iteratively splits the data into groups based on significant differences in field values. The model finds the most significant split first and divides the data, for example it may split the data by gender. Then for each subgroup it repeats the process, forming a tree-like diagram. When a new row of data is scored with the model the row effectively travels from the top of the tree down through this tree diagram based on the values for each field that split the data. When the row reaches the final level of the tree diagram, called the leaf node, a prediction is made based on the majority target value for training records contained in that node. The bigger the majority the higher the confidence in that prediction.</blockquote><p>2. With the Type node determining the target field the CHAID node label should change to ‘churned’. We will run the node with the default settings but feel free to open the node editor to take a look.</p><p>3. Click the ‘Run’ button in the canvas toolbar. Once execution has completed a new model node will appear on the canvas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgGND785jph7U9h9K6Xw5Q.png" /></figure><p>4. Preview the new model node and confirm that the two new fields from the model are included ($R-CHURNED — the prediction, $RC-CHURNED — the confidence in that prediction as a value between 0 and 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0fmE_D_SSR-3gxqI2i59dA.png" /><figcaption>Your model viewer for the CHAID model!</figcaption></figure><p>5. Open the context menu on the model (by right-clicking or click the little options glyph on the node) and click ‘View Model’. This opens the <strong>model viewer</strong> which contains information, statistics and charts about the model. Use the tabs in the navigation pane to view the different pages about the model.</p><p>6. In particular the ‘Predictor Importance’ chart shows useful information about which input fields are most useful for making the prediction (including the dropped_ratio field we derived earlier).</p><p>7. Also look at the tree diagram and hover on the different nodes to see how the training records were split.</p><h3>Evaluating the model</h3><p>Now that a model has been built we can evaluate it to determine how accurate it is at predicting customer churn.</p><p>1. Add an Analysis node from the outputs section of the node palette and connect the generated model node to it.</p><p>2. Open the Analysis node editor and select the ‘Coincidence matrices’ checkbox then save the change.</p><p>3. Using the node context menu run the Analysis node. When complete it will generate an output object and the flyout panel containing your outputs will open. Double click on the new analysis object to open it.</p><p>The analysis output contains the accuracy figures for the model as well as a coincidence matrix showing the correct and incorrect predictions made by the model.</p><p>The accuracy and coincidence matrix items are divided into the training and testing partitions created earlier in the flow. It is expected that the accuracy for the testing partition is lower than the training as this is data that the model did not see as part of it being built.</p><p>The coincidence matrix is useful for determining if the model has a problem with predicting one category over another. For example, the model may be worse at predicting a customer staying than it is at predicting a customer churning.</p><p>4. From within the Analysis output click on the flow name in the header bar to return to your flow.</p><p>5. Build an evaluation chart to get a graphical representation of the quality of our model — to do this add an Evaluation node from the graphs section of the node palette and connect it to your model.</p><p>6. We will run this node with default settings to build a ‘Gains’ chart, but feel free to open the editor to see what other settings are available. Run the Evaluation node using the context menu.</p><p>7. A new evaluation chart output item should be added to the flyout panel. Double click this to open the chart in a new breadcrumb.</p><p>The SPSS Modeler Knowledge Center description of Gains charts is:</p><blockquote><strong><em>Gains charts.</em></strong><em> Cumulative gains charts always start at 0% and end at 100% as you go from left to right. For a good model, the gains chart will rise steeply toward 100% and then level off. A model that provides no information will follow the diagonal from lower left to upper right (shown in the chart if </em><strong><em>Include baseline</em></strong><em> is selected).</em></blockquote><h3>Build an Auto Model to compare classifiers</h3><p>The SPSS Modeler runtime includes auto models which build multiple different examples of the same type of model (either classifier or numeric) and then ensemble them together to provide a prediction. The auto modeler can also be useful for comparing different model types and their accuracy.</p><p>1. Add an Auto Classifier from the node palette and connect the Type node to it.</p><p>2. The Auto Classifier builds a default selection of classification models and keeps the top few models based on accuracy. Run the node.</p><p>3. When the Auto Classifier model is added to the canvas view it using the context menu.</p><p>4. The Auto Model is a special case in that it contains multiple individual models. These can be seen in the ‘Models’ table in the viewer along with information about each model. You can view the individual models using the action menu in the table row.</p><p>5. The ‘Use’ checkbox allows you to deselect one or more models from this list so that they are not included in the ensemble when the overall Auto Modeler is scored. Keep all the models selected and return to the flow using the breadcrumb in the header bar.</p><h3>Evaluating the Auto Classifier and comparing with the CHAID model</h3><p>To evaluate and compare the Auto Classifier and the CHAID model, we will need to connect them together before passing the predictions to the evaluation graph node.</p><p>1. Using the context menu on the generated Auto Classifier disconnect it from the Type node (note the dashed ‘model refresh’ link will remain).</p><p>2. Connect the CHAID model output port to the input port of the Auto Classifier model node and then disconnect the Evaluation node and connect the Auto Classifier to it so that the flow looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oiz4b3s23wZnQokGdLfPrQ.png" /></figure><p>3. Run the Evaluation node to build a combined ‘Gains’ chart, then view it.</p><p>As both model prediction fields are being passed to the Evaluation node it will plot both on the same graph allowing a comparison. The models are likely to be similar in performance but note whichever has the generally higher line — this is the model with better performance at predicting customer churn. $R-CHURNED is the CHAID model, and $XF-CHURNED is the Auto Classifier.</p><p>You could also use an analysis node to compare the performance of the two models.</p><p><strong>Congratulations! You’ve built two models predicting customer churn and evaluated them to compare their performance.</strong></p><h3>Summary</h3><p>In this tutorial we have created a project in Watson Studio, added some data from the community and then used the Modeler Flows product to build a model that answers the question: <em>Will a customer churn?</em></p><p>With the variety of other model types available in Modeler Flows you can build a model to answer practically any question and get real value from your data!</p><p><strong>Joseph Kent:</strong></p><p>I’ve been a UX designer for IBM for six years and previously worked on the SPSS suite of data science products. My particular areas of interest are graphical representations of data flows and simplifying data science through good interaction design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7626b9fb5ada" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-watson/predict-customer-churn-by-building-and-deploying-models-using-watson-studio-flows-7626b9fb5ada">Predict Customer Churn by Building and Deploying Models Using Watson Studio Flows</a> was originally published in <a href="https://medium.com/ibm-watson">IBM watsonx Assistant</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>