Einstein Discovery in Tableau – Try it for Yourself : Bobby Brill
by: Bobby Brill
blow post content copied from salesforceblogger.com
click here to view original post
Einstein Discovery empowers businesses to explore patterns, trends, and correlations in their historical data with the help of auto-generated machine learning models. While understanding the past is helpful, Einstein Discovery machine learning models can be deployed and operationalized to predict future outcomes – all without ever writing a single line of code. Starting with the Tableau 2021.1 release, Einstein Discovery predictive models can be consumed in Tableau to help users make smarter decisions with predictive analytics. To build and maintain your models, you need access to Einstein Discovery using a Tableau CRM (formerly known as Einstein Analytics) license in Salesforce. If your company is new to Salesforce or doesn’t already own licenses to use Einstein Discovery, this step-by-step guide will walk through how you can try out the features for free using your very own Trailhead Developer Edition of Salesforce, which includes a Tableau CRM license.
Step 1 – Visit Einstein Discovery Basics in Trailhead
New to Trailhead? This is Salesforce’s learning platform where you can learn how to use just about any Salesforce feature (as long as you don’t get distracted by all the furry animals).
The Einstein Discovery Basics trail will introduce the product as well as get you set up with creating your first Einstein Discovery Story. Within this trail, you will be able to create your own free Developer Edition Salesforce org, complete with Einstein Discovery, but if you’re too busy to read through the modules, you can just create your org by clicking here (just promise me you’ll go back and take the trails to learn more about the product). Make sure to save your login and password as you’ll use it to authenticate Einstein Discovery in Tableau later in the process.
Step 2 – Create Your Einstein Discovery Story
We all know and love the pre-built Superstore workbook, so to keep things simple, we’re going to use Einstein Discovery to analyze historical product sales by category and month and surface the factors that are driving higher Profit.
Before analyzing data with Einstein Discovery, it’s important to get your data at the right grain level. Since the Superstore dataset has daily product sales data, I used a Tableau CRM Recipe to aggregate the sum of profit by category and month. Tableau CRM has a built in data layer that lets you clean and prepare your data before analyzing it with Einstein Discovery.
While I encourage you to learn more about Tableau CRM recipes (which you can do in Trailhead), you can simply download the model training dataset which has already been aggregated by Category, State, and Date (Year – Month).
Once you log into your free Developer org (provided in the Trailhead mentioned above), you will need to launch Analytics Studio, which is where you will begin.
Next, upload the model training dataset you downloaded from the link above by clicking Create on the right-hand side in Analytics Studio, and selecting Dataset from the menu.
Choose CSV File and upload the CSV for the Superstore Model Training data.
Review what’s included in the dataset to make sure it is accurate, and click Upload File.
Once your dataset has been created, the dataset page will automatically load. Here you will click Create Story on the right side to start your analysis.
For this example, we will be analyzing this dataset to see what is driving higher profit. So we will “Maximize” the field “Profit,” then click the “Story Type” button to move to the next step of the Story-building wizard.
On the next page, click on Insights & Predictions, which indicates we want to build a model that can predict future Profit (instead of just getting insights on existing data).
For simplicity, just choose Automated setup. This is where Einstein Discovery will automatically choose the best fields based on R-squared, but in this case, since there are only 5 fields, all will be selected. Then click Create Story.
The Story should only take a minute or two to complete, and you should see something like this:
Step 3 – Deploy the Model
Feel free to navigate the story insights however you want. You will notice that the number variables have all been bucketed into 10 bins. This is done so Einstein Discovery can better explain how numbers impact the overall outcome. Spoiler alert: higher discount buckets mean less profit. Also, if you click into the Model tab, you’ll see this isn’t exactly the best predictive model, but the purpose of this guide isn’t about model building—it’s to show you how to consume a predictive model in Tableau, so we can worry about model tuning later.
In order to use the predictive model in Tableau, you will first need to deploy it in Tableau CRM. Click the arrow drop-down menu on the right side, and select Deploy Model.
You will want to deploy this model as a new Prediction. The Prediction Title that you enter on this page is what users will see in the Tableau Einstein Discovery Extension, so make sure it’s something that will make sense to your users. Click Add Object to move onto the next step. Note that Einstein Discovery supports up to 10 model segments per Prediction, so if you want to segment your models, let’s say by region or product, you can do that.
Einstein Discovery can be used to make predictions inside or outside Salesforce. Since this model is intended to be used outside of Salesforce, choose the option to Deploy without connecting to a Salesforce Object, then click Add Filters.
As I mentioned above, Einstein Discovery supports multiple model segments per prediction. When you eventually try out that feature, you will need to create a segmentation filter. But since this is just a basic model, keep the selection of “No segment (use the prediction on all the data),” then click Add Variables.
One of my favorite features of Einstein Discovery is the ability to select actionable variables from the model that, should a user change them, would improve the overall predicted result. Both Discount and Quantity are possible variables that could be adjusted by users, so you can check those two for now. For each variable selected, Einstein Discovery will evaluate all categories of that variable during prediction time and offer recommendations based on how to improve the prediction (in this case, how to predict higher profit). Once you select variables, click Review, then Deploy.
After clicking Done, return to the Tableau CRM Analytics Studio and launch the Model Manager by selecting it on the left side panel.
Here you will see the Prediction that you just deployed. Open the Prediction to see the model by clicking the arrow in the line item, and selecting View.
If you need to edit any of the settings you configured in the deploy wizard, such as adding segmentation filters or changing the Improvement Variables, you can access the model settings from here by clicking the arrow and selecting Edit Settings.
Step 4 – Add the Einstein Discovery Extension to Your Tableau Dashboard
Now it’s time to add the Einstein Discovery Extension to your dashboard so that users can consume the model within their Tableau workflow. This step requires, at a minimum, Tableau version 2021.1 (Desktop, Server or Online). If you’re using Tableau Server or Online, you may need to speak with your admin first as there are a few additional security steps required such as setting up Cross-Origin Resource Sharing (CORS) in your Salesforce org as well as setting up Saved Credentials in Tableau.
The Einstein Discovery Extension supports making bulk predictions on table data, as well as performing what-if scenarios using parameters. In this example, I will be showing you how to connect the Extension to parameters. I had to modify the Superstore dashboard and include parameters for Discount, Quantity, State, Category, and Month (because these are the fields I used to build the predictive model). I know it’s not hard to create these, but if you want a workbook where it’s already been done, feel free to download this.
Start by dragging and dropping the Extension object onto your Tableau dashboard.
This automatically launches the new In-App Extension Gallery. You can search for the Einstein Discovery Extension and click the Add to Dashboard button.
Upon adding this to your dashboard, your default browser will launch with a login page to Salesforce. Here is where you can log into the same Trailhead Developer Salesforce org you used to build and deploy the model.
Once authenticating, you will need to allow Tableau to access your Salesforce data, as that’s where you’ve built your models.
Return to Tableau Desktop and you can start configuring the extension. Click the Search Predictions field and select the title of the Prediction you created in Step 3. Next, change the radio button from Worksheet to Parameters, and click Proceed.
Make sure all model fields are mapped appropriately to your parameters. If you are using the workbook you downloaded above, all parameters should automatically map, but if you created them yourself, the names might not match exactly. Then click Next.
Lastly, you have some options for how the prediction shows up, including changing the title, adding units, and deciding how many top factors and improvements you want to show. Then click Done.
That’s it! Now every time you change a parameter, the Einstein Discovery Extension will pass the parameter values to Salesforce and evaluate a new prediction.
Notice the recommendations under the “How To Improve This“ section at the bottom. As mentioned in Step 3, Einstein Discovery will evaluate other values of certain variables and offer recommendations on how to improve the predicted outcome. In the screenshot here, predicted profit would improve simply by lowering the Discount from its current value of .25 to somewhere between 0.04 and 0.18.
Step 5 – Customization and Maintenance
Now that you have completed a simple example, it’s time to explore all the ways to customize.
Customize the Dashboard Extension
There are several options you can tweak in the Dashboard Extension configuration page to customize what is shown to users. For example:
- Increase or decrease the number of top factors or improvements shown
- Hide the impact value for each factor or improvement
- Choose a threshold that determines which improvements are shown. For instance, only show the improvement if it improves the overall prediction by at least 20%
- Disable Top Factors or Improvements if you don’t want to show them
Customize the Predictive Model
There are plenty of things you can do to customize the predictive model back in Salesforce to tailor it to your business’s changing needs. For example:
Customize the Improvement Text:
Maybe you want to change the text that shows up in the How to Improve This section so business users can understand better what Einstein Discovery is suggesting to them.
- Find and open the Prediction in the Model Manager in Tableau CRM
- Click edit settings on the model
- Click on the improvement tab in the Edit Setting Modal
- Select the “Specify custom text” radio button.
You will have access to the certain key words which you can embed within any text you want. Note that this text will only show up in a single language. Once you save, you may need to reload your dashboard component in Tableau to see the changes as some of the data will have been cached.
Choose different Improvement Variables:
In the same Improvements tab in the model’s settings, you can choose to include different Improvement Variables for users. Note that the more variables you select, the slower the performance may be on the Extension because the Prediction will take longer to complete.
Engineer features with Recipes:
Need to calculate, aggregate, or provide some structure to your unstructured data? Tableau CRM Recipes will let you do just that. Just pop on over to the Data Manager from Analytics Studio in Tableau CRM, and get access to a huge toolkit of transformations that will empower you to build better models.
Build a new Story Version:
Model building is an iterative process. When you edit a Story, you can configure settings such as the bucket ranges used for number fields as well as filtering out outliers. Bring in new fields and more rows of data (just update the dataset with a new CSV) if you can. Every time you click Update Story, a new story version will be created.
Try different model algorithm:
By default, Stories are run using General Linear Models (GLM) because they have the best explainability and are the fastest at making predictions. However, tree-based models like Gradient Boosting Machines (GBM), Extreme Gradient Boosting (XGBoost), and Random Forest may provide more accurate predictions. Not sure which algorithm is best? Just select Model Tournament and let Einstein choose the best model for you. Note that both XGBoost and Random Forest may perform significantly slower when making predictions in bulk, especially when improvement variables are selected.
Deploy a new Model Version:
If you do make changes to your Story, you will need to deploy the new model updates. When doing this, make sure to select the radio button “Add or replace a model in an existing prediction” within the deploy wizard, choose the prediction that is already connected to your Tableau dashboard, and check the box to “Replace model”.
Conclusion
In just a few steps, you can get going and quickly build predictive models using Einstein Discovery, consuming them within Tableau. By getting predictions and recommendations at the point of decision making, your users can make more intelligent, data driven decisions.
March 25, 2021 at 01:48PM
Click here for more details...
=============================
The original post is available in salesforceblogger.com by Bobby Brill
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================
Post a Comment