Blog — DataDrive

Using Salesforce’s Einstein AI with Tableau

Written by Shahrukh Khan | Dec 11, 2020

With the Salesforce acquisition of Tableau, a popular question is - how can Einstein’s powerful capabilities be leveraged inside Tableau Dashboards?

*If you are wondering how to use Tableau dashboards inside of salesforce, check out my blog here.

While there are several official integration pipelines that are currently being built - there are several extensions that can be leveraged to display a brief summary of Einstein-powered advanced analytics today.

In this blog post, I’ll be providing an introduction on how to build a model in Salesforce’s Einstein, and then how deploy it in a Tableau dashboard. The objective of this post is to quickly give users an understanding of Einstein’s predictive capability within Salesforce, as well as how to leverage an extension to deploy it in Tableau.

If you’re already familiar with Salesforce’s Einstein Analytics, you can skip down the last part of blog titled “Tableau & Einstein Integration”.

Disclaimer: Tableau Desktop is required for you to manage extensions into your Tableau Dashboards

Salesforce and Einstein Analytics

Signing up for Developer Edition Salesforce & Gathering the Dataset

It all begins with getting your own version of Salesforce, specifically the Einstein analytics enabled developer edition. You can register for one here. After registering and verifying your email, you can login to Salesforce at their portal located here.

Once logged in, you should eventually find yourself in a screen resembling this:

 
 

If you’ve read my last blog, you’ll know that I am fan of using the Kings Country housing dataset! You can download it here.

Navigating Einstein Analytics

If you’re looking at the homepage, there are many things to explore. Salesforce has built a huge ecosystem, but for now - we will focus on Einstein Analytics. Let’s navigate to Analytics studio by clicking the “home” button.

 
 

A list of options will come up from where you can navigate to Analytics Studio. If it isn’t in your initial options, you can type it in your search and it should come up.

Once you’re in Analytics studio, navigate to “create” on the left hand side. This wizard will allow us to upload a CSV file for Einstein to analyze.

Dataset Wizard

The dataset wizard has multiple different options:

We can build datasets to analyze off of CSV files, Salesforce objects & other external data sources. We can also prep datasets by building a “recipe” - but we’ll go over that in a different blog.

Let’s start by uploading our CSV file. Click upload and it should take you to a drop-box type menu. Navigate it to your dataset and drop it there.

The next screen will allow you to name your dataset, select where to store it and show you properties about your file. Click next to go to the final part of the wizard which will allow you to view your data and observe if it has been correctly uploaded. We will want to navigate each of the columns by clicking on it.

Pay close attention to the field types. For example; we would want to set zip codes as dimensions - not measures. After you’ve played around with your desired settings for columns, you can click the “upload file” button.

You should now be in a page like this:

 

Einstein Discovery

Now let’s take a look at Einstein Discovery! Einstein discovery allows us to get meaningful insights and predictions regarding the dataset we just uploaded. Navigate to the “create story” button on the top left of the screen. This should prompt the discovery wizard.

Starting an Einstein story requires us to select a variable to minimize or maximize.

For the purpose of this demo, we’ll be maximizing price.

We can follow the prompts to then click “Insights & Predictions” followed by “Manual”. Clicking only insights will exclude our model will generating predictive behavior metrics. Using the “Auto” option will let Einstein decide which variables to use to run it’s “Insights & Predictions”.

 
 
 

The screen following the manual prompt allows us to customize what variables we want to use in our model. It also allows for different algorithms to be selected on the top right. We will choose the model tournament option, as this option allows us to compare all algorithms and use the best one for our insights or predictions.

This section also allows us to pay with binning and filter options for our variables selected. There are also correlation metrics with our price variable beside each independent variable. As Einstein only allows for a maximum of 13 columns for generating predictions, we can remove some columns such as lat, long, etc.

Model Metrics and Deployment

We should now be in a display that will help us understand our model better. Einstein will first generate important insights which will tell us what variable contributes to explaining the most variation in price.

For example, for our variables selected, “grade” explains 44.4% of the variation in price. If our average price is $540,000, a grade higher than 8 can have an average home price of $774,000. We can also see what Einstein suggests by going to “Recommended Insights”.

There are also buttons for “Why it happened” and “What could Happen” which will allow us to compare and explore relationships from different perspectives. For this blog, we’ll be clicking into the Model tab and exploring model performance:

 

 

The model performance tab has a couple of key things to notice:

First, the navigation tab. Through this tab we can dive into the Model Evaluation and Prediction examination page. The model evaluation page gives us a deeper look into key model metrics such as MSE, MAPE, MAE and cross validation results.

The prediction examination page gives us insight into the actual predictions Einstein made after it split the dataset to predict the other half. The four quadrant sections in the center of the page represent different metrics we can use to evaluate our model.

We have a section on this page that displays our R squared - a metric that tells us what percentage of price can be explained by our independent variables. We also have a section that shows us if we’ve passed the cross-validation test along with the ability to revisit Einstein’s recommendation on model improvements.

Finally we can observe the distribution of data of our price, as well as observe the top predictors for price.

 
Now we’re ready to deploy the model!

Clicking the “Deploy Model” button above should launch the deployment model wizard. The first part of the prompt allows us to rename the deployment object and deploy it as a replacement to a previous prediction, or as a new prediction.

Clicking the add object prompt afterwards allows us to choose if we want to deploy the model connecting to a salesforce object or not. We will not be deploying the model as a salesforce object. We can then decide to segment our variables for predictions, but we’ll be using all variables without any segments.

The next part of the wizard is “Improvements”, which allows users to improve likelihoods based on particular variables or suggested actions. We will select all of these variables. We can now proceed to the final review and then deploy our model!

 

Tableau & Einstein Integration

While Salesforce plans to bring official integration of Einstein predictive capabilities into Tableau in 2021, there are other ways to bring in Einstein’s capabilities into our dashboards today. This can be done through extensions. An extension crafted by John Hegele does this gracefully, and can be downloaded here.

Be sure to right click and “save link as” to download it as a trex file type. Full documentation about this extension can be found here.

 
 

Once the extension is downloaded, we can now bring in our predictive model and scenario’s in Tableau! For this demo, I’ve prebuilt a dashboard.

We will start by selecting the extension object and dragging it into the dashboard. The extension will prompt you to login into your Salesforce developer account.

 
 After closing the authentication tab in our browser and completing the prompts, we can navigate back to the extension. We will now be able to select the model that we just deployed. Next, we’re asked if we would like to map the variables in our model to fields in our dataset.

I’ve prebuilt parameters to map these variables. Mapping these variables allows Einstein to make predictions and scenarios based on the variables mapped. If you would like to utilize this extension to it’s fullest, create a custom parameter for every variable that is being used in the model.

 
 

Once deployed, you can play with with the background color, extension settings and much more by clicking the cogwheel on the bottom right of the extension. More information about customizable options can be found here.

With that, we now have a dashboard that can leverage some of Einstein’s capability directly inside Tableau!

 
 

 Explore More