<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Salesforce Einstein Platform - Medium]]></title>
        <description><![CDATA[With the Salesforce Einstein Platform, you can quickly build custom-AI powered apps. Check out these blogs to understand how to get started with and use Einstein. - Medium]]></description>
        <link>https://medium.com/salesforce-einstein-platform?source=rss----f027af6d70f1---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Salesforce Einstein Platform - Medium</title>
            <link>https://medium.com/salesforce-einstein-platform?source=rss----f027af6d70f1---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 17 May 2026 10:15:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/salesforce-einstein-platform" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[How to Score Records You Used as Examples: Predicting Upsell and LTV in Einstein Prediction Builder]]></title>
            <link>https://medium.com/salesforce-einstein-platform/how-to-score-records-you-used-as-examples-predicting-upsell-and-ltv-in-einstein-prediction-builder-bdfb567ca90a?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/bdfb567ca90a</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 21:49:04 GMT</pubDate>
            <atom:updated>2020-06-30T21:49:04.054Z</atom:updated>
            <content:encoded><![CDATA[<p>by Anastasiya Zdzitavetskaya, Director of Product Management, Salesforce</p><p>When building a prediction with Einstein Prediction Builder, sometimes the records you want to use as examples (your historical data) are the same records you want to create predictions for. Think of this as the example set/prediction set overlap problem (or training set/scoring set overlap). Typical predictions that fall into this category include customer attrition, lifetime value, high-value customers, and upsell. <br> <br>Here are two ways to address the overlap problem: (1) the time horizon approach, and (2) the randomization (two-segment) approach to create your predictions. In the Summer ’20 release, you’ll be able to use filters to explicitly define your prediction set. This feature makes the randomization approach unnecessary because you can choose to use the same records in your example set and prediction set. Read more about this in the <a href="https://releasenotes.docs.salesforce.com/en-us/summer20/release-notes/rn_forcecom_einstein_prediction_builder_define_prediction_set.htm">release notes</a>!<br> <br>Read on to understand when to choose the time horizon approach versus the randomization or prediction set filters approach. Use the Prediction Definition Framework described<a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-for-opportunity-scoring-a2c8e8921d0a"> in this blog</a> to think through the upsell and high-potential customer use cases, and see which approach works best in each case and why.</p><h3>Upsell use case with the time horizon approach</h3><p>Every company wants to know whether its customers are likely to buy another product or service. This type of prediction is an upsell or cross-sell problem. The goal isn’t to recommend the right product (which is a different class of machine learning problem), but rather to predict how likely a customer is to buy additional products.<br> <br>Defining your example set can be tricky. Positive examples are easy to identify: any customers who bought two or more products. But what about negative examples? For each customer who bought only one product so far, you have to determine whether this customer <strong>has not bought</strong> an additional product <strong>yet </strong>(and thus belongs to<strong> </strong>the<strong> </strong>prediction set) or whether they <strong>will never buy</strong> any more products (and becomes a negative example). In this particular example, set/prediction set overlap problem, you need to differentiate between records to score and negative examples.<br> <br>To determine the right time horizon to use, create a report, and identify how long it normally takes for customers to buy a second product after the initial purchase. In this case, it’s six months. <br> <br>The Avocado Framework for this problem might look like this:</p><ol><li><em>Dataset</em>: All standard customer accounts.</li><li><em>Positive Examples</em>: Accounts with two or more products.</li><li><em>Negative Examples</em>: Accounts with only one product and more than six months since the purchase date. For the sake of this prediction, assume they will never buy again. You’ve given up on them because historically, other customers made their second purchase much sooner than six months since the first purchase.</li><li><em>Records to Predict/Score (Prediction set)</em>: Accounts with only one product and less than six months since the first purchase date. Since they’re still in the green zone (they can potentially make their next purchase soon), create a prediction for these customers.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5VW0O887ILVnioeJbd-lLw.png" /></figure><p>Here’s how to set it up with filters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rmo6WWQjQsrff50U9JLXmg.png" /></figure><p>To set up the upsell problem in Prediction Builder, select the <strong>No Field</strong> option and use the Yes and No example filters to define the logic:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Rc0uSsgXywlVEdzqM47jQ.png" /></figure><p>Negative examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x24JcLr6ncvKFoUzYhVxdA.png" /></figure><p><strong>Tip:</strong> One of the conditions involves dates with the comparison: <strong>Purchase Date Less than Comparison Now () Minus 180 days. </strong>In this context, <strong>Less than</strong> means <strong>Earlier than</strong>. Thus, Purchase Date has to be anytime before 6 months ago (for example, 7 months ago or 1 year ago).<br> <br>In summary, use the time horizon approach if you can confidently define the time horizon to separate between negative examples (“write-offs”) and records to score (“undecided” but with good potential). <br> <br>Salesforce recommends using the time horizon approach for attrition use cases. Instead of predicting whether the customer will ever attrit, you can predict if the customer is likely to attrit within the first year of becoming a subscriber or buying your product, for example. <br> <br>What if there is no well-defined period? Then you can try the second approach: create two or more predictions on randomized segments of your data. Or, in the Summer ’20 release, use filters to define your prediction set.</p><h3>High-value customers use case with randomization or prediction filters.</h3><p>Let’s say we want to predict high-potential customers: those who are likely to spend more than $X during their lifetime. The actual value of $X depends on your business. You can create a report and see what represents the top-spending 10% of your customers. This is your high customer threshold. In our example, it is $500. <br> <br>The challenge with this prediction is that it’s very difficult to differentiate between negative examples and records to score. If they haven’t spent $500 yet, does it mean they never will (thus becoming your negative examples)? Or that they haven’t yet reached this $500 threshold, but eventually they will? This is another instance of the <strong>negative examples and prediction set overlap problem.</strong><br> <br>In general, it’s better to use a time horizon approach and identify which customers are likely to spend more than $500 within some specific timeframe, as described above. For example, you can create a report and identify how long it takes for the majority of your customers to reach this $500 threshold. Let’s assume it is 6 months. Then our negative example set will include customers who have not reached this $500 threshold within 6 months. This will probably provide better predictions than the randomized approach described below because your negative examples are much more aligned with the negative behavior — customers not spending $500 within their lifetime.<br> <br>Alternatively, you can create a numeric prediction, predicting Future Lifetime Value (LTV) for each customer. In this case, you want to use all records as examples (learning from all existing customers’ spending history) and predict for all records (estimate Future LTV for all customers). This is another <strong>example set, and prediction set overlap problem.</strong></p><h3>Two-segment randomized approach</h3><p>Until there is support, for example, set/prediction set to overlap, use the following approach as a workaround. <br> <br>Use two randomly created segments to differentiate between the example (training) set and the prediction (scoring) set. Build two predictions: one trained on Segment 1 and predicting for Segment 2, and the other one trained on Segment 2 and predicting for Segment 1.</p><h3>Prediction Definition Framework — high-potential customers</h3><p>For this use case, the Avocado Framework looks like this:</p><ol><li><em>Dataset</em>:<em> </em>All customer accounts.</li><li><em>Positive Examples</em>: Customers who spent more than $500.</li><li><em>Negative Examples</em>:<em> </em>Customers who spent less than $500 and are in Segment 1.</li><li>Records to <em>Predict/Score</em>: Customers who spent less than $500 and are in Segment 2.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dTx3qnb_OLi22P1jpBICGw.png" /></figure><p>Use two randomly created segments to differentiate between example and prediction sets. Using the formula below, we randomly assign customers to Segment 1 or Segment 2 (basically, we are creating an odd or even segment in our data based on some number field):<br> <br>IF(MOD( INDEX_c , 2) == 0, “Segment1”, “Segment2”)<br> <br>Now for the final setup using filters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tIht7s-058wAMPBXw4kI3A.png" /></figure><p>Then create a second prediction, with customers in Segment 2 as the negative examples, and predicting for customers in Segment 1.</p><h3>Using Prediction set filters</h3><p>When the new prediction set feature is available, you can use prediction set filters to explicitly define records to score. This allows the example set and prediction set to overlap.<br> <br>To predict LTV, select “Score only records that are in the example set,” which creates predictions for all records that you used as examples (the example set and the prediction set fully overlap). <br><br>For the customer attrition and high potential customer use cases (negative examples and prediction set overlap), select “Score specific records” and use filter logic to exclude positive examples. In these scenarios, positive examples are easily identifiable (customer attritted or reached a high-value threshold) and don’t need to be scored. Basically, you score everyone, except for the customers who have already attrited or reached a high-value customer threshold. And the same records are used as negative examples and records to score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xTnHfvsbFRDBefAcH8-xIQ.png" /></figure><h3>How to use your predictions to improve business outcomes</h3><p>Incorporate these predictions in your business process to streamline resource management and automation:</p><ul><li>Double your efforts on customers who are more likely to buy another product or achieve high LTV. To identify these customers, create a new list view and sort by scores (either the likelihood to buy or achieve high LTV), so sales reps can prioritize customers with the highest potential. You can also review customers in the middle range (those are your borderline opportunities) and identify steps to get them back on track. Perhaps, you can add them to the appropriate marketing campaign.</li><li>Automate creation and allocation of tasks to focus the Sales and Services team on the high potential customers. You can use <a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Process Builder to automate task creation</a> for prioritized customers.</li><li>Show the top predictors for each customer, so your business users can see reasons behind these predictions. Just add the <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_top_predictors_setup.htm&amp;type=5">Einstein Predictions</a> lightning component to the Account layout page and select the name of your prediction.</li><li>Use <a href="https://trailhead.salesforce.com/en/content/learn/modules/einstein-next-best-action">Einstein Next Best Action</a> to provide the right recommendations to the sales reps for each customer based on the predictions and business rules. You can get an idea of what to recommend for each customer based on the top predictive factors in the scorecard.</li></ul><p>For more information about the prediction lifecycle, please review <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">this blog</a>.</p><h3>Summary</h3><p>If you encounter a situation where you want to score records that you used as examples, first evaluate if you can use the time horizon approach to separate between negative examples (“write-offs”) and records to score (“undecided,” but with good potential). If this is not possible, use the randomization approach or prediction set filters approach (available in the Summer ’20 release).<br> <br>For more on the latest when planning your prediction, check out the official <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_plan.htm&amp;type=5">Salesforce documentation</a>.</p><h3>Related Blog Posts</h3><ol><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">How to turn your Idea into a Prediction</a></li><li><a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-for-opportunity-scoring-a2c8e8921d0a">How to use Einstein Prediction Builder for Opportunity scoring.</a></li><li><a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-to-predict-opportunity-amounts-1d19d89b2c58">How to Use Einstein Prediction Builder to Predict Opportunity Amounts</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">Which fields should I include or exclude from my model?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">Understanding your Scorecard Metrics</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">Understanding the Quality of Your Prediction</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">A Model That’s Too Good to be True</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c">How do I know if my prediction is working?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Custom Logic on Predictions from Einstein Prediction Builder</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdfb567ca90a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/how-to-score-records-you-used-as-examples-predicting-upsell-and-ltv-in-einstein-prediction-builder-bdfb567ca90a">How to Score Records You Used as Examples: Predicting Upsell and LTV in Einstein Prediction Builder</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Journey of Your Data]]></title>
            <link>https://medium.com/salesforce-einstein-platform/the-journey-of-your-data-54d208e60f6e?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/54d208e60f6e</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 21:48:15 GMT</pubDate>
            <atom:updated>2020-06-30T21:48:14.958Z</atom:updated>
            <content:encoded><![CDATA[<p>by Nico de Vos, Lead Member of Technical Staff, Salesforce</p><h3>Introduction</h3><p>The power of Einstein Prediction Builder is how effortlessly it lets you bring your ideas into production, letting it leverage your valuable data to create predictions and new insights. We have written before about the user’s role in coming up with and creating a prediction (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205</a>), but what is the behind-the-scenes magic that makes things happen from there? In this blog post, I want to go into some detail about how the data flow and are transformed through the software backend to help you gain a deeper understanding and appreciation of our product.</p><h3>Salesforce and Einstein Platform</h3><p>All data you enter in Salesforce is safely and securely stored in certain formats, ready to be consumed by various Salesforce products, most notably the UI that lets you see your data. Like most applications that do analytics or use machine learning, however, Einstein Prediction Builder can work more efficiently if these data are in a different, specialized format more suitable for large-scale processing. For this reason, the data are Extracted, Transformed, and Loaded (ETL) (<a href="https://en.wikipedia.org/wiki/Extract,_transform,_load">https://en.wikipedia.org/wiki/Extract,_transform,_load</a>) into a dedicated software platform called the Einstein Platform. Einstein Prediction Builder is just one of the products running on this powerful platform. Note that the flow described below refers to Einstein Prediction Builder specifically and not to all Einstein functionalities.</p><h3>The flow of data and user actions</h3><p>The following diagram gives a bird’s eye view of what happens to your data between Salesforce and the Einstein Platform and how it ties in with the actions you take in the Einstein Prediction Builder UI. It leaves out many important software components in order to clearly explain the gist of things. Let’s walk through the components before we dive into the specifics of the machine learning flow later on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*itK2Hr6gbNbHLgBFIppeiA.png" /></figure><ol><li>Suppose you create a binary classification (Yes/No) prediction that predicts whether your sales opportunities are likely to be won (following the example from our previous blog post here: <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac</a>).</li><li>After you create the prediction, a snapshot of all relevant data (e.g., the fields you selected as features and the target field that holds information about whether the opportunity was eventually won or not) is pulled into the Einstein Platform.</li><li>A machine learning model will be trained on the labeled opportunity data to learn patterns in the data. We will go into more detail on this step below. Also, for an introduction to machine learning that explains these concepts in more detail, see our previous blog post (<a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942</a>).</li><li>Several indicators of the quality of the trained model are saved, along with insights into what features the model deems important for predicting whether opportunities could be won or not. These populate the metrics and visualizations of the scorecard, which we discussed in a previous blog post (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b</a>).</li><li>When you approve a model in the Salesforce UI, the Einstein Platform will register this approval and activate the model.</li><li>Immediately after approval, the previously trained model is fed the unlabeled data, and it then produces a score per record that is the predicted likelihood of the opportunity being won.</li><li>These scores are then saved in the prediction field that you configured during the creation of the prediction.</li></ol><p>After the model is activated in step 5, the training and scoring cycles repeat periodically (currently monthly and hourly, respectively).</p><ul><li>Training loop (steps 2 to 4): the machine learning model is re-trained on the latest data that has received labels, and the scorecard in the UI is again updated with results from this latest re-training.</li><li>Scoring loop (steps 2, 6 and 7): the Einstein Platform will check if there are new or updated records for which predictions need to be made. If so, scoring on those records is performed, and scores are saved.</li></ul><h3>Inside the machine learning black box</h3><p>Now that the big picture of how data flows and how user interactions play out is clear, we can come to the heart of things and have a closer look at the most fascinating part: the machine learning pipeline. In this pipeline, data are transformed in various ways in order to distill the insights living in your data into a useful model that can make good predictions on new records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*zOZrBi9Uqstge4XORwGqZw.png" /></figure><h3>Data preparation</h3><p>The data preparation step makes sure that all subsequent steps have clean data to work with. This means removing features (the fields you selected as inputs for the prediction) if they have attributes that are undesirable in a machine learning context. See our blog post introducing machine learning (<a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942</a>) for details on what is considered undesirable.<br> <br>Examples of things to look out for include:</p><ul><li>Not enough data: we remove features that have too many missing values in the training or initial scoring data.</li><li>The labeled training data looking markedly different from the unlabeled scoring data. For example, we look at the difference in their distributions and their fill rates. These are indicators that a field started being used differently, for example, because of a migration of old data from another CRM into Salesforce. This can be problematic for machine learning models, and therefore is ground for getting rid of the feature.</li></ul><p>The data preparation step also breaks off the flow if, after all this cleaning, there are not enough features or records left to build a useful model. Users get alerted of such situations in the frontend with an appropriate error message.</p><h3>Feature Engineering</h3><p>You store data in Salesforce in (custom) fields that suggest a certain type of data: TextArea, Date, Number, Email, etc. One of the things we are most proud of is that we let our software leverage that metadata to do smart, automated feature engineering. Feature engineering is the process of transforming your original data in ways that make the information in them more readily discoverable by a machine learning algorithm. That sounds abstract, so let’s go through a few examples together.<br> <br>Let’s say you chose the following 4 fields as inputs to your opportunity prediction:</p><ul><li>“Contract size” (Currency field, in $ per year)</li><li>“Subscription type” (Picklist field, with values “Trial” / “Annual” / “Lifetime”)</li><li>“Last interaction” (Date field)</li><li>“Customer sentiment” (TextArea field with some notes from your salespeople)</li></ul><p>Now because “Contract size” is a number, our feature engineering step will explore some options for transforming the data to extract more value. For example, it will use machine learning techniques to try to smartly divide these numbers into a number of buckets. Say you have the list of customers shown in the following figure. It is a huge help for most algorithms to have a feature that groups them by their relative contract size. All this is done automatically for any numerical feature!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*JexVg4---CeoDW0d44uk_g.png" /></figure><p>Both the output of the bucketization process above and the “Subscription type” are categorical, i.e., the data can take one of a limited number of possible values. In order for this data to be consumable by a machine learning algorithm, they are encoded in a different way, as seen here:<br> <br><em>Before</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*xeYxglhBiT_pJmDTY_vgTw.png" /></figure><p><em>After</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*sKrK9pnJ4TGLKqsvbjIbxg.png" /></figure><p>Note that if the number of possible entries is extremely large, this will result in an extremely large number of columns. This might confuse an algorithm, so sometimes we have to be judicious and only choose the categories that occur most frequently.<br> <br>“Last interaction” is a date field, so there is a range of possible interesting transformations to be done. For example: we extract the day of the week, the month of the year, the year, the number of days between two dates, and more. We have written before about the complications of date fields, and if you are (considering) using them in your predictions, we strongly recommend you to read that post (<a href="https://medium.com/salesforce-einstein-platform/complication-with-dates-v2-2d93bc52edec">https://medium.com/salesforce-einstein-platform/complication-with-dates-v2-2d93bc52edec</a>).<br> <br>Lastly, and most interestingly, the “Customer sentiment” field. Because this is a freeform text field in which the salespeople can write anything they want, it is (1) a potential treasure trove for predicting the outcome of opportunities, and (2) the most complex field to automatically transform. We use a variety of natural language processing (NLP, <a href="https://en.wikipedia.org/wiki/Natural_language_processing">https://en.wikipedia.org/wiki/Natural_language_processing</a>) techniques to extract signals from text fields to then feed into our models. Since NLP is a deep and fast-moving field of machine learning, it is an active research subject for us. We frequently experiment with state-of-the-art methods such as pre-trained word embeddings, sentiment analysis, and neural networks for engineering features that are both useful for modeling and human interpretability.<br> <br>At the core of all the transformations above (and many more!) is a state-of-the-art software library called TransmogrifAI, which we have open-sourced: <a href="https://github.com/salesforce/TransmogrifAI">https://github.com/salesforce/TransmogrifAI</a>.</p><h3>Feature selection</h3><p>Our feature selection step is partly about choosing the most promising features with high information content, and partly about dropping features that are “too good to be true.” We have written before about the problem of “label leakage,” where during model training there is information in the input that contains information about the expected output, leading to an unhelpful model that does not perform well without this information when it is time to make predictions (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e</a>, <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac</a>).<br> <br>Salesforce data scientists spend considerable effort in building ways to automatically detecting these so-called “leakers” using a lot of fancy mathematics. In essence, we remove features that are too strongly related with the label. We use a variety of correlation measures that can suggest such relations for different types of data. Imagine you would have a “Date that contract was signed” feature in the opportunity example. Our software would pick up on the correlation between that and the target “Opportunity was won” label and remove it from the feature set.<br> <br>One conclusion here is that even if a user accidentally includes leakers in the fields available to the prediction, this step will likely remove them from the training data. On the other hand, users will need to remain vigilant about introducing leakers since this is a very difficult problem for which there is no perfect automated solution.</p><h3>Finding the best model</h3><p>Next, we are ready to train some machine learning algorithms to capture the relationships in the data. These mathematical techniques come in various flavors such as linear regression methods (<a href="https://en.wikipedia.org/wiki/Linear_regression">https://en.wikipedia.org/wiki/Linear_regression</a>, <a href="https://en.wikipedia.org/wiki/Generalized_linear_model">https://en.wikipedia.org/wiki/Generalized_linear_model</a>, <a href="https://en.wikipedia.org/wiki/Logistic_regression">https://en.wikipedia.org/wiki/Logistic_regression</a>), decision-tree-based methods (<a href="https://en.wikipedia.org/wiki/Random_forest">https://en.wikipedia.org/wiki/Random_forest</a>, <a href="https://en.wikipedia.org/wiki/Gradient_boosting#Gradient_tree_boosting">https://en.wikipedia.org/wiki/Gradient_boosting#Gradient_tree_boosting</a>), etc. These algorithms all come with different knobs to tweak their performance in various ways.<br> <br>We let the various candidate algorithm compete in a tournament, while optimizing their various knobs, and we store the best-performing models for when we need to make predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*5-0Y4ROdItIKwTurV1T_fQ.png" /></figure><h3>Calculating metrics</h3><p>Finally, a wide variety of metrics are calculated and stored after training. These are used to populate the scorecard in the Einstein Prediction Builder UI, where you can explore them. There are separate groups of metrics for:</p><ul><li>Numerical predictions, for which we want to express how close the predicted numbers were to the real numbers. Example: R-squared (<a href="https://en.wikipedia.org/wiki/Coefficient_of_determination">https://en.wikipedia.org/wiki/Coefficient_of_determination</a>).</li><li>Yes/No predictions, for which we want to express how often a model correctly predicted the Yes/No situation. Read our blog post about understanding the quality of your prediction for more details about such metrics (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e</a>).</li></ul><h3>Back to you</h3><p>The results of the above machine learning flow are:</p><ul><li>A trained model, standing by and ready to be used for predictions.</li><li>A set of metrics and insights into the model visualized on the Scorecard.</li></ul><p>Now it’s up to you, the user, to determine whether the model seems to achieve the goals you had in mind (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e</a>). It’s time to consider whether the expected prediction quality in your Scorecard makes you feel the model will do a good job. Or is the expected performance suspiciously high, and you are worried that you might have included leakers? In any case, check the scorecard for feature importances and see if anything stands out. You might learn something new about your data!<br> <br>If everything looks good, you can go ahead and approve the model. As shown in “The flow of data and user actions” above, approval of the model means it will start producing predictions on new and updated records. The model will also be periodically updated so that it can learn things from the latest data.</p><h3>Summary</h3><p>Even in this brief glimpse behind the scenes of Einstein Prediction Builder, we can already see that there are a lot of moving parts, from the flows of data to the intricacies of machine learning algorithms. Rest assured, there are a lot of great people continuously greasing the wheels and maximizing the value you can get out of your data.<br> <br>I hope you enjoyed learning something about the Einstein Prediction Builder secret sauce, and have a regained appreciation for what it takes to take machine learning into production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54d208e60f6e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/the-journey-of-your-data-54d208e60f6e">The Journey of Your Data</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trusted AI: Finding Bias in Your Data]]></title>
            <link>https://medium.com/salesforce-einstein-platform/ep-trusted-ai-blog-finding-bias-in-your-data-3df0f057fd19?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/3df0f057fd19</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Thu, 21 May 2020 18:51:51 GMT</pubDate>
            <atom:updated>2020-05-28T21:22:23.866Z</atom:updated>
            <content:encoded><![CDATA[<p>by Sohom Paul, Associate Product Manager, Salesforce</p><h3>Welcome to Trailhead University</h3><p>Imagine a university, say <em>Trailhead University</em>,<em> </em>is using machine learning to optimize its student counselors’ workloads. Rather than have its counselors spend time convincing each and every student to accept their admissions offers, the university wants counselors to focus on the most likely ones. Now, <em>Trailhead University </em>can reinvest these productivity gains into personally reaching out to students who are likely to matriculate.<br> <br>How would they go about building an accurate predictive model? To predict the likelihood of a student matriculating, Einstein needs to be trained on examples of both students who accepted their offers and students who declined their offers. Let’s assume the training data looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSjjAVeckvGiWywgO9akwg.png" /></figure><p>If the university isn’t careful with its “training data,” it may unintentionally discriminate against some of its prospective students. In other words, the model may be biased. As seen in our previous blog (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">Einstein Prediction Builder: Thinking Through Predictions with Bias in Mind</a>), we define bias as: <em>to</em> <strong><em>wrongfully </em></strong><em>impose a </em><strong><em>relative disadvantage </em></strong><em>on persons </em><strong><em>based on</em></strong><em> their membership in some </em><strong><em>salient social group, </em></strong><em>e.g., race or gender. </em>The bottom line is: If your model is trained on “biased” data, its results will also be “biased.”<br> <br>Before we dive into the four causes of bias, spend some time analyzing the above dataset. Ask yourself questions like:</p><ul><li>“Which groups here are advantaged vs. disadvantaged?”</li><li>“Does the distribution of matriculating vs. non-matriculating students look equitable across the advantaged and disadvantaged groups?”</li><li>“How may utilizing training data like this impact my model’s outputs, and accordingly, my stakeholders?”</li></ul><p>Now that you’ve answered some of these questions, you’ve already accomplished the first step (of many) towards building a fair predictive model!</p><h3>Four Causes of Bias in Data</h3><ol><li><strong>Sample Bias</strong></li></ol><p>First off, your training data must be representative of your broader population. E.g., If you’re striving for a diverse class, you need to start reaching out to more groups of students. Since your model has been trained on two types of students, it’s bound to make inaccurate (and perhaps unfair) predictions on types of students it’s never seen before. E.g., Students with disabilities and male students of color aren’t represented in your sample. Hence, you’ve fallen for sample bias.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9eXh_NaUaclHrIfTejTpdQ.png" /></figure><p>2. <strong>Data Imbalance</strong></p><p>Your data has 2 times more men than women, which is likely to skew the model’s outputs towards men. This is a common problem in machine learning because data is rarely balanced. E.g., If you’re making a prediction on the state of California, its most populated cities (like Los Angeles and San Francisco) are bound to dominate the dataset. While techniques like upsampling and downsampling may help balance the datasets, we recommend exploring ways (as in the case of Sample Bias) to improve your marketing, outreach, and messaging towards broader groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GwKF1zooerCS9FIbOuUKHg.png" /></figure><p>3. <strong>Treatment Disparity</strong></p><p>Among men, 75% matriculate. Among women, 16.67% matriculate. Although that’s a staggering difference, Treatment Disparity doesn’t always imply bias. Perhaps one group is more qualified or has more opportunities to succeed than the other. That said, if you notice that men receive a much higher relative % of matriculation than women do, they should also have higher campus visitation rates and demonstrate better cultural fit to support that difference. When in doubt, compare both groups quantitatively and qualitatively. Chances are, huge treatment disparity is hard to explain and therefore implies bias. <br> <br><em>Food for thought: Even if men can “explain” their higher relative matriculation rates (through higher campus visitation rates, for example), it’s important to consider that men may also have more opportunities for success than other disadvantaged groups. Thus, Trailhead University may choose to pursue disadvantaged groups at higher rates to achieve equity in the long-run. E.g., Affirmative Action.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OPoct3mnW5wGAcfRDHpZkQ.png" /></figure><p>4. <strong>Outcome Disparity</strong></p><p>In the Treatment Disparity example, we see that 75% of men accept their offers, while 16.67% of women accept their offers. If there were an equal number of men and women, then men would matriculate 4.5 times more than women [math check: 0.75/0.1667 ≈ 4.5]. However, our dataset has twice as many men as women, which means that overall, 9 times more men than women matriculate! See how Data Imbalance can multiply the effects of Treatment Disparity to form Outcome Disparity? Outcome Disparity may, yet again, be explained by statistical differences, but it’s up to you to investigate how your business processes lead to these differences in the first place. At the end of the day, your models are training on this label [accepted offers vs. declined offers]. It’s relatively self-explanatory that the model will, by default, favor men over women in its predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGmZIWDJKKvjYpJytyeJgQ.png" /></figure><h3>Watch out for Proxy Bias</h3><p>Referring to the diagram below, what are sensitive fields? Coming back to our definition of bias, sensitive fields are <strong><em>personal attributes</em></strong><em> that </em><strong><em>define</em></strong><em> a person’s membership in some </em><strong><em>salient social group,</em></strong><em> e.g., ethnicity or gender. </em>Now, what are related fields? Related fields serve as proxies (hence why we call this Proxy Bias) to sensitive fields, i.e., they are correlated to or are predictive of sensitive fields. Let’s see an example of this below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*9qODUjcprV3rYvbSF2ltvw.png" /></figure><p>What related fields can you derive from a person’s name?</p><ol><li>Gender (common male first names: James, John, Robert; common female first names: Jennifer, Susan, Lisa).</li><li>Ethnicity (common Vietnamese last name: Nguyen; common Indian last name: Patel).</li><li>Religion (common Muslim last name: Khan).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*X_dHwl75eQvKNQe9z0FWkQ.png" /></figure><p>Even if you remove sensitive fields like Gender, Ethnicity, and Religion but include the related field Name, bias will be captured subliminally in your models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*7Lq0egl9EMudlTfnzIlVsw.png" /></figure><p>The same goes for common related fields like Salutation and Postal Code. However, sensitive and related fields aren’t limited to these basic ones we’ve listed here. They vary based on industries, use cases, and specialties. E.g. In Banking, a loan applicant’s source of income can drastically impact their probability of receiving a loan, but that may not be the case in an industry like Healthcare.</p><h3>Now what?</h3><p>So you’ve identified all the types of bias in your data. Now what? Can we flip a switch on our iPhones?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*X_zVgs7IwuQrxIaO_fs7IQ.png" /></figure><p>Maybe that’s too easy, how about some code?</p><pre>import library fairness // use function makeDataFair()<br>fairData = makeDataFair(biasedData) // problem solved!</pre><p>Unfortunately, this is a complex issue, and there is no simple, “magical” solution. Bias is a systemic problem that exists because we are imperfect humans living in an imperfect society. The process of bias mitigation is hard work, but it all starts with knowing whether a problem exists. So here’s our advice to you:</p><ol><li>Start with the 5W’s of Data Quality and Accuracy (see Kathy Baxter’s framework here: <a href="https://medium.com/salesforce-ux/dirty-data-or-biased-data-6d55db6b5dc6">Dirty Data or Bias Data?</a>)</li><li>Follow up on each of these questions with data visualizations that uncover the biases we discussed here.</li><li>Take your findings with a grain of salt — again, just because you see treatment and outcome disparities doesn’t mean you necessarily have bias. While comparing each of your groups, question your findings (refer to Natalie Casey’s business expert questions: <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">Einstein Prediction Builder: Thinking Through Predictions with Bias in Mind</a>).</li><li>Once you find potential areas of bias, spend time introspecting on how your business processes impact your data.</li><li>Lastly, think of ways you can change your business processes to achieve parity across groups. Perhaps, run marketing campaigns to attract more disadvantaged groups to your application funnel. Or build new products that cater to those groups. At the end of the day, your models are only as fair as your data is. And your data is only as fair as the business processes which generate them.</li></ol><p>Good luck. And remember, Einstein’s here to help you through these challenges!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3df0f057fd19" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/ep-trusted-ai-blog-finding-bias-in-your-data-3df0f057fd19">Trusted AI: Finding Bias in Your Data</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Einstein Prediction Builder for Opportunity Scoring]]></title>
            <link>https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-for-opportunity-scoring-a2c8e8921d0a?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/a2c8e8921d0a</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Thu, 07 May 2020 20:28:54 GMT</pubDate>
            <atom:updated>2020-05-11T22:22:24.060Z</atom:updated>
            <content:encoded><![CDATA[<p>by Anastasiya Zdzitavetskaya, Director of Product Management at Salesforce</p><p>One of the most useful predictions you can create for your business is predicting the likelihood of winning an opportunity (opportunity scoring). The higher the score, the more likely this opportunity is to reach the “Closed Won” stage. Next, you will probably want to know what amount this opportunity will close for — which we discuss in <a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-to-predict-opportunity-amounts-1d19d89b2c58?source=collection_home---6------1-----------------------">this blog</a>. These predictions are very important, since they can affect three important KPIs — revenue, win rate and accuracy of forecasting. This blog describes how to define a use case, gather requirements, think through the problem definition and set up this prediction with Einstein Prediction Builder.</p><p><strong>Defining a Use Case</strong></p><p>Let’s look at a sample of the <a href="http://res.cloudinary.com/hpzj96m68/raw/upload/v1540844846/Einstein_Use_Case_Worksheet_urzvhm.pdf">Einstein Use Case Worksheet</a>. The worksheet helps walk you through some key concepts:</p><ul><li>What questions does your organization need to answer?</li><li>What’s a good future to aim for?</li><li>What value are we going to drive?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HGCSgARIHjL5KzVP3tmqg.png" /></figure><p><strong>Gathering Requirements</strong></p><p>Now that we have identified your use case, let’s gather more requirements to ensure that you:</p><ul><li>Build the right solution</li><li>Identify key stakeholders</li><li>Verify that you’re collecting relevant metrics and KPIs</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cK1bKzFCIdw2XrY9A4Eh5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jGsmdiEhbQ9YNjIci5iU4w.png" /></figure><p><strong>Planning Your Prediction</strong></p><p>To think through the relevant data to support these use cases, you can use the avocado framework (shown below), which aligns with the steps in the Prediction Builder wizard — you start with selecting an object, then decide if you want to focus on a segment and provide examples for Einstein to learn from.</p><ol><li><strong>Dataset</strong> — <em>all records on the Opportunity object. Even though the dataset contain ALL opportunities, you can focus on a specific segment of data and exclude irrelevant opportunities — i.e. those in qualification stage. (Note, you can also use segmentation if you want to focus on a particular type of records — i.e. create a prediction for Enterprise Opportunities only)</em></li><li><strong>Positive</strong> <strong>Examples</strong> — Are there any data examples that are showing the behavior you <em>want</em> to find? <em>In the Opportunity Scoring example, you’re looking for won opportunities. They reached Closed Won stage.</em></li><li><strong>Negative</strong> <strong>Examples</strong> — Are there any data examples that are showing behavior <em>opposite</em> of what you want to find? <em>In the Opportunity Scoring example, these are lost opportunities. They reached Closed Lost stage.</em></li><li><strong>Records to Predict/Score</strong> — What records do you <strong>not</strong> <em>currently</em> know the outcome for, but would like to predict? <em>In the Opportunity Scoring example, these are the opportunities in any other stages, since you do not know the outcome and you want to predict which ones are more likely to be won so you can prioritize these opportunities.</em></li></ol><p><em>Fun fact: if you are wondering why it is called “Avocado”, here is your answer — the image below looks like a ripe avocado with a pit inside.</em><br> <br>While every org may be a little different, enter information according to what the different data buckets would look like in your org.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*319L5OA5Wp_Ez32W-aQG1Q.png" /></figure><p><strong>Tip for Defining Your Prediction Set</strong></p><p><em>You do not have to explicitly specify which records to score since all records remaining in your segment after example filters are applied will automatically become your prediction set: </em><br><em>Segment records — example set = prediction set (or records to score). </em><br> <br>Be sure to use the data checker in Einstein Prediction Builder to make sure you have the correct number of records, including positive examples, negative examples and records to score. You can also use reports to verify this, if in doubt.<br> <br> The diagram below illustrates the final setup:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abnTn7nc-zzOrbk6ZrbcGw.png" /></figure><p><strong>Setting Up Your Prediction with Filters in Einstein Prediction Builder</strong></p><p>With the <a href="https://medium.com/salesforce-einstein-platform/outline-74a8a5eb83a">Spring ’20 release of Prediction Builder</a>, you can set up your prediction without an explicitly defined field to predict. With opportunity scoring, we want to predict the likelihood of an opportunity to reach “Closed Won” stage, but we do not have a checkbox field to represent this outcome. In this case, we can use special filters to specify what outcome is considered positive and what outcome is negative. <br> <br> This is how we can set this up with Prediction Builder<em>:</em></p><p>1. Select the object you’d like to make a prediction on — Opportunity.</p><p>2. Define your segment using the filter under “Want to focus on a particular segment in your dataset?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sfpr9KWupHlnL7JFvcsQJA.png" /></figure><p>3. We are answering the question “Will this Opportunity be won?”, so we need to select “Yes/No” type for prediction.</p><p><em>Note: the prediction will return a number which corresponds to the likelihood of winning an opportunity, but this is still considered a Yes/No prediction.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHgdEmdI6i_mHzT2j_Ib_g.png" /></figure><p>4. We do not have a custom field created that stores the outcome of opportunities closed won, but we have a picklist instead (such as Stage: Closed Won, Closed Lost, New, Quoted, etc), so we select the “No Field” option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kbCA1Pua7Ko72Cha-wXFg.png" /></figure><p>5. Next, we need to define positive and negative examples using the “Yes” example and “No” example filters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ly9i-sRdDRG2Gy0IC-dBYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0OC4CxWaNUTp0fP4UwcHA.png" /></figure><p>6. Include relevant fields. We recommend including all fields as you might get some unexpected insights; however, there are a few exceptions discussed in <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">this post</a>.</p><p>7. Pick the name of the field where your predictions will be stored. This is the field that will represent the opportunity score or the likelihood of winning an opportunity. It will show you a number from 0 to 99.</p><p>8. Review and build your prediction.</p><p><strong>Setting Up Your Prediction in Einstein Prediction Builder with a Custom Formula Field</strong></p><p>Alternatively, we can set up opportunity scoring using a formula field. The first method (using yes and no filters) is preferred, since it minimizes the probability of an error when creating a formula field and allows defining all prediction elements within the prediction builder UI. <br> <br> This is how you can define opportunity scoring using a formula field:</p><ol><li>Create a custom formula field returning text:</li></ol><p><strong>Custom Formula Field: Opportunity Outcome</strong><br> CASE (StageName, “Closed Won”, “TRUE”, “Closed Lost”, “FALSE”, NULL)</p><ul><li>“TRUE” is returned for positive examples — Opportunities in Closed Won Stage,</li><li>“FALSE” for negative examples — Opportunities in Closed Lost Stage,</li><li>NULL is returned for opportunities in any other stages (we will score those).</li></ul><p>This is how the setup looks in the avocado framework:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*He0HKgkwoyWlYgzmfy2zTw.png" /></figure><p>2. In the Prediction Builder wizard, steps 1–3 are the same as above. At step 4, we need to specify that the field to predict already exists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwv--vX8fqkCqPNi9zoUCw.png" /></figure><p>3. Next, select this new custom formula field “Opportunity Outcome<strong>”</strong> as the field to predict, and select “Use all records that have a value for Opportunity Outcome”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WN85sfprDUpU_4H8gmZYNA.png" /></figure><p>4. You can then continue with steps 6–8 listed above.</p><p><strong>Next Steps</strong></p><p>After you created your prediction, you need to <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">review the scorecard</a>. <br> <br> If the quality of your prediction is too high, most likely you have hindsight bias and you need to <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">eliminate potential leakers</a>. For example, “Reason Lost” is an obvious leaker, since this field only gets populated once the opportunity is lost.</p><p>If the quality is too low, most likely you need to include more relevant data — can you create formula fields to bring data from related objects? Ask your business experts what data they would need to make this prediction — if it is useful for humans, most likely Prediction Builder can learn from it too. For example, you can add fields showing if this is a red account, number of severity 1 cases, % change in number of cases, customer success manager and solution engineer sentiment or assessment score, Account Tier, Account Health Score, average NPS score, lead product, and much more. Read more about prediction quality in this blog — <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">Understanding the Quality of Your Predictions</a>. To create the next iteration of your prediction, select “Clone” from the dropdown menu — it will save all your previous settings and you just need to make some small adjustments.</p><p>Do not forget to go to the Details tab of your scorecard. Examine your top predictors and validate that they make sense from a business perspective. Sometimes, you will find some surprising insights there — i.e. positive correlation shows which values of the selected fields correspond to a higher chance of winning an opportunity (positive predictive factors), while negative correlation shows which values of the selected fields are associated with lower win rate (negative predictive factors). Do not be discouraged if the insights are obvious — this only confirms that Prediction Builder is picking up the right patterns in your data.</p><p>When you are happy with the quality of your prediction, enable it to get the scores. To see the predicted values, add the Predictions field (opportunity score) to the list views and page layouts and optionally, add the <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_top_predictors_setup.htm&amp;type=5">Einstein Predictions Lightning Component</a> to the page layout as well.</p><p>After a few weeks or months, you will get real-life data and you will know which opportunities ended up being won or lost. Then you can do a predicted vs actual analysis to understand how your prediction is performing on real data, using <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c">Salesforce reports</a> or, if you have access to Einstein Analytics, you can use this <a href="https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000G0x2iUAB">Accuracy Template AppExchange package</a> we developed for you.</p><p><strong>Using Predictions in Your Business Processes</strong></p><p>Here are some of the ways you can use this prediction:</p><ol><li>Create a list view and sort by opportunity scores, so sales reps can prioritize opportunities with the highest likelihood to close. You can also review opportunities in the middle range (those are your borderline opportunities) and identify steps to get them back on track.</li><li>To show the top predictive factors — add the <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_top_predictors_setup.htm&amp;type=5">Einstein Predictions</a> lightning component to the opportunity layout page, so users can see reasons behind these predictions.</li><li>Use <a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Process Builder to automate task creation</a> for prioritized opportunities.</li><li>Add opportunities with low likelihood of closing to the appropriate marketing campaign.</li><li>Use <a href="https://trailhead.salesforce.com/en/content/learn/modules/einstein-next-best-action">Einstein Next Best Action</a> to provide the right recommendations to the sales reps for each opportunity based on the predictions and business rules. You can get idea of what to recommend for each opportunity based on the top positive predictive factors in the scorecard. For example, if organizing an executive briefing is associated with a higher win rate, you can recommend executive briefings for Enterprise accounts, while providing a different recommendation for SMB (i.e. industry webinar).</li></ol><p><strong>How to Assess the Effectiveness of Your AI Project</strong></p><p>How do you know for sure that this AI project was a success? This is where you can go back to your original goal and review your KPIs — Win Rate and Revenue. You can look at YoY changes, but the gold standard for assessing any intervention is to use a control group. For example, you can show opportunity scores only to a small group of sales people, while others continue doing business as usual and will represent your control group (just make sure these groups are quite similar and minimize any other external factors that can influence your outcome). If there is an uplift in the KPIs in the opportunity scoring group compared to the control group, congratulations — your AI project has made the world a better place!</p><p>If you’d like to review the full process for building and deploying predictions to end users, see <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">this recent post</a>.<br> <br>For more on the latest when planning your prediction, check out the official <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_plan.htm&amp;type=5">Salesforce documentation</a>.</p><p><strong>Related Blog Posts</strong></p><ol><li><a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">Introduction to Machine Learning</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">How to turn your Idea into a Prediction</a></li><li><a href="https://medium.com/@nicolai.johnson/my-einstein-prediction-builder-toolkit-3ca1c026a477">Einstein Prediction Builder Toolkit</a></li><li><a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-to-predict-opportunity-amounts-1d19d89b2c58">How to Use Einstein Prediction Builder to Predict Opportunity Amounts</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">Which fields should I include or exclude from my model?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">Understanding your Scorecard Metrics</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">Understanding the Quality of Your Prediction</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">A Model That’s Too Good to be True</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">Thinking Through Predictions with Bias in Mind</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c">How do I know if my prediction is working?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Custom Logic on Predictions from Einstein Prediction Builder</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2c8e8921d0a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-for-opportunity-scoring-a2c8e8921d0a">How to Use Einstein Prediction Builder for Opportunity Scoring</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Einstein Prediction Builder to Predict Opportunity Amounts]]></title>
            <link>https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-to-predict-opportunity-amounts-1d19d89b2c58?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/1d19d89b2c58</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Thu, 07 May 2020 20:28:34 GMT</pubDate>
            <atom:updated>2020-05-11T22:32:04.947Z</atom:updated>
            <content:encoded><![CDATA[<p>by Anastasiya Zdzitavetskaya, Director of Product Management at Salesforce</p><p>Opportunity amounts change throughout the opportunity lifecycle, so predicting the final amount when the opportunity is closed becomes extremely important for forecasting. It can also have a positive impact on your revenue since knowing what factors are associated with bigger deals can give you valuable insights, and you can re-design your business processes to drive more revenue.<br> <br>In this example, we are predicting the final opportunity amount, given that an opportunity is “closed won”. We are excluding opportunities that were lost since those amounts represent estimates by salespeople and are not proven by real-life data. <br> <br>We highly recommend that your read <a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-for-opportunity-scoring-a2c8e8921d0a?source=collection_home---6------0-----------------------">this post</a> first, so you understand the context behind the frameworks we are using.</p><p><strong>Defining a Use Case</strong></p><p>The worksheet below discusses the value that the opportunity amount prediction would help drive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T2hrtYFHdjzcq9JMKbYc9g.png" /></figure><p><strong>Gathering Requirements</strong></p><p>Now that you have identified your use case, let’s gather some requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2BIcLdzvRK_JyTyH4WgiHw.png" /></figure><p><strong>Planning Your Prediction</strong></p><p>For the opportunity amount use case, our avocado framework might be structured like this:</p><ol><li><strong>Dataset</strong><em> — all records in the Opportunity object. We want to exclude Lost Opportunities because it does not matter for our prediction what the estimated amount was for a lost opportunity. We will use a segment filter to select only records we want for our analysis: Stage Does Not equal to Closed Lost.</em></li><li><strong>Examples</strong> — all <em>Opportunities in Closed Won Stage and where the final amount was greater than 0.</em></li><li><strong>Records to Predict/Score</strong> — <em>Opportunities in any other stage.</em></li></ol><p><strong>Tip: You do not need to specify positive and negative examples since it is not a binary classification (Yes or No question). For numeric predictions, you just need to specify which records to use as examples. </strong><br> <br>While every org may be a little different, enter information according to what the different data buckets would look like in your org.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oArOryNxKgW_37jLILYHAg.png" /></figure><p><strong>Setting Up Your Prediction in Einstein Prediction Builder</strong></p><ol><li>Select the “Opportunity” object and apply a segment filter.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJgnPC4d_rzSF7xJEyIQ1w.png" /></figure><p>2. We’ll be predicting a number (Opportunity Amount).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vORBq8h0o_1oLe0zAzqMfA.png" /></figure><p>3. Add a new condition to specify that we want to only learn from opportunities that were won.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_nQMXr7g_Ndh6gMwOJRQg.png" /></figure><p>4. Include relevant fields. We recommend including all fields as you might get some unexpected insights; however, there are a few exceptions discussed in <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">this post</a>.</p><p>5. Pick the name of the field where your predictions will be stored. This is the field that will represent predicted opportunity amount.</p><p>6. Review and build your prediction.</p><p><strong>Next Steps</strong></p><p>After you created your prediction, you need to <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">review the scorecard</a>, iterate on your prediction, and enable your prediction to get scores. To see the predicted values, add the “Predictions” field (Predicted Amount) to the list views and page layouts. <br> <br>If the quality of your prediction is too high, most likely, you have a hindsight bias, and you need to <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">eliminate potential leakers</a>. For example, “Sales Commission” is an obvious leaker since we can derive this field from Opportunity Amount.<br> <br>If the prediction quality is too low, most likely, you need to include more relevant data — can you create formula fields to bring data from related objects? Ask your business experts what data they would need to estimate opportunity amount — if it is useful for humans, most likely Prediction Builder can learn from it too. Read more about prediction quality in this blog — <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">Understanding the Quality of Your Prediction</a>. To create the next iteration of your prediction, select “Clone” from the dropdown menu — it will save all your previous settings, and you just need to make some small adjustments. <br> <br>Do not forget to go to the Details tab of your scorecard. Examine your top predictors and validate that they make sense from a business perspective. Sometimes, you will find some surprising insights there — i.e., positive correlation shows which values of the selected fields correspond to bigger deals (positive predictive factors), while negative correlation shows which values of the selected fields are associated with smaller deals (negative predictive factors). Do not be discouraged if the insights are obvious — this only confirms that Prediction Builder is picking up the right patterns in your data. <br> <br>After a few weeks or months, you will get actual values for opportunity amounts, and you will know which opportunities ended up being won or lost. Then you can do a Predicted vs. Actual analysis to understand how your prediction is performing on real data, using <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c">salesforce reports</a> or, if you have access to Einstein Analytics, this <a href="https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000G0x2iUAB">Accuracy Template AppExchange package</a> we developed for you.<br> <br>When analyzing predicted vs. actual for numeric values, it is important to look not only at absolute values but at % error as well. For example, if your opportunity amount was predicted to be $100,000, but it ended up as $90 000, an error of $10,000 is substantial in absolute terms (especially if a majority of your opportunities are less than $10K), but represents only a 10% error for this opportunity.<br> <br>Besides showing the predicted amounts, you can improve your business processes to drive bigger deals — use <a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Process Builder to automate task creation</a>, use <a href="https://trailhead.salesforce.com/en/content/learn/modules/einstein-next-best-action">Einstein Next Best Action</a> to show different recommendations based on the insights from the scorecard, and deploy personalized marketing campaigns for small, medium and large opportunities. <br> <br>Finally, to assess the success of your AI project, always look back at your KPIs. Were you able to increase the win rate, revenue, and accuracy of forecasting? You can look at YoY or quarterly changes for comparison. Alternatively, you can conduct a pure scientific experiment with a control group. In essence, your pilot group will follow the improved business process with the prediction while the control group “gets the placebo.” If you see a substantial uplift in KPIs in your pilot group vs. control group, your project is a huge success, and you deserve a promotion. Next, you can predict the likelihood of being promoted, a promotion amount, number of days until promotion… — but with all seriousness, once you start predicting, it is hard to stop. Happy predicting!</p><p><strong>Resources</strong></p><ol><li><a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">Introduction to Machine Learning</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">How to turn your Idea into a Prediction</a></li><li><a href="https://medium.com/@nicolai.johnson/my-einstein-prediction-builder-toolkit-3ca1c026a477">Einstein Prediction Builder Toolkit</a></li><li><a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-for-opportunity-scoring-a2c8e8921d0a?source=collection_home---6------0-----------------------">How to Use Einstein Prediction Builder for Opportunity Scoring</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">Which fields should I include or exclude from my model?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">Understanding your Scorecard Metrics</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">Understanding the Quality of Your Prediction</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">A Model That’s Too Good to be True</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">Thinking Through Predictions with Bias in Mind</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c">How do I know if my prediction is working?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Custom Logic on Predictions from Einstein Prediction Builder</a></li></ol><p>For additional help on Einstein Prediction Builder, check out <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_plan.htm&amp;type=5">Salesforce documentation</a> and our modules on <a href="http://trailhead.einstein.com/">Trailhead</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d19d89b2c58" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/how-to-use-einstein-prediction-builder-to-predict-opportunity-amounts-1d19d89b2c58">How to Use Einstein Prediction Builder to Predict Opportunity Amounts</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Einstein Prediction Builder: How to turn your idea into a prediction]]></title>
            <link>https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/8393c1319205</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[einstein]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Tue, 05 May 2020 23:52:33 GMT</pubDate>
            <atom:updated>2020-05-06T00:28:41.748Z</atom:updated>
            <content:encoded><![CDATA[<h3>Einstein Prediction Builder: How to Turn Your Idea Into a Prediction</h3><p>by Thierry Donneau-Golencer, Sr. Director, Einstein Product Management, Salesforce<br> <br>Einstein Prediction Builder makes it easy to create a custom prediction for your business. You don’t have to worry about ETLing your data, data wrangling or picking which algorithm to use or tuning its parameters. Even better, you don’t have to worry about the infrastructure to run these models in production, model retraining over time, or how to integrate the predictions back into your business processes in Salesforce. Once set up, training and scoring happen automatically behind the scenes and the predictions are available on a custom field on the object where your data is stored, readily available on the records your end users interact with and for automation via Process Builder or Einstein Next Best Action for example.<br> <br>Keeping all that in mind, setting up a prediction with Einstein Prediction Builder is only one step of the journey. This blog will take you through the six steps of the prediction lifecycle and help you turn your idea into a prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZoGsmbrsYB8OZnmlXV9wQA.png" /></figure><p><strong>Step 1: Define your use case</strong><br> <br>It all starts by identifying a business outcome that you want to improve. <br> <br>For example, your sales team may have a low lead conversion rate, spending hours chasing leads that do not convert. Another example could be that your support team may get low CSAT scores because of high priority cases that got escalated while lower priority cases were being addressed. Maybe your churn rate is higher than you would like, and there might be a way to resolve that by targeting specific groups with special offers before you lose them.<br> <br>You are probably already thinking about many potential use cases for your business and wondering where to start.</p><p>Here are a few questions that may help you select a use case:</p><ol><li>Is it tied to a high-value business outcome? (if not, nobody will care)</li><li>How are you going to use the prediction?</li><li>Is there a business KPI you can measure and determine if the prediction has had an impact?</li><li>Do you have the data in Salesforce, and can you report on it? (if you can’t report on it, you can’t predict it!)</li></ol><p>To help you think that through, there’s nothing like a good-old Mad Libs to make it fun. See <a href="https://medium.com/@nicolai.johnson/my-einstein-prediction-builder-toolkit-3ca1c026a477">this post</a> to learn more.<br> <br>The example I will use for the remainder of this post comes from a customer in Paris I worked very closely with. This was an up and coming business in the networking services industry and the problem they were facing was that many of their customers were paying their invoices late. In fact, after pulling a quick Salesforce report, they realized that only 35% of their invoices had been paid on time the past year! In turn, that caused them cash flow issues.<br>To address this issue, they used Einstein Prediction Builder to predict which invoices would be paid late. Here’s how they addressed the questions above:</p><ol><li><strong>Is it tied to a high-value business outcome?</strong> Yes, more money in the bank, less cash flow issues.</li><li><strong>How are you going to use the prediction? </strong>Create a task for account managers, two weeks ahead of the due date, for invoices that were likely to be paid late, so they would remind their customers.</li><li><strong>Is there a business KPI you can measure and determine if the prediction has had an impact? </strong>Yes,<strong> </strong>percentage increase in invoices paid on time.</li><li><strong>Do you have the data in Salesforce, and can you report on it? </strong>Yes<strong>, </strong>the data is in the Invoice object in Salesforce.</li></ol><p><strong>Step 2: Identify the data that supports your use case</strong><br> <br>Now that you have picked a solid use case, the next step is to frame your prediction for Einstein Prediction Builder. <br> <br>Prediction Builder can handle two types of predictions:</p><ul><li>Binary predictions (answering a Yes/No question)</li><li>Numeric predictions (predicting a number)</li></ul><p>In our case, we could frame the problem both ways:</p><ul><li>Will an invoice be paid late? (Yes/No question)</li><li>How many days late is an invoice likely to be paid? (Numeric)</li></ul><p>To answer these questions, Prediction Builder uses Machine Learning, leveraging historical data to predict the future. In a nutshell, Machine Learning algorithms find patterns in historical data to apply to new data and make predictions. If you want to know more, I recommend reading this <a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">Introduction to Machine Learning</a>.<br> <br>Going with the first question above (“Will an invoice be paid late?”), we will need examples of invoices that were paid late (answer is yes, so we call them positive examples) and examples of invoices that were paid on time (answer is no, so we call them negative examples). These records constitute the Example Set (also called Training Set).</p><p>Once Prediction Builder has been trained on those examples, it can then predict on records for which we don’t know the answer yet. These records are referred to as the Prediction Set (also called Scoring Set)<br> <br>A handy tool to help you frame the problem correctly is the “Avocado Framework” (below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*mta0_FoIivpOzghkmzQhEw.png" /></figure><p>Here’s some helpful information about the avocado framework:</p><ul><li>The dataset represents all the records in your object. In our case, the Invoice object.</li><li>Within that, you can choose to segment your data if parts of your dataset are inherently different. In our case, we have both B2B and B2C customers. The ways we handle their invoices are pretty different from each other, so we are going to segment our data to focus on B2B customers that have invoices over $10K (as they represent 85% of our business).</li><li>The Example Set is composed of invoices from the past. Some of them having been paid on time (records where invoice balance is 0, and the last payment date was before the due date) and others paid late (payment date is after due date, or it’s past due date, and there is still a balance).</li><li>The Prediction Set is composed of records that have a balance but are not yet due.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*XGWZfg2276rV-XDcZY9Jpw.png" /></figure><p>If you want to create your own avocado diagram, you can get the template <a href="https://salesforce.quip.com/U8wBAbwTNTU7">here</a>.<br> <br><strong>Step 3: Create your prediction</strong><br> <br>Here is where Prediction Builder really shines. Once you have framed your question using the avocado framework, you can follow the screens in the Einstein Prediction Builder wizard and create your prediction in just a few minutes. Continuing on with our example, I’ve outlined the steps for you here:</p><ol><li>Select the Invoice object and specify the segment.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*BN8zCJ31ZDbHwDtLwnMJTg.png" /></figure><p>2. Select “Yes/No”(the question we are asking is: “Will an invoice be paid late?”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*fCGpQe15cBhZ97pd2mp8Yw.png" /></figure><p>3. Select “No Field”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*qyp2i1036shijP11uv8B0Q.png" /></figure><p>Note: if you already had a checkbox field indicating which invoices have been paid late, you would choose “Field” here and select that field on the next screen.</p><p>4. Set up the conditions for “Yes examples” and “No examples” as defined in the avocado framework.</p><p><strong>Yes (Positive Examples)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*BGJpIi_rf61NTwrPqnMbQw.png" /></figure><p><strong>No (Negative Examples)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*vR1iU7jxIRkj-ejlOI5y4Q.png" /></figure><p>5. Choose which fields you’d like to include or exclude from the Invoice object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*qPqEeqQtolHD15c_pBpNIw.png" /></figure><p>We recommend keeping most fields selected; however, there are a few exceptions to keep in mind. See <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">this post</a> to learn more.</p><p>6. Pick the name of the field where your predictions will be stored, review, and build!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nl56pzH3Bi7tR4Vq8Y8Oyw.png" /></figure><p><strong>Step 4: Review, Iterate &amp; Enable Your Prediction</strong><br> <br>Once your prediction is “Ready for Review,” click on the drop-down menu of your prediction and select “View Scorecard”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*cMbUIN26V8t8TuSUSi5_7g.png" /></figure><p>The scorecard gives you access to different metrics on your prediction. You can learn more about how to review the metrics of your scorecard in <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">this post</a>. <br> <br>When reviewing your scorecard, there are a few things to look for:</p><ul><li>On the “Overview Tab”, take a look at the “Prediction Quality.” In general, the higher, the better, but if it’s too high (greater than 95%), it might be too good to be true. <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">This blog post</a> can tell you more about the quality of your predictions.</li><li>If you are in the red zone over 95%, it is probably because your model suffers from a common issue called label leakage. For example, the first time this customer created the late payment prediction, they were in the red because a field called “Late Payment Fee” had been left in. “Late Payment Fee” was a leaker as this information was never available at the time of prediction, but only after the fact, when the outcome was known. Fortunately, we have you covered. <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">This post</a> will help you better understand what leakers are and how to remove them from your models.</li><li>On the “Details Tab”, sort by impact and look at the top 10–20 predictors. Here are some things to keep in mind as you look at this tab:</li></ul><p>* Do the top predictors and the sign (positive or negative) for the correlation coefficients make sense based on your business knowledge?</p><p>* Are there any potential leakers in your model?</p><p>* Are there some fields that should be removed as they could introduce some bias? (this is a tricky one, but we got you covered again in <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">this post</a>)</p><p>* There might already be interesting business insights there; predictors that are actionable will be particularly interesting to you as you will be able to integrate them into your business processes right away. For example “Autopay” and “Payment Method” seem to have high impact here, so you could see how you could try to encourage more of your customers to switch payment methods via a campaign with potentially incentives such as a small discount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*HZ32Mkr4RNnvHDqMMzlMRw.png" /></figure><p>Based on this analysis, you are most likely going to need to iterate a bit and tweak your prediction.</p><p>Common tweaks include:</p><ul><li>Adding or removing fields (usually leakers)</li><li>Creating a segment to focus on parts of your data</li><li>Updating your example filters</li><li>Adding relevant data from other objects via formula fields or roll-up summary fields (using data from child and parent objects for your prediction is on our roadmap)</li></ul><p>What is extra nice is that Prediction Builder makes it very fast and easy to do these iterations, as you can “Clone” or “Edit” your prediction, and everything will already be pre-filled for you.</p><p>Once you are happy with your prediction, click on the drop-down menu on your prediction and select “Enable”. This will trigger the initial scoring of your data and all the records in your Prediction Set (right side of the Avocado) will get a prediction.</p><p>Moving forward, all new records and updated records in that set will be re-scored on an hourly basis. The model will also be retrained automatically every month, so you don’t have to worry about it becoming stale over time!</p><p><strong>Note</strong>: We also have a pilot for real-time scoring. Reach to your Salesforce account executive if you’re interested!<br> <br><strong>Step 5: Monitor your prediction</strong></p><p>Enabling your model doesn’t necessarily mean it is ready to integrate into business processes just yet though! In fact, it is recommended to let it run for a period of time behind the scenes (or only surfacing scores to a small number of users) until you can assess its performance on new data. <br> <br>After your model has run for a while on new data, you will indeed be able to know if it is really working by comparing your predictions with what actually happened! The timeframe for this analysis will vary based on your data throughput and the length of your business cycles, but a good rule of thumb is a couple of months.<br> <br>An easy way to do this analysis is by using reports. <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c?source=collection_home---6------8-----------------------">This post</a> will give you step by step instructions on how to set those up.</p><p>Below, you can see that for higher scores, most invoices ended up being paid late, while for lower scores, most were paid on time. It seems that our model is performing pretty well!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*0w5Ra50wwrnN8I2izGZ-IQ.png" /></figure><p>For those of you who have access to Einstein Analytics, we have also created this nifty little package that you can get on the AppExchange for free: <a href="https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000G0x2iUAB">Einstein Prediction Builder Model Accuracy Template</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*B_yY6bU-MS5-J8-JsQLIOA.png" /></figure><p>If you are happy with what you see, you are ready to move on to the next and final step - using your prediction!<br> <br> <strong>Step 6: Deploy and use your prediction </strong><br> <br> There are multiple ways to use a Prediction Builder prediction in Salesforce:</p><ul><li>Add the prediction field to a list view and sort by score. If we used this method in our example, invoices that are more likely to be paid late will be listed at the top and brought to everyone’s attention.</li><li>Add the <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_top_predictors_setup.htm&amp;type=5">Einstein Predictions Lightning Component</a> to the Invoice page, so you can see the top predictors that influence each particular prediction. That will give you helpful information when you reach out to each customer.</li><li>Run automated flows based on the prediction, using Process Builder. For example, sending a task to account managers two weeks ahead for invoices that are predicted to be paid late. <a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">This post</a> will tell you how to set that up.</li><li>Use your prediction along with business rules in an <a href="https://trailhead.salesforce.com/en/content/learn/modules/einstein-next-best-action">Einstein Next Best Action strategy</a>. For example, you may decide to send a reminder to customers that are likely to pay late but only if they have not had a meeting with you in the last month and they are not part of an open up-sell opportunity.</li></ul><p>However you decide to use your prediction, it is important to:</p><ul><li>Track your KPI from <strong>Step 1 </strong>of the prediction lifecycle. You can create reports to track those and review them regularly. <a href="https://medium.com/@nicolai.johnson/my-einstein-prediction-builder-toolkit-3ca1c026a477">This post</a> will give you some ideas on the type of dashboards you can set up</li><li>Consider a phased roll-out to collect qualitative and quantitative feedback from your users and improve as needed.</li><li>Review your assumptions and the reports from <strong>Step 5</strong> regularly. Even though the model gets retrained automatically, your business will change over time; new processes will be put in place, new fields added which may require modifications to the model.</li><li>Manage the change in your organization. Transforming your business with AI will take time, and some business processes will have to evolve to reap the maximum benefits. Folks often ask me how AI can become a pain-killer instead of a vitamin for business, and for me, it has to do with the depth of integration into business processes. You will need to get buy-in from everyone involved (management and end-users) and show the benefits (hence, the importance of hard KPIs you can measure over time).</li></ul><p>Now that you have set up successfully your first prediction, you will likely uncover many more predictions that would help your business and that you can set up with Einstein Prediction Builder. Fortunately, Einstein never sleeps!</p><p>— <br>Here are the different blog posts I mentioned that could guide you through the various steps of your journey from idea to prediction:</p><ol><li><a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">Introduction to Machine Learning</a></li><li><a href="https://medium.com/@nicolai.johnson/my-einstein-prediction-builder-toolkit-3ca1c026a477">Einstein Prediction Builder Toolkit</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">Which fields should I include or exclude from my model?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">Understanding your Scorecard Metrics</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-the-quality-of-your-predictions-de5a171ed61e">Understanding the Quality of Your Prediction</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">A Model That’s Too Good to be True</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">Thinking Through Predictions with Bias in Mind</a></li><li><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-do-i-know-if-my-prediction-is-working-ad8ea7b8411c">How do I know if my prediction is working?</a></li><li><a href="https://medium.com/salesforce-einstein-platform/custom-logic-on-predictions-from-einstein-prediction-builder-1683a6de0951">Custom Logic on Predictions from Einstein Prediction Builder</a></li></ol><p>For additional help on Einstein Prediction Builder, check out <a href="https://help.salesforce.com/articleView?id=custom_ai_prediction_builder_plan.htm&amp;type=5">Salesforce documentation</a> and our modules on <a href="http://trailhead.einstein.com/">Trailhead</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8393c1319205" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-how-to-turn-your-idea-into-a-prediction-8393c1319205">Einstein Prediction Builder: How to turn your idea into a prediction</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Einstein Prediction Builder: A Model That’s Too Good to be True]]></title>
            <link>https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/f1754e5ca48e</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 20:19:50 GMT</pubDate>
            <atom:updated>2020-04-24T00:10:21.716Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Model That’s Too Good to be True - How to deal with Label Leakage</h3><p>by Kevin Moore, Lead Data Scientist, Salesforce</p><p><strong>Machine learning algorithms will learn patterns that are present in the data you show them, so be careful what you show them. </strong><br> <br>When you train a machine learning model, you’re implicitly telling the algorithm that the data you’re feeding it is trustworthy. You’re telling it, “Here are some examples of successes, here are some examples of failures. Extrapolate patterns from these so that we can predict the outcome of new records.” This can sometimes lead to surprising and unhelpful results, where the algorithm picks up on data that is filled in after the outcome is known.<br> <br>As an example, imagine you’re a realtor and want to have predictions on whether a house will sell in a given timeframe. You’ve diligently collected the relevant data in a custom Salesforce object House__c, and have many past examples of houses that did and did not sell within the timeframe of interest — let’s say 3 months. Based on what you’ve read in <a href="https://trailhead.salesforce.com/en/content/learn/modules/einstein-prediction-builder/get-started-with-prediction-builder">Trailhead</a>, this sounds like a great candidate to apply machine learning. A simplified version of the House__c object may look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*K-Z5h-tbVVeHnQmN4XPjew.png" /></figure><p>The houses you want to make predictions for would be houses that are on the market (preferably close to when they are posted), but not yet sold. This means certain pieces of information in the object will not be available, such as the final sale price, the closing date, closing costs, etc. You would instead expect your prediction to be based on information available before the house is sold, such as size/location data of the house in question, the asking price, and other similar quantities.<br> <br>A human manually building a model would look at this data and manually exclude fields that aren’t available before the house is sold so that that model will only depend on the relevant fields that exist when predictions are required. However, the machine learning algorithms do not have wisdom on their own; they will simply do what you tell them (for more on how machine learning works, <a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">check this post out</a>). If you ask a model to use all the fields in your object, then the algorithms will happily crunch all the data and find strong predictors of the outcome regardless of whether it makes business sense to use those fields. For example, a model may consist of the single rule that whenever the difference between” initial posting “and” close date “is less than 3 months, then the label is True! Moreover, the model will think it has done a great job since all its predictions on the existing labeled data turned out to be correct — even on the unseen holdout set it didn’t train on!</p><p>Unfortunately, this model would not be useful in making predictions in the context the realtor cares about. All its predictions on unsold would be negative because the close date is never filled out on unsold houses! We call this problem “Hindsight Bias or “Label Leakage,” see <a href="https://trailhead.salesforce.com/en/content/learn/modules/einstein-prediction-builder/train-your-filters">this Trailhead</a> for more examples.<br> <br>The machine learning pipelines powering Einstein Prediction Builder will do their best to remove fields that look like leakers, but these methods are not perfect. Hence,<strong> you need to be vigilant in inspecting your models for potential label leakage</strong>.<br> <br>The main question you should ask yourself to determine if a field should be included in your prediction is:</p><ul><li>Do the values of this field look similar to the values on the records for which I want to make predictions?</li></ul><p>This should filter out common leakage sources where a field is modified after the label is known. An example of this would be leaving in a “closed reason” field that can only be filled out when the prediction is negative. All records you’d want a real prediction on would not have this filled in, so it doesn’t make sense to include in your model.<br> <br>It can also help filter out fields whose usages have drifted over time. Perhaps you used to have a process where you would try and predict the outcome by hand or use a prediction from some other source. Unless you are very careful about leaving these fields unchanged once the label is determined, then including them can cause label leakage. Or perhaps you just have a field (IdInUnusedExternalSystem) that was used in the past but isn’t used anymore. It’s better to leave that field out since it won’t be filled in on any of the new records that you want to make predictions on.</p><h3>How to Diagnose Label Leakage in Your Model</h3><p>The first thing to check is the model scorecard (<a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">see this post for more information on the Einstein Prediction Builder Scorecard</a>). If the model quality is listed as “Too High”, then that may mean there was label leakage. It could be that the model was just able to do an excellent job at predicting what you asked, but such models are often too good to be true, so you should be especially wary of high model quality. Even if your model quality is modest, it is still essential to check your top predictors and see if they make sense for your use case.<br> <br>In an extreme example, where there is a leaky field that didn’t get removed automatically, you could see it contributing much more than other fields of your object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*Cvb7OGvkP3VDgWSaDDnP5Q.png" /></figure><p>If you see a single feature jump out as much more impactful than everything else in the model, then you should inspect your data and see if that makes sense for your use case. This can sometimes be a sign of label leakage but is not always a bad sign. Your data and use case may have a single field that’s legitimately much more important than everything else, but it’s advisable to do a double-check.<br> <br>Another way to diagnose things after a model is built is by looking at the predictors’ detail page on the ScoreCard, which will show a table containing information about the top features (by the impact), in particular the feature name, its impact, correlation, and weight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*6z6skwOK6LPS9oU1NRIwWw.png" /></figure><p>The main things to pay attention to are the impact (this is the weight scaled to be between 0 and 1), and correlation. Are there any features with large correlations or large impacts that should not be there? <br> <br>Einstein Prediction Builder will automatically remove features above a certain correlation threshold because they are typically proxies for the label. However, it can still leave in features that you don’t want in your model. Check the correlations and see if any of the high correlation features belong in your model. <strong>Are any of these features known before the label is known? Are they modified at all after the label is determined?</strong> If they’re modified after the label is known, you should make a new prediction where you remove them, since the model may have learned from information that is unavailable when you want to make predictions.<br> <br>There are also automatic tests that check whether selected fields look similar between the training data (labeled data that passes the custom training filter) and the scoring data (everything else). If a field looks radically different between the training and scoring data sets, then that indicates the field is not useful in the prediction because the model will learn patterns from the training data that are not present in the data on which it will make predictions. For example, this would catch and remove a field that is always filled in for training data (like Close_Date__c in the house price example from the beginning) but is never filled in on the unlabeled records on which you want to make predictions.</p><h3>Putting This Into Practice</h3><p>Here are a few examples that are similar to real-world cases we have run into when diagnosing models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*aQiJWAkUIa3cKmsvT4yW-g.png" /></figure><p>In this case, the label is the “Converted” field, making it a binary classification problem. The status field encodes more detailed information on why a record converted or why it didn’t. If you were to train a model that predicted the “Converted” field and included “Status” in your model, then you would be introducing label leakage in your model. This is a more subtle case than the ones shown before because some choices do not leak information and could exist on the unlabeled records you want to make predictions on (e.g., “Waiting”). Still, other decisions clearly indicate what the label is. The “Too expensive” choice always goes with a negative outcome, while the “Converted — 12mo subscription” choice always goes with a positive outcome. The field as a whole is a leaky field, even though not every choice is. You can again apply the test of comparing what the values look like on labeled vs. unlabeled records, here a very different set of choices, and determine that this field is not a good field to include in your model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*k1zac2Lj3YwE8GlbfSy8Hg.png" /></figure><p>To give one more example, let’s say you want to predict whether a customer will make a late payment on an invoice — here the “Late” binary field. Assume that this field is filled out either after the due date has passed without payment, in which case it’s late, or when payment is received. There’s also a “Days late” field that defaults to 0 and corresponds to how many days late the invoice payment is. A value of 0 in this field means either the due date hasn’t arrived, and there’s been no payment yet (so not late yet), or the payment was received on the due date. Negative values correspond to early payments, and positive values correspond to late payments. Including a field like “Days late” in your model will also contribute label leakage into your model because the value often depends on the label itself. Applying the test of comparing what the values look like on labeled vs. unlabeled records, you can see that this field typically looks different between the two, which means it is not a good field to include in the model.</p><h3>Summary</h3><p>Before training a model, be careful to inspect your data for fields that leak information about the label that is unavailable at prediction time. For each field you include, ask yourself, “Do the values of this field look similar to the values on records I want to make predictions on?” If the answer is no, then you should not include that field.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1754e5ca48e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-a-model-thats-too-good-to-be-true-f1754e5ca48e">Einstein Prediction Builder: A Model That’s Too Good to be True</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New in the Spring ’20 Release: Filter-Based Predictions]]></title>
            <link>https://medium.com/salesforce-einstein-platform/outline-74a8a5eb83a?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/74a8a5eb83a</guid>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Tue, 10 Mar 2020 18:13:43 GMT</pubDate>
            <atom:updated>2020-03-11T02:43:42.242Z</atom:updated>
            <content:encoded><![CDATA[<h3>New in the Spring ’20 Release: Filter-Based Predictions!</h3><p>by Sara Asher, Senior Director of Product Management at Salesforce <br> <br>Hi everyone! I’m very excited about one of our new features in the Spring ’20 release:“Filter-based predictions.” The purpose of this feature is to make it easy to construct your prediction within the Einstein Prediction Builder (EPB) wizard without needing to have a field to predict prepared in advance. <br> <br>Before we go into details about filter-based predictions, let’s talk a little bit about how predictions work in general. Einstein Prediction Builder (and other machine learning systems) learn from examples in the past to make predictions on the future. One of the types of problems Einstein Prediction Builder concentrates on are yes/no questions (binary classifications). Examples of yes/no questions are: Is this opportunity going to convert? Is this invoice going to be on time? Is this student going to graduate high school? For new records, Prediction Builder will return a number between 0 and 100 that represents the likelihood that the answer to the question is yes.<br> <br>In order for Einstein Prediction Builder to try to answer a yes/no question, it needs to have example records where the answer is definitely yes (positive examples), and example records where the answer is definitely no (negative examples). Once Einstein Prediction Builder has those examples, it can then predict on new records or on records where we don’t know the answer to the question yet.<br> <br>So how do you tell EPB which records are your positive examples, and which records are your negative examples? In previous releases of Einstein Prediction Builder, you could select a checkbox and define an example set. Then, all records in the example set that were checked are the positive examples, and all records in the example set that were unchecked were the negative examples. (And the everything not in the example set would get predictions.)<br> <br>That system worked pretty well for many use cases, but what should you do if you don’t have a checkbox like that? There is the option of creating a formula field, but that tends to be complicated and perhaps a bit error-prone. Instead, there should be an easy way for you to simply tell us which are the positive examples and which are the negative examples. <br> <br> <strong>Introducing filter-based predictions!</strong><br> <br>Now, instead of needing an already existing field that represents what you want to predict, you can directly define your positive and negative examples within the wizard. Let’s run through an example to see how it works.<br> <br>Let’s jump back to the question of whether a bill is going to be paid on-time. The positive examples are invoices where that balance is zero and was paid before the due date, and the negative examples (the late invoices) are ones where they paid, but the invoice was only paid off after the due date OR they still have a balance due, and the due date has already passed.<br> <br>It is pretty easy to think of these as filters on your data.<br> <br><strong>Positive examples: </strong>Records where invoice balance is 0, and the last payment date was before the due date</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RWFIHwRJexqbzE7h7W4n4g.png" /></figure><p><strong>Negative examples: </strong>Payment date is after due date OR it’s past due date, and there is still a balance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aypoyx6UhMJ8KmzJp3gL8g.png" /></figure><p>One note to consider when setting up filters like this: your “yes” examples and your “no” examples should be distinct from each other. Einstein can’t differentiate between your positive and negative examples if your records are both at the same time! <br> <br>Anyway, now that we have a feel for how we could create filters to represent our positive and negative examples, let’s see how we would create this prediction within Einstein Prediction Builder.<br> <br><strong>Building a filter-based prediction</strong><br> <br>Just like any prediction, you first need to tell us what object the prediction is for and then let us know what kind of prediction you intend to create. In this case, the prediction is on the Invoice object, and we wish to answer a Yes/No question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AltJBT8SvGSPUpZPiJdRcw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_BQCxDgGijhd9_maB4JhaA.png" /></figure><p>At this point, you will notice a new question from Einstein Prediction Builder: <em>Is there a field that can answer your prediction question</em>? If you already have a checkbox or formula field set up, choose the “Field” option. But in this case, we don’t have a field, so we choose the “No Field” option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jRuU3mAK7Msb16VNBxF_A.png" /></figure><p>After selecting that option, you will see that you now have the opportunity to fill in “Yes” examples and “No” examples, which we can do just as we planned out above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4XwRcOEyVlm-l6kvokUPw.png" /></figure><p>Once you’ve entered in your two filters, you can validate your logic by using the data checker to the right of the screen. The data checker will tell you how many positive and negative examples you have and how many records will receive predictions. The rest of the wizard remains the same. And that’s it! You can now create predictions without needing to have a field to predict prepared in advance. <br> <br>We hope these new filter-based predictions are helpful when setting up your new predictions! Please try it out, let us know if you like it, and have fun predicting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74a8a5eb83a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/outline-74a8a5eb83a">New in the Spring ’20 Release: Filter-Based Predictions</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complication with Dates V2]]></title>
            <link>https://medium.com/salesforce-einstein-platform/complication-with-dates-v2-2d93bc52edec?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/2d93bc52edec</guid>
            <category><![CDATA[einstein]]></category>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Thu, 27 Feb 2020 23:43:23 GMT</pubDate>
            <atom:updated>2020-04-24T00:11:10.479Z</atom:updated>
            <content:encoded><![CDATA[<h3>Einstein Prediction Builder: Complication with Dates</h3><p>by Michael Weil, Senior Data Scientist at Salesforce</p><p>Customer data in Salesforce has a rich variety of field types ranging from <em>string</em>, <em>double</em>, <em>picklist</em> to <em>date</em>, <em>datetime</em>, and <em>time</em>. Einstein Prediction Builder takes into account these different types to prepare the data for modeling (for more information on modeling and some of the other terms used in this post, check out <a href="https://medium.com/salesforce-einstein-platform/an-introduction-to-machine-learning-9f5bfc146942">this blog</a>).<br> <br>In the case of date fields, it will leverage information about the day, day of the week, month, and year, the number of days between two dates, and more. <br> <br>With the usage of date fields, here are some common misconceptions users should be aware of:</p><h3>1. Leakage with Date</h3><p>Dates fields are not immune to problems of leakage. A more in-depth post on data leakage is coming soon. The idea is that machine learning models will learn from information present in the data during training, but that will be missing on new records one is trying to predict until the true label is revealed.<br> <br>Consider an example of an Opportunity object where the goal is to predict whether the opportunity will be won or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*bwj0M2PQRS9eGJnl7rCkNQ.png" /></figure><p>In the example above, Customer B and Customer C do not have the ClosedDate field filled in yet, the reason being that those are still in an intermediate stage- Negotiation/Review, Prospecting. By default, the label IsWon is No for these two customers. We can think that the label should be empty during intermediate stages, but we might have an example of records in which customers are “lost” early during sales development, and admins do not update the Stage field.<br> <br>If we are training a model on this data and by keeping this ClosedDate field, it will “remember” the association between missing CloseDate and IsWon being No. On new data, the opportunities are not closed yet; therefore, the date field is missing. As a consequence, the model would predict No.<br> <br>The problem boils down to dates that are posterior to the label. Other fields having similar issues as CloseDate include DaysToDate and DaysInStageX.<br> <br>Other sources of leakage are automated processes done with the dates. Let’s take the example of Lead data where we are missing information on some lost leads: leads lost during a month have by default the first day of the month as the open date. If a lost lead had been opened in December 2019, the open date would be by default 12/1/2019. In that case, the model will learn an association between the open day being the 1st and the record being lost. This model will be heavily biased towards new records that are open during the first of the month.<br> <br>Admins should also be cautious when trying to predict a formula field. For example, if the label is a formula field in relationship with a date field : LABEL = If(DATE &gt;= 08/03/2019) TRUE Else FALSE<br>The field DATE determines LABEL, therefore it should be hidden from the model.<br> <br>The same goes when including a date that is a formula field using the label: DATE = If(LABEL == TRUE) 12/31/2019 Else Null<br> This DATE will be useless in training since LABEL will be missing for new records to predict.<br> <br>As you can see, dates are a significant source of leakage, and most of the time, it makes sense to exclude them when selecting which fields from your data to include in your model. For more guidance on which fields to include and exclude for your prediction, check out <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">this blog</a>.</p><h3>2. Dates disguised as Strings</h3><p>Admins can create many custom fields of different types. But sometimes the salesforce field types are misused. For example, admins might be tempted to create a custom field of type string despite containing dates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*Z6RDpdsAeTkSmf7QOKumJQ.png" /></figure><p>Einstein can leverage interesting information from date fields such as the day of the week, the month of the year, etc. But in that case, as this CustomField is of type string, it can’t be inferred as a Date; therefore, we are losing this information. Be aware of this when choosing your field types!<br> <br>The use of the typed string usually comes from the fact that dates are not in the same format. In the example below, some dates are not in the MM/DD/YYYY format. Besides making Einstein Prediction Builder’s life easier, using a Date type will bring consistency to your data as an added benefit!</p><h3>3. The Case of System Fields</h3><p>In addition to custom fields, Salesforce contains generic fields called System Fields. Those are fields that are updated during API operations such as record creation, record updates, etc. Some of these System Fields are dates: CreatedDate, LastModifiedDate, SystemModstamp. In general, when training the model, these fields are automatically filtered out as those dates are irrelevant for building a prediction. But there might still be a risk. <br> <br>Let’s take the example of an admin trying to predict a Sale Cycle Length using this formula : <br> Sales_Cycle_Length__c = CloseDate__c - CreatedDate<br> <br>This formula is probably not what the admin wanted, as the system field CreatedDate indicates when the API created the record, not necessarily when the user did. For instance, if the data has been uploaded once in bulk, the value of CreatedDate corresponds to the date of this bulk upload.<br> <br>You should consider removing fields that are (or related to) System Fields. Also, you should specify your own created date (as a custom field) as a best practice: CreatedDate__c<br> <br>Another word of caution regarding system fields: fields are not being reevaluated in real-time.</p><p>For instance, let’s say you have a formula field with Now + X # of days, , for example, you define your training set for a membership renewal scenario as: CreatedDate &gt; Now + 90 days. “Now&quot; will not be updated automatically daily but only once a month, at the time of training, when it will be substituted with the actual date and records that meet Training filter requirement at that time will be used for training</p><h3>4. Mixing historical data</h3><p>For some use cases, a wide range of historical data might be available throughout the years, and it might be better to segment data accordingly to avoid some mix-up. Especially if the business processes what a specific file is used for, or the way to collect data has changed over time.<br> <br> There is also the odd case where the same instance is evolving over time. For example, if an admin wants to predict who is likely to become part of a frequent flyer program, it could be that some customers have fallen in and out of status over time, so there is a chance to encounter multiple instances of the same customer :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*Jdpl0Jy71-jHQiBgxgm5Sg.png" /></figure><p>In this case, there are records of Customer A in both 2020 and 2018. In 2018, this customer was a frequent flyer; in 2020, she is not anymore. This indicates that this data has a time component in which records change over time. It is not necessarily a yearly cadence; The period can be in months, days, seconds.<br> <br>In that sort of problem, it would be desirable to select the data accordingly. Potential ways to address this scenario include training on 2019 data in order to predict 2020, picking the most recent record for a given customer, or setting it up in such a way that a customer is considered a Frequent Flyer (“Yes Label”) if she/he has ever been a Frequent Flyer.</p><h3>5. Time Series</h3><p>As seen above, admins sometimes want to solve specific problems where dates/time play a huge part. In the case of records that are <em>ordered</em> by time, the use of models to predict future values is then called time series forecasting. A date field indexes data and usually equally spaced by time (minutes, days, months,…).<br> <br>Examples of such predictions include predicting sales price, weather temperature, number of bookings, and case volume.<br> <br>Time Series is generally composed of a systematic pattern and some random noise. In addition, you can decompose the pattern into:</p><ul><li>Trend — a component that changes over time and does not repeat.</li><li>Seasonality — a component that repeats periodically.</li></ul><p>Time Series forecasting has its variety of techniques like (seasonal) ARIMA models or Deep Learning.</p><p>Einstein Prediction Builder does not currently support those methods.<br> <br>If you think your prediction might be a time-series, please consider another tool for predicting the forecast, such as <a href="https://www.salesforceblogger.com/2018/10/18/a-look-to-the-future-with-timeseries-part-2/">Einstein Analytics Time Series</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*-be5JatYHR4Pt3hYRwjzjQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d93bc52edec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/complication-with-dates-v2-2d93bc52edec">Complication with Dates V2</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Einstein Prediction Builder: Which fields should I include or exclude from my model?]]></title>
            <link>https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac?source=rss----f027af6d70f1---4</link>
            <guid isPermaLink="false">https://medium.com/p/eae37f231dac</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[einstein]]></category>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[articial-intelligence]]></category>
            <dc:creator><![CDATA[The Salesforce Einstein Team]]></dc:creator>
            <pubDate>Sat, 21 Dec 2019 08:34:32 GMT</pubDate>
            <atom:updated>2020-01-07T17:50:01.082Z</atom:updated>
            <content:encoded><![CDATA[<p>by Christopher Rupley, Lead Einstein Data Scientist, Salesforce</p><p>When configuring a new prediction, one of the steps involved is choosing which fields from your data you would like to include when building a predictive model. Since all of the predictive power of a model comes from what data we choose to show it, selecting the right fields is important for getting good predictions.<br> <br>Consider an example of predicting which of your sales Opportunities are most likely to be won. An example of how the set of Opportunities could look is below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*UClYOtWYlSKlD5OEEn1sHw.png" /></figure><p>The field we want to predict in this example is IsWon and the other fields are possible candidates to include as inputs into the predictive model.</p><h3>What to Include</h3><p>In short, include as much as you can. You may have some ideas about certain fields that would be useful for making predictions already. For our Opportunities example, maybe you know that they are more likely to be won when the Amount is not too high or when they come from a certain LeadSource or when the LastActivityDate is not so long ago that it has become stale. You should certainly include those fields. However, there could also be predictive power in fields that you might not expect. The opportunities from certain ContactId’s might convert better and lots of information could potentially be gained from the Description field even though it is just free text.<br> <br> The point is, there can be many tiny signals in your data that can help indicate what the final outcome may be. You may not always notice them yourself or even be aware of them, but a predictive model can leverage them to make your predictions as good as possible. Generally, the more data you give to it, the better it can be.</p><h3>What to Exclude</h3><p>With that said, there are still certain kinds of fields that you should probably not include in your model. While generally more data is better, there are some exceptions for ethical, legal, and prediction quality reasons.</p><h3>Ethical Concerns</h3><p>If you are using the predictions of a model to make any kind of business decision, you are also indirectly using the information you used to produce that model in your decision. There can be a variety of reasons that using certain types of data for decision-making can cause ethical concerns, and it will depend both on what’s in the data and the problem you are applying it to. For example, it would make a lot of sense to include a customer’s gender when you are trying to decide items of clothing to recommend, but you would probably not want to use it if trying to predict what salary you should suggest when making a job offer. A quick check is to fill in the data field you are using and the problem you are solving into the following statement:</p><blockquote><em>I am using &lt;field x&gt; to help me with &lt;problem y&gt;</em></blockquote><p>If we apply this test to the examples above it would become,</p><blockquote><em>I am using a customer’s gender to help me make the best clothing recommendation possible. </em>✅</blockquote><blockquote><em>I am using a customer’s gender to help me decide what starting salary to offer. ❌</em></blockquote><p>If you are not comfortable making that statement, the field should not be included in your model. For more details on ethical use of data and bias, see <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-thinking-through-predictions-with-bias-in-mind-9e5efe454c7e">this post</a>.</p><h3>Legal Concerns</h3><p>There can also be situations where it is prohibited by law to use certain information when making decisions. If a field contains information on a person’s race, religion, gender, or nationality, you wouldn’t want to use it as input on something like making hiring decisions in places, such as the United States, where such a thing is not allowed.<br> <br>You can apply the same test as when evaluating potential Ethical Concerns here as well and ask yourself if there could be any legal restrictions on including certain fields in your decision-making process. If your business involves things like decisions on employment, lending, healthcare, or any other similarly regulated areas, it is worth reviewing the list of fields you are using.</p><h3>Fields with “Hindsight Bias”</h3><p>There are certain situations where including a field in your predictions can actually make them worse. We can say that these fields show a “hindsight bias”. This is a field where the contents are filled in or updated on a record some time after the final value of the prediction field is determined. An example of this would be filling in the sale “Value” of an Opportunity at the time when it is won. The Value field would appear to be a very good predictor of winning an Opportunity since whenever it is present, the Opportunity is won every time. However, we cannot actually use Value as a predictor in practice since it is never available <em>before</em> the Opportunity is won (that is, it only looks like a good predictor “in hindsight”). Some other general examples of this type of issue include:</p><ul><li>Fields that are only filled at time of “conversion” or after, such as in the “Value” example above.</li><li>Formula fields that depend on the thing you are trying to predict should be excluded. For example, you may have a field that you use to identify a follow-up after an opportunity is won whose formula starts with IF IsWon AND .... This field should not be included.</li><li>If the field you are trying to predict is a formula field, any fields that appear in that formula should not be used. Suppose that instead of predicting IsWon, you are predicting another field, ExpectedValue which is equal to the formula (Value * LikelihoodToWin). In this case, you should exclude both the Value and LikelihoodToWin fields.</li></ul><p>If you have any fields that fit these criteria, they should probably not be included in making your predictions.</p><h3>Using Feedback from The Scorecard</h3><p>You may also find additional fields to exclude from you model by looking at your model scorecard after the first time you produce a prediction. We can look at the Predictors and Details tabs to see how fields have influenced the predictions and look for a few different indicators.<br> <br>If you see things like a field that has a correlation that is much higher than you would expect, especially if that one field has a much <em>much</em> higher Impact than everything else, you may want to consider excluding it from your predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opUcElpdDqA_59J9fI6E9w.png" /></figure><p>The example scorecard above shows a good example of a field that should be removed. The combination of a Prediction Quality that is “Too High” (99) and a single Top Predictor that is much higher than the others (Value) is a good indicator that that field should be considered for removal.<br> <br>You can learn more about the Einstein Prediction Builder scorecard <a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-understanding-your-scorecard-metrics-7e1ef4bba65b">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eae37f231dac" width="1" height="1" alt=""><hr><p><a href="https://medium.com/salesforce-einstein-platform/einstein-prediction-builder-which-fields-should-i-include-or-exclude-from-my-model-eae37f231dac">Einstein Prediction Builder: Which fields should I include or exclude from my model?</a> was originally published in <a href="https://medium.com/salesforce-einstein-platform">Salesforce Einstein Platform</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>