Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Get to Know Einstein Prediction Service

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain Einstein Prediction Service capabilities.
  • Explain predictions, improvements, and top predictors.
  • Explain models and prediction definitions.
  • Describe the difference between producing and consuming models.
  • Explain the three business analytics use cases that Einstein Prediction Service addresses.

What Is Einstein Prediction Service?

Einstein Prediction Service is a public REST API service that lets you programmatically interact with Einstein Discovery–powered models and predictions. You use Einstein Prediction Service to:

  • Get predictions on your data.
  • Get suggested actions to take to improve predicted outcomes.
  • Manage prediction definitions and models that are deployed in Salesforce.
  • Manage bulk scoring jobs.
  • Manage model refresh jobs.

This Trailhead module focuses on getting predictions and improvements, which is the primary use case for Einstein Prediction Service.

Get to Know Predictions, Improvements, and Top Predictors

Let’s look at an example Einstein Discovery predictions panel on a Lightning page.

Lightning Einstein Discovery panel showing prediction name, predicted outcome, list of top predictors, and list of ways to improve the predicted outcome

This example uses Einstein Discovery to predict how soon an opportunity will close. Knowing this can help prioritize our efforts on opportunities that are likely to close within the current fiscal period.

The predictions panel shows you the key elements returned in a prediction request.

# Element Description

1

Prediction

Predicted outcome and a descriptive label. In this example, the opportunity is predicted to close in 29.5 days.  

2

Top Predictors

Conditions that contributed most strongly to the predicted outcome, including favorable and unfavorable contributions. In this example, the condition Competitor Type is Known and Route to Market is Reseller increases the predicted time to close by 2.02 days. The arrow to the left points up to indicate that this predictor increases the predicted outcome. The arrow is red (instead of green) to indicate that the effect of this predictor is unfavorable, because our goal is to minimize the time to close. 

3

How to Improve This

Suggested actions the user can take to improve the predicted outcome. In this example, the action of changing Supplies Group to Car Accessories reduces the time to close by 3.48 days, as indicated by the green arrow pointing down.

Einstein Prediction Service returns any or all of this information in response to REST API–powered prediction requests. Let’s learn more about these elements. 

Predictions

A prediction is a derived value, produced by a model, that represents a possible future outcome based on a statistical understanding of past outcomes plus provided input values (predictors). 

Let’s break this down.

  • An outcome is the business result you are trying to understand and improve. An outcome is typically a key performance indicator (KPI), such as sales margin or opportunity wins.
  • A prediction represents an output value that the model generates based on the provided input values (predictors). The model’s equation is the result of a thorough statistical analysis of past data with known outcomes, powered by machine learning and AI.
  • Although the future is unknown and uncertain, a prediction reduces that uncertainty somewhat by providing a value that falls within a calculated range of probability.
  • When it does occur, the actual outcome may differ from the predicted outcome. This is expected. We measure the accuracy of the prediction by how small or large this difference is. To learn more about prediction accuracy, see Configure Performance Monitoring for a Prediction Definition in Salesforce help.

Top Predictors

Top predictors are the conditions that most significantly drive the predicted outcome, in decreasing order of magnitude. A condition is a data value associated with a column. In Einstein Discovery, a predictor consists of one or two conditions. In the Lightning component example, Deal Size Category is 5.0 is a single condition, while Competitor Type is Known and Route to Market is Reseller is a combination of two conditions. Predictors are also known as predictor variables or independent variables.

Improvements

An improvement is a suggested action that a user can take to improve the predicted outcome. Note that the improvement affects the predicted outcome, not necessarily the actual one. Improvements are associated with variables over which users can possibly have control or influence, such as the shipping method or a subscriber’s membership level. By taking the actions that Einstein suggests, users can increase their chances of having a more favorable outcome.

What Do the Green and Red Circled Arrows Represent?

The circled arrow indicates how the predictor or suggested action influences the predicted outcome. To interpret the arrow, refer to its color and the direction it’s pointing.

Color

  • Green indicates that the predictor improves the predicted outcome.
    Green circle with arrow pointing diagonally down
  • Red indicates that the predictor worsens the predicted outcome.
    Red circle with arrow pointing diagonally up

Direction

The arrow points up or down depending on the direction in which the predictor affects the predicted outcome. For example, if the goal is to minimize the outcome:

  • A green arrow pointing down indicates that a predictor improves a predicted outcome.
  • A red arrow pointing up indicates that the predictor worsens this outcome.

In the Lightning component example, the condition Deal Size Category is 5.0 increases the predicted time to close, which is why it’s a red arrow pointing upward.

Get to Know Models and Prediction Definitions

You get predictions in Einstein Prediction Service by interacting with two resources: models and prediction definitions.

Models

A model is the sophisticated, custom mathematical construct that Einstein Discovery generates. Einstein Discovery uses a model to predict an outcome. 

A model organizes data by variables. A variable is a category of data. It’s analogous to a column in a CRM Analytics dataset or a field in a Salesforce object. A model has inputs (predictor variables) and outputs predictions for the outcome variable, along with additional information if requested. 

Predictions occur at the observation level. An observation is a structured set of data. It’s analogous to a populated row in a CRM Analytics dataset or a record in a Salesforce object. 

For each observation, the model accepts one set of predictor variables (1) and returns a corresponding prediction (2).

Illustration that shows a model accepting predictor variables as input and producing a prediction as output.

Optionally, a prediction request can include a directive to return topic predictors and improvements as well.

Models are not unique to Einstein Discovery or Salesforce. In fact, predictive models are used extensively around the world—across industries, organizations, disciplines—and they’re involved in so many aspects of everyday life. Data scientists and other specialists apply their formidable talents to designing and building high-quality models that can generate very accurate and useful predictions. 

A common challenge for many organizations, however, is that—once built—a well-crafted model can be difficult to implement into production environments and to integrate seamlessly with the operations they are designed to benefit. With Einstein Discovery, you can now quickly operationalize your models: Build them, deploy them into production, and then start getting predictions and making better business decisions right away using live data. You can even operationalize externally built models that you upload into Einstein Discovery. 

Prediction Definitions

In Einstein Prediction Service, every model belongs to a container object called a prediction definition. The following figure shows the request/response flow when making a prediction request to a prediction definition that contains a single model.

Illustration that shows a prediction request/response flow for a prediction definition containing one model 

In this example, the prediction request (1) passes predictor variables from the customer record to the prediction definition to evaluate the likelihood of customer churn. The prediction definition forwards the input data to the model (2), which calculates the prediction that is returned (3) in the response to the requestor.

A prediction definition can contain multiple models in which each model produces predictions for a different segment (subset) of your data. The following figure shows the request/response flow involving a prediction definition with three models, each of which generates predictions for a particular region.

llustration that shows a prediction request/response flow for a prediction definition containing multiple models, with distinct models per region

In this example, the prediction request (1) passes predictor variables from the customer record to the prediction definition to evaluate the likelihood of customer churn. The customer record (observation) belongs to the AMER region. The prediction definition forwards the input data to the model that handles AMER segment (2), which calculates the prediction that is returned (3) in the response to the requestor.

What Kinds of Use Cases Can Predictions Help With?

Einstein Prediction Service supports the following common business analytics use cases: 

Use Case Applies To Supported Algorithms

Numerical

Numeric outcomes represented as quantitative data (measures), such as currency, counts, or percentages.

  • Generalized Linear Model (GLM) - Linear Regression
  • XGBoost
  • Gradient Boost Machine (GBM)
  • Random Forest

Binary Classification

Binary outcomes with only two possible results, represented as text data. These are typically yes/no questions that are expressed in business terms, such as churned or not churned, opportunity won or lost, employee retained or not retained, and so on. For analysis purposes, Einstein Discovery converts the two values into Boolean true and false.

  • Generalized Linear Model (GLM) - Logistic Regression
  • XGBoost
  • Gradient Boost Machine (GBM)
  • Random Forest
Multiclass Classification Predict probable outcomes from 3 to 10 categories. For example, a manufacturer can predict, based on customer attributes, which of three service contracts a customer is most likely to choose.
  • XGBoost
  • Gradient Boost Machine (GBM)
  • Random Forest

In the next unit, you build and deploy a model that implements a numerical use case.

Produce and Consume Models

When working with Einstein Prediction Service, it’s helpful to think of two main activities:

  • Producing a model involves using CRM Analytics Studio to build and deploy the model in Salesforce. In order to predict customer churn, for example, someone needed to provide the model that predicts whether a customer is likely to go or stay. The next unit walks you through the steps of creating and deploying a model.

  • Consuming a model involves using the deployed model to generate predictions and improvements for your data. Our customer churn example used a Lightning page to display prediction, top predictors, and improvements. In the last unit, you learn to get the same information using your favorite REST client and Einstein Prediction Service.

Get Predictions Declaratively or Programmatically

You can get predictions from Einstein Prediction Service in two key ways:

  • Declaratively in automatic prediction fields, the PREDICT function in process automation formulas, the Discovery Predict transformation in Data Prep Recipes, the Einstein Discovery action in Salesforce flows, and in Einstein Discovery in Tableau.
  • Programmatically using APEX and REST APIs

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback