Try out Predictive Analytics in Tableau using Einstein Discovery
Posted By Dan Bradley
Are you curious about incorporating predictive analytics into your Tableau vizzes but not sure where to start? You may want to try the Einstein Discovery and Tableau integration.
Einstein Discovery is the machine learning/predictive analytics tool under Salesforce’s CRM Analytics platform. Now that Tableau is part of the Salesforce family, there are new ways to integrate Einstein Discovery’s predictive functionality into Tableau.
This post is a step-by-step guide to build and deploy a simple predictive model. After building the model, I connect to it via Tableau Prep Builder to score individual records of a dataset.
To follow, I assume you already have an active Tableau license with access to Tableau Prep Builder. If not, you can sign up for a Tableau trial here.
The big disclaimer: All of the data used here is fictitious and intentionally contrived for the purposes of this developer, proof-of-concept demonstration guide. The intent of this post is to introduce the mechanical basics of building, deploying, and connecting to a predictive model in a developer environment using Einstein Discovery and Tableau. The critical steps of evaluating and tuning a model for accuracy for use in a production scenario are not covered here. Trailhead includes several modules introducing these concepts and working with your friendly, local data scientist team is recommended before deploying predictive modeling into any production situation.
Step 1: Sign-up for a Salesforce Trailhead Account
You’ll want to sign up with Salesforce’s Trailhead program, if you haven’t already. Trailhead is a free learning environment covering the universe of Salesforce products (Tableau included). The process is fast and will help you keep track of what you have learned or may be interested in learning. There are a number of lessons, or “trails”, that focus on aspects of Einstein Discovery that are far beyond what is covered in this post.
If you aren’t yet an existing Salesforce user, use the sign-up options in the second row in the image below.
Step 2: Start the Einstein Discovery Basics Trail
Once you have an account, the Einstein Discovery Basics trail provides an in-depth guide introducing the ins and outs of Einstein Discovery. To follow along with this post you aren’t required to complete the trail first, but you’ll certainly want to complete it at some point. At the very least, I’d recommend the first two modules: “Get to Know Einstein Discovery” and “Build Your CRM Analytics Dataset”.
Step 3: Sign-up for an Einstein Discovery Developer Edition Org
An Org in Salesforce parlance is an account. If you started the Einstein Discovery Basics Trail above, you’ll be prompted to do do this step in the “Build Your CRM Analytics Dataset”. Alternatively, you can use this link to jump straight to the sign-up page.
After signing up, you’ll receive an email that prompts you to activate your org and set a password. Make sure you keep both your username and password handy as it will be needed later.
Step 4: Upload Part 1 of the Sample Dataset
After activating the org, you should be redirected directly into your trial environment. If not, use thislink to sign-in using your username and password. Next, navigate to the CRM Analytics app or “Analytics Studio” as show below. This is where we’ll upload the dummy dataset.
As this post is intended for a higher education audience, I’m using an enrollment management dataset, part 1 of which can be downloaded here. This data that will be used to build and train our predictive model, or “Story” in the jargon of Einstein Discovery. Part 2 of the data set includes the records we will be using the model to score the likelihood of each admit enrolling (link below).
Step 5: Create the Einstein Discovery Story or Predictive Model
With the dataset uploaded, the fun part begins. We need define what we are trying predict and what fields should be used to predict it. For example, here we’re trying to predict an applicant’s likelihood to matriculate based on all of the other information we have about them. Einstein Discovery’s interface walks you through a series of screens to help you with this process. It also provides feedback to help you assess how appropriate and what amount of confidence you should have in the developed model to base predictions on.
Depending on whether you’ve closed out the data upload waiting screen, you’ll either be directed to a screen that looks like the one just below, or you may need to navigate to the newly loaded data set from the main interface, which is shown in the second screenshot. Either way, you’ll be looking for the “Create Story” button:
Step 6: Deploy your Model so that Tableau Prep Builder can Connect to it
Now that the story/predictive model has been trained, we need to make it accessible to outside applications, which in this case is Tableau Prep Builder.
Step 7: Open Tableau Prep Builder and Load the Data to be Scored by the Model
We now move out of the Salesforce interface and into Tableau Prep Builder. You’ll want to download and load into Prep Builder part 2 of our dataset, which is structured identically (same fields) as part 1. In the new dataset, we still have an “Enrolled” field, but we’ll be using this as a way to compare against our model’s prediction.
Step 8: Create a prediction step and sign-in to your Developer Edition Org
You’ll need the username and password you created for this step. After signing in, you’ll need to tell Tableau Prep which of the models you want it to use, which will likely be only one unless you’ve previously created and deployed a story.
Step 9: Map fields between the Tableau Prep Builder flow and Einstein Discovery model
Many of the fields may automatically be matched but if any are missing you’ll need to specify them manually. Pay attention to any errors that Prep may through – I’ve found that most often the issue is related to a data type mismatch, e.g., a String field in your story which is a Boolean field in your Prep flow. If there are any data type mismatches, you’ll need to make the change to the data type in a prior step of the flow.
Step 10: Evaluate the Predicted Results
If Tableau Prep Builder is happy and processes the results, you’ll see a new field is added to your dataset representing the percent likelihood of an applicant matriculating. You can use this probability to do all sorts of things – aggregate, bucket applicants, etc. When you output the flow, this field will be included.
Step 11: Include additional predictive fields from the Einstein Discovery model
A single predictive value is not the only insight you can use to enhance your dataset. On the prediction step, try experimenting with the other options under settings: top predictors and top improvements. Depending on you’ve configured your model and what fields are set as actionable, these additional fields can help provide prescriptive insights — suggestions on what you could do to increase the likelihood of an applicant matriculating
Concluding Thoughts and Next Steps
If you’ve followed along, I hope you found this guide a helpful introduction to the basic mechanics of working with Einstein Discovery predictive models and Tableau Prep Builder.
Dan Bradley is a Principal Solution Engineer for Tableau’s Higher Education Field Education Team. Based in Chicago, he works with higher education institutions in the Central and mid-Atlantic regions of the U.S. In addition to technology, Dan has a background in education administration, including an M.S. in Higher Education Administration and Policy.
Dan's mission is to help the people of higher education become data-reflective practitioners who can see, understand, and act on their data.
*Opinions are my own and not the views of my employer*