Einstein Discovery drives business value for companies by eliminating friction in using machine learning, and maximizing its time-to-value. It is designed to facilitate every step of the journey towards operationalizing Machine Learning in the workspace, in a safe, ethical and most of all practical and easy way. This applies training the model and interpreting the Story, but it applies equally to making predictions with the model.
The truth is: every machine learning model can make predictions. That’s what they are built for. However, when a material business impact is expected from the prediction, what matters is what happens with that prediction. Who is looking at it, and for what purpose? What business decision is it supporting, what process is it driving? How up to date is the prediction, and how compelling is its display? Is the prediction actionable, and is it explained? All these questions elevate the discussion from making predictions to embedding predictions.
To embed a prediction in a business process, the corresponding model first needs to be deployed. Deploying means bringing into a state such that it can actually produce predictions for new data; data that the model didn’t see during training. Deploying a model in Einstein Discovery is extremely easy, it’s literally a matter of clicking through a simple 6-step wizard. Once deployed, Einstein Discovery supports a wide variety of options to embedding the predictions – and other model outcomes. This article aims to outline all those options and compare and contrast those different approaches and provide design guidelines that let you choose the right approach for each occasion.
Spoilt for choice
We distinguish no less than 12 different ways to use a deployed model. We will later on compare them based on 9 different criteria, that all play a role when choosing the right approach.
Let’s first introduce the different options quickly, based on the target application in which the predictions will be embedded.
Salesforce is of course one of the most frequent and important applications to deploy models to. Please note that all these options share a number of important benefits. First of all, Einstein Discovery supports deploying a model against multiple Objects, so using columns across objects is no problem. Secondly, these deployment options can work with a so-called a ‘supplementary data set’. This supports those cases when certain columns of the Story don’t exist on any Salesforce object, for example because they are derived features. The deployment maps then Story columns to fields from a supplementary CRM Analytics dataset, next to the normal field mapping to Salesforce fields.
We distinguish five different approaches to embed model outcomes in Salesforce. Firstly, there is the famous Lightning Component (1) that you can add to a lightning page, as shown on the left here. An Account page can display churn insights, an Opportunity page can display the likelihood to win insights etc. Secondly, To also store the predicted value on the record, it is possible to use an Automated Prediction Field (2), which is a special field type that can be easily added to the Salesforce object in the deployment wizard. Thirdly, to store also the explanations and suggested improvements on the object, use Custom Fields (3). There are two options to do so, either by APEX or by using the Recipe Predict node and the salesforce output connector.
Predictions are often used to drive process automation in Salesforce, like workflows or process builder, validation rules, Next Best Action etc. A special Predict Function (4) exists that calls the Einstein Discovery model directly, from within those process automation frameworks, so you don’t need to base your automation logic on fields stored on the model.
Also, it is possible to call Einstein Discovery models natively from Flow (5) using the Einstein Discovery core Flow action.
And finally, it’s possible to directly call the Einstein Discovery model programmatically using APEX (6), when you want to have full programmatic flexibility over how you store and use the model outcomes in Salesforce.
CRM Analytics / Salesforce Core
A common route to embed predictions in Salesforce is by displaying them on an embedded CRM Analytics Dashboard. That means the predictions need to exist in the dataset that is used by the Dashboard. It is possible to directly store these predictions in the dataset, by using a Predict Node. The data manager supports two types: the Recipe Predict Node (7)and the Dataflow Predict Node (8).
Next to Salesforce, the model deployments of Einstein Discovery are natively integrated into Tableau as well, starting with the 2021.1 release (safe harbor). There are three different mechanisms to extend Tableau workbooks with these predictive capabilities. Firstly, there is a Tableau equivalent of the Lightning Component, called the Einstein Discovery Dashboard Extension (9). An example is shown on the right.
Secondly, any custom visualization of the predicted values can be created with the Tableau Calc Function (10) for Einstein Discovery. This function calls the model on the fly for the data in a particular selection, and returns the predicted outcomes so they can be included in the dashboard (see example below – the percentage of invoices predicted to be paid late, grouped by Account). And finally, to prepare all outcomes in advance of the the data exploration and physically store them in the datasource, you can use the Discovery Predict node in Tableau Prep Builder (11).
Finally, it may be that you want to include the recommendations in a totally different application. That could be a finance-backed system, an ERP system, or even a b2b commerce portal. For that purpose. the Einstein Predictions API (12) provides a REST API endpoint to request a prediction.
Horses for Courses
Or as they say; different strokes for different folks. Each of the 12 deployment approaches has its virtues, and is suitable for different scenarios. We identified a set of questions to ask, to compare the different deployment approaches. Of course, a key factor is what application to deploy the model outcomes to. But then also think about the usage of the predictions; is it just for display, or do they have to be stored as well? And what is the timeliness of update – should these be in real-time, in bulk, and if in bulk, should it be possible to schedule the prediction runs? Should the predictions support process automations? Be obtained with clicks or code? Contain Predictions only, or also Recommendations and Improvements?
Below, you will find a table with all the deployment options , compared based on all these criteria. To provide you with some inspiration for traversing this table, take a look at the decision tree on the left 😉
To make this guide a complete description of the different approaches, please take a look at the below table as well. Here, you will find a short description for each, together with some usage guidance, pros and cons and further reading is presented. Just click the ‘+’ icons to expand or collapse the details.
Let’s now review a few example scenarios in which several of these deployment approaches are used. Expand the table using the ‘+’ to see the recommended deployment.
Deployment of a predictive model is only as valuable as its usage. That’s exactly why we make it possible to consume Einstein Discovery model outcomes in as many ways as possible and make this deployment as easy as possible. One approach is not necessarily better than the other, they just serve very different use cases. So let me know in the comments, which deployment approach will you use? And which one would you still like to see added to the list? Let us know!