<?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[Stories by Netta Shachar on Medium]]></title>
        <description><![CDATA[Stories by Netta Shachar on Medium]]></description>
        <link>https://medium.com/@nettash?source=rss-aa634f9071ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qyfhRsCyqBizBasj.</url>
            <title>Stories by Netta Shachar on Medium</title>
            <link>https://medium.com/@nettash?source=rss-aa634f9071ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:28:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nettash/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Modeling customers’ churn? Start here]]></title>
            <link>https://medium.com/yotpoengineering/modeling-customers-churn-start-here-d19c4ee5fcee?source=rss-aa634f9071ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/d19c4ee5fcee</guid>
            <category><![CDATA[survival-analysis]]></category>
            <category><![CDATA[churn-prediction]]></category>
            <category><![CDATA[classification-models]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Netta Shachar]]></dc:creator>
            <pubDate>Tue, 19 May 2020 11:09:28 GMT</pubDate>
            <atom:updated>2021-12-30T07:59:23.314Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LzNnSu-I0UTZpGnp6qEtyA@2x.png" /></figure><p>One of the most important KPIs for any business is the customers’ retention rate, i.e. what percent of customers will purchase again. The higher the retention rate — the happier the business owner.</p><p>We often think of <strong>churn rate </strong>as the complementary event of the retention rate: <em>churn rate=1-retention rate</em></p><p>This makes sense when the business sells a subscription: if a customer didn’t renew her subscription — she churned. However, when <strong>products</strong> are sold, this perspective is inaccurate: a customer who hasn’t made an additional purchase <strong>yet, </strong>may still purchase tomorrow! This means that churn is not directly observable, which is crucial when building a <strong>churn prediction model</strong>.</p><p>At Yotpo, we recently introduced a churn prediction ability for our “Loyalty &amp; Referral” clients. This post describes 3 modeling frameworks we considered (classification, BTYD and survival models), and shares insights from our journey towards a production model.</p><p>But, as with any data science problem, first — the data.</p><h3><strong>Preparing the learning data</strong></h3><p>Since our clients are e-commerce stores, we assume the data is from such a store. Nevertheless, the ideas and principles presented throughout the blog can be easily extended to other domains, such as gaming.<br>Purchase history data, from which you infer customers’ timelines, is the starting point of any churn model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*nPdWUQ3HkEWiOY7z9jhAew@2x.png" /><figcaption>Illustration of purchase history data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fiUlL-cYZJnoBzANuXUIfQ.png" /><figcaption>Customer A’s purchases on a timeline</figcaption></figure><p>When working with temporal data, you need to ask yourself (and answer) two questions:</p><ol><li><strong><em>How much history (what’s the look back window) should I use for learning data? </em></strong>While there is no magic number, the guidelines that helped us choose an appropriate window are: a) Allow enough customers to make multiple purchases, i.e. if the average purchase rate is 3 months, don’t use a 3 month window b) If your store underwent significant changes, e.g. turning a store to fully vegan, don’t use data collected prior to the change c) If your store has seasonal effects, include all “seasons” in your data, or account for them otherwise.<br>Since Yotpo’s solution has to work for various stores, we considered windows ranging between two months and two years. Seasonal effects, including “special events” such as Black Friday, were addressed using a unique sampling technique on customers’ events.</li><li><strong><em>How should I split data into Train/Test?</em></strong><em> </em>Randomly splitting data to train/test (and validation, if necessary) is a bad idea when dealing with temporal data: If test instances occur prior to train instances, it means your test predictions are based on the future! Be sure to split so that validation occurs after train and before test.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*cs_2xYHEUAa53w6W-C0g0g@2x.png" /><figcaption>Train/ Validation/ Test splits should be conducted according to the timeline</figcaption></figure><h3><strong>Features</strong></h3><p>Given purchase history data, the most commonly used features for churn predictions are:<br>1. <strong>Frequency — </strong>number of purchases in the specified time period<br>2. <strong>Recency — </strong>time since last purchase</p><p>Other features/data sources can — and should — be considered, if available. Among the features we explored at Yotpo are: average time between purchases, average purchase amount, newsletter subscription indicator, and others. <br>You can also get some “feature inspiration” from <a href="https://arxiv.org/pdf/1703.02596.pdf">this paper</a> by Asos, discussing a closely related problem called Lifetime Value (LTV).</p><p>Ok, so now we have learning data and some features. Time to talk about….</p><h3><strong>Modeling Frameworks</strong></h3><h4><strong>1. Classification models</strong></h4><p>Churn is binary — either one buys again or not. So, binary classification seems like a natural framework.<br>Given labeled data of churned (label=1) and active (label=0) customers with predictive features, we can choose an algorithm, split the data and start training!<br>Sounds like a done deal, but building labeled data from purchase history data requires you to make one key decision:<br><strong><em>When should we label a customer as “churned”?<br></em></strong>To answer this question, consider two stores: Store A sells fruits &amp; vegetables and Store B sells ski gear. A customer of Store A who hasn’t purchased in 3 months has likely churned, whereas in Store B, 3 months is not enough to assume churn.<br>So, what’s the “correct” number for your store?<br>Since it depends on your business — find the answer in your data! <br>Look at the distribution of time between purchases, and set a “churn” threshold at the tail of the distribution. The exact threshold depends on your desired “false churn”/”false active” ratio. <a href="https://towardsdatascience.com/churn-prediction-770d6cb582a5">This blog</a> post discusses the classification approach in more detail.</p><h4>2. <strong>“Buy Till You Die” (BTYD) models</strong></h4><p>This group of unsupervised models quantify churn probability by assessing the expected number of future transactions and probability of being “alive”, using the frequency and recency features only.<br><a href="https://pubsonline.informs.org/doi/abs/10.1287/mnsc.33.1.1">Pareto/NBD</a>, <a href="http://brucehardie.com/papers/018/fader_et_al_mksc_05.pdf">BG/NBD</a> and <a href="https://www.researchgate.net/publication/247219660_Empirical_validation_and_comparison_of_models_for_customer_base_analysis">MBG/NBD</a><strong> </strong>models are the 3 main models of this framework.<br>All these models assume that the number of purchases for <strong>active</strong> customers follows Negative Binomial counting process (NBD), meaning:</p><ol><li>Number of transactions ~ Poisson(λ)</li><li>Different customers may have different λ values. We assume a prior on transaction rate: λ ~ Gamma(shape=r, scale=α)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*G8KL87GVrzY4IMafz327jA@2x.png" /><figcaption>Gamma distribution is used as a prior on the transaction rate in all BTYD models</figcaption></figure><p>The dropout process varies between models:</p><p><strong>Pareto/NBD model assumes:</strong></p><ol><li>Customers have an unobserved “lifetime” of length τ . Lifetime ~ Exp(μ)</li><li>Different customers may have different μ. We assume a prior on lifetime length: μ ~ Gamma(shape=s, scale=β)</li></ol><p><strong>BG/NBD model assumes:</strong></p><ol><li>A customer may drop out (churn) only immediately after a <strong>repeated </strong>transaction. The point a customer drops out~ (shifted) Geom(p)</li><li>Different customers may have different p values. We assume a prior on drop out probability: p ~ Beta(a, b)</li></ol><p><strong>MBG/NBD model assumptions:<br></strong>Similar to BG/NBD, except it allows customers to dropout after the first transaction</p><p>In addition, all models assume independence between purchase rate and dropout rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*jxLJM4mBkamXqORTR9deDA@2x.png" /><figcaption>Beta Distribution is used as a prior on the drop out probability in BG/NBD and MBG/NBD models</figcaption></figure><p>In practice, Pareto/NBD is rarely used due to computational challenges, while BG/NBD is the most commonly used (<a href="https://towardsdatascience.com/predicting-customer-lifetime-value-with-buy-til-you-die-probabilistic-models-in-python-f5cac78758d9">this blog</a> gives a classic example).<br>Having said that, in our e-commerce settings, we found that MBG/NBD outperformed BG/NBD thanks to its preferred modeling of one time buyers (significant portion of customers in many online stores), and both models were outperformed by Pareto/NBD.</p><h4>3. <strong>Survival models</strong></h4><p>This last framework is less familiar among data scientists, and for no good reason. <br>Designed to estimate the time until an event occurs, survival models are often used for evaluating medical treatment efficiency (“event” = death) or machines lifetime (“event” = failure time). <br>Survival models have characteristics that make them perfect for churn prediction:</p><ol><li>They account for <strong>censored</strong> data points, i.e. they take into consideration that an event that didn’t occur during the “observation period” can occur in the future</li><li>They allow different start times for different customers</li><li>They output a survival curve for each customer, presenting the “no event” probability at each time point in the future</li></ol><p>For a detailed introduction to survival models, we recommend <a href="https://towardsdatascience.com/survival-analysis-part-a-70213df21c2e">this blog</a>.<br>The most widely used survival models are statistical models, such as Cox-PH and Weibull regression. But some ML models exist as well — this <a href="https://ragulpr.github.io/2016/12/22/WTTE-RNN-Hackless-churn-modeling/">blog</a> suggests using NN, this<a href="https://cran.r-project.org/web/packages/gbm/gbm.pdf"> R library</a> uses Gradient Boosting machine, and <a href="https://cran.r-project.org/web/packages/randomForestSRC/randomForestSRC.pdf">this one</a> uses Random Forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*NNC7UpNHnkZ2cAi7MW7OWg@2x.png" /><figcaption>Survival curves allow us to estimate the probability of surviving without an “event” for various periods</figcaption></figure><h3><strong>Frameworks’ comparison</strong></h3><p>So, before we wrap up, let&#39;s summarize it all into a single table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*91tU0CeykgnEDfjloQVXsA@2x.png" /></figure><h3><strong>Final thoughts</strong></h3><p>As usual in data science, there is no one algorithm to rule them all. And, as usual in data science, your data has the answers. This review has not covered all possible approaches, or given the complete how-to for each approach. Nonetheless, we hope it serves as a good starting point for additional research, and that this post gave you some directions to think of — or even better — focused you on the direction that suits your problem best.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d19c4ee5fcee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/yotpoengineering/modeling-customers-churn-start-here-d19c4ee5fcee">Modeling customers’ churn? Start here</a> was originally published in <a href="https://medium.com/yotpoengineering">Yotpo Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>